///////////////////////////////////////////////////////////////////////////////
// Camera3D
// - Defines a viewer for the 3D world
///////////////////////////////////////////////////////////////////////////////
class Camera3D
{
private:
// Independant direction value
fVector4D direction; // Direction in 4-space (as a quaternion)
// Dependent values
bool bDirty; // Indicates need to recalc dependant values
fVector3D forward, // Forward motion unit vector
upward, // Upward motion unit vector
sideways; // Sideways motion unit vector
fMatrix4x4 rotMatrix; // Last computed rotation matrix
public:
fVector3D position; // Position in 3-space
// Constructor
Camera3D(const fVector3D &pos=fzero3D)
// Members
void reset(); // Position at origin, looking down Z axis
void rotate(const fVector4D &quaternion); // Rotate by a quaternion
void rotateDeg(const fVector3D °); // Rotate by xyz degrees
void rotateRad(const fVector3D &rad); // Rotate by xyz radians
void rotateDeg(float x, float y, float z); // Rotate by xyz degrees
void rotateRad(float x, float y, float z); // Rotate by xyz radians
void rotateXdeg(float x); // Rotate along the X axis
void rotateYdeg(float y); // Rotate along the Y axis
void rotateZdeg(float z); // Rotate along the Z axis
void rotateXrad(float x); // Rotate along the X axis
void rotateYrad(float y); // Rotate along the Y axis
void rotateZrad(float z); // Rotate along the Z axis
// Execute camera position, orientation
void calcMatrix(); // Recalculate dependant values
void execute(); // Set camera position, direction
const fVector4D &getDirection() // Get direction quaternion
const fMatrix4x4 &getRotMatrix() // Get rotation matrix
const fVector3D &getForward() // Get unit vector of forward motion
const fVector3D &getUpward() // Get unit vector of upward motion
const fVector3D &getSideways() // Get unit vector of upward motion
};