// Tom Plick // 27 July 2005 // projector.h // Handle perspective of the board. Akin to Luna's Camera class (ch. 12), // but the Projector always points at the origin, and places // restriction on angles of view. #pragma once #include #include class Projector { private: // distance from the origin, in screen units float distance; // angle (in the xy-plane) between the z-axis // and the direction of the user's view. // Varying theta changes the location around the board // at which the user "sits". // e.g. if theta == -90 degrees, user is at left side of board; // if theta == 90 degrees, user is at right side float theta; // angle (in the xz-plane) between the y-axis // and the direction of the user's view // Varying phi changes the "height" of the user. // e.g. if phi == 90 degrees, user is looking at board top-down; // if phi == 0 degrees, user is looking parallel to the board float phi; // projection matrix D3DXMATRIX mat; void calculateMatrix(); void checkBounds(); public: Projector(); void recenter(); void setDistance(float); float getDistance(); void addDistance(float); void setTheta(float); float getTheta(); void addTheta(float); void setPhi(float); float getPhi(); void addPhi(float); D3DXMATRIX getViewMatrix(); };