Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

OBJECT Class Reference

#include <object.h>

Inheritance diagram for OBJECT:

CAMERA LIGHT List of all members.

Public Methods

 OBJECT ()
 ~OBJECT ()
void Reset ()
void Rotate ()
void Draw ()
void UpdatePosition ()
void UpdatePosition (float x, float y, float z)
void MoveX ()
void MoveY ()
void MoveZ ()
void MoveX (float x)
void MoveY (float y)
void MoveZ (float z)
VECTOR GetXUnit ()
VECTOR GetYUnit ()
VECTOR GetZUnit ()

Public Attributes

QUAT Orientation
VECTOR Position
float Delta_x
float Delta_y
float Delta_z
float Movement_x
float Movement_y
float Movement_z
float Multiplier

Constructor & Destructor Documentation

OBJECT::OBJECT  
 

Definition at line 8 of file object.cpp.

References Delta_x, Delta_y, Delta_z, Movement_x, Movement_y, and Movement_z.

00009 {
00010     Delta_x = 0.0;
00011     Delta_y = 0.0;
00012     Delta_z = 0.0;
00013     Movement_x = 0.0;
00014     Movement_y = 0.0;
00015     Movement_z = 0.0;
00016 }

OBJECT::~OBJECT  
 

Definition at line 18 of file object.cpp.

00019 {
00020 }


Member Function Documentation

void OBJECT::Draw  
 

Definition at line 41 of file object.cpp.

00042 {
00043   // Should probably be a pure virtual 
00044 }

VECTOR OBJECT::GetXUnit  
 

Definition at line 208 of file object.cpp.

References QUAT::EulerToQuat(), QUAT::MultQuat(), Orientation, pi, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

00209 {
00210     float DirX;
00211     float DirY;
00212     float DirZ;
00213     float W;
00214     float X;
00215     float Y;
00216     float Z;
00217     QUAT TempQuat;
00218     QUAT TempQuat2;
00219     TempQuat = Orientation;
00220     TempQuat2.EulerToQuat(0.0, -90.0*(pi/180), 0.0);
00221     TempQuat.MultQuat(TempQuat2);
00222     W = TempQuat.w;
00223     X = TempQuat.x;
00224     Y = TempQuat.y;
00225     Z = TempQuat.z;
00226     DirX = 2.0 * ( X * Z - W * Y );
00227     DirY = 2.0 * ( Y * Z + W * X );
00228     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00229     VECTOR Unit;
00230     Unit.x += DirX * 1;
00231     Unit.y += DirY * 1;
00232     Unit.z += DirZ * 1;
00233     return Unit;
00234 }

VECTOR OBJECT::GetYUnit  
 

Definition at line 236 of file object.cpp.

References QUAT::EulerToQuat(), QUAT::MultQuat(), Orientation, pi, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

00237 {
00238     float DirX;
00239     float DirY;
00240     float DirZ;
00241     float W;
00242     float X;
00243     float Y;
00244     float Z;
00245     QUAT TempQuat;
00246     QUAT TempQuat2;
00247     TempQuat = Orientation;
00248     TempQuat2.EulerToQuat(90.0*(pi/180), 0.0, 0.0);
00249     TempQuat.MultQuat(TempQuat2);
00250     W = TempQuat.w;
00251     X = TempQuat.x;
00252     Y = TempQuat.y;
00253     Z = TempQuat.z;
00254     DirX = 2.0 * ( X * Z - W * Y );
00255     DirY = 2.0 * ( Y * Z + W * X );
00256     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00257     VECTOR Unit;
00258     Unit.x += DirX * 1;
00259     Unit.y += DirY * 1;
00260     Unit.z += DirZ * 1;
00261     return Unit;
00262 }

VECTOR OBJECT::GetZUnit  
 

Definition at line 264 of file object.cpp.

References Orientation, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

Referenced by LIGHT::Reset().

00265 {
00266     float DirX;
00267     float DirY;
00268     float DirZ;
00269     float W = Orientation.w;
00270     float X = Orientation.x;
00271     float Y = Orientation.y;
00272     float Z = Orientation.z;
00273     DirX = 2.0 * ( X * Z - W * Y );
00274     DirY = 2.0 * ( Y * Z + W * X );
00275     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00276     VECTOR Unit;
00277     Unit.x += DirX * 1;
00278     Unit.y += DirY * 1;
00279     Unit.z += DirZ * 1;
00280     return Unit;
00281 }

void OBJECT::MoveX float    x
 

Definition at line 139 of file object.cpp.

References QUAT::EulerToQuat(), QUAT::MultQuat(), Orientation, pi, Position, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

00140 {
00141     float DirX;
00142     float DirY;
00143     float DirZ;
00144     float W;
00145     float X;
00146     float Y;
00147     float Z;
00148     QUAT TempQuat;
00149     QUAT TempQuat2;
00150     TempQuat = Orientation;
00151     TempQuat2.EulerToQuat(0.0, -90.0*(pi/180), 0.0);
00152     TempQuat.MultQuat(TempQuat2);
00153     W = TempQuat.w;
00154     X = TempQuat.x;
00155     Y = TempQuat.y;
00156     Z = TempQuat.z;
00157     DirX = 2.0 * ( X * Z - W * Y );
00158     DirY = 2.0 * ( Y * Z + W * X );
00159     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00160     Position.x += DirX * x;
00161     Position.y += DirY * x;
00162     Position.z += DirZ * x;
00163 }

void OBJECT::MoveX  
 

Definition at line 70 of file object.cpp.

References QUAT::EulerToQuat(), Movement_x, Multiplier, QUAT::MultQuat(), Orientation, pi, Position, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

Referenced by UpdatePosition().

00071 {
00072     float DirX;
00073     float DirY;
00074     float DirZ;
00075     float W;
00076     float X;
00077     float Y;
00078     float Z;
00079     QUAT TempQuat;
00080     QUAT TempQuat2;
00081     TempQuat = Orientation;
00082     TempQuat2.EulerToQuat(0.0, -90.0*(pi/180), 0.0);
00083     TempQuat.MultQuat(TempQuat2);
00084     W = TempQuat.w;
00085     X = TempQuat.x;
00086     Y = TempQuat.y;
00087     Z = TempQuat.z;
00088     DirX = 2.0 * ( X * Z - W * Y );
00089     DirY = 2.0 * ( Y * Z + W * X );
00090     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00091     Position.x += DirX * Movement_x * Multiplier;
00092     Position.y += DirY * Movement_x * Multiplier;
00093     Position.z += DirZ * Movement_x * Multiplier;
00094 }

void OBJECT::MoveY float    y
 

Definition at line 165 of file object.cpp.

References QUAT::EulerToQuat(), QUAT::MultQuat(), Orientation, pi, Position, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

00166 {
00167     float DirX;
00168     float DirY;
00169     float DirZ;
00170     float W;
00171     float X;
00172     float Y;
00173     float Z;
00174     QUAT TempQuat;
00175     QUAT TempQuat2;
00176     TempQuat = Orientation;
00177     TempQuat2.EulerToQuat(90.0*(pi/180), 0.0, 0.0);
00178     TempQuat.MultQuat(TempQuat2);
00179     W = TempQuat.w;
00180     X = TempQuat.x;
00181     Y = TempQuat.y;
00182     Z = TempQuat.z;
00183     DirX = 2.0 * ( X * Z - W * Y );
00184     DirY = 2.0 * ( Y * Z + W * X );
00185     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00186     Position.x += DirX * y;
00187     Position.y += DirY * y;
00188     Position.z += DirZ * y;
00189 }

void OBJECT::MoveY  
 

Definition at line 96 of file object.cpp.

References QUAT::EulerToQuat(), Movement_y, Multiplier, QUAT::MultQuat(), Orientation, pi, Position, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

Referenced by UpdatePosition().

00097 {
00098     float DirX;
00099     float DirY;
00100     float DirZ;
00101     float W;
00102     float X;
00103     float Y;
00104     float Z;
00105     QUAT TempQuat;
00106     QUAT TempQuat2;
00107     TempQuat = Orientation;
00108     TempQuat2.EulerToQuat(90.0*(pi/180), 0.0, 0.0);
00109     TempQuat.MultQuat(TempQuat2);
00110     W = TempQuat.w;
00111     X = TempQuat.x;
00112     Y = TempQuat.y;
00113     Z = TempQuat.z;
00114     DirX = 2.0 * ( X * Z - W * Y );
00115     DirY = 2.0 * ( Y * Z + W * X );
00116     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00117     Position.x += DirX * Movement_y * Multiplier;
00118     Position.y += DirY * Movement_y * Multiplier;
00119     Position.z += DirZ * Movement_y * Multiplier;
00120 }

void OBJECT::MoveZ float    z
 

Definition at line 191 of file object.cpp.

References Orientation, Position, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

00192 {
00193     float DirX;
00194     float DirY;
00195     float DirZ;
00196     float W = Orientation.w;
00197     float X = Orientation.x;
00198     float Y = Orientation.y;
00199     float Z = Orientation.z;
00200     DirX = 2.0 * ( X * Z - W * Y );
00201     DirY = 2.0 * ( Y * Z + W * X );
00202     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00203     Position.x += DirX * z;
00204     Position.y += DirY * z;
00205     Position.z += DirZ * z;
00206 }

void OBJECT::MoveZ  
 

Definition at line 122 of file object.cpp.

References Movement_z, Multiplier, Orientation, Position, QUAT::w, VECTOR::x, QUAT::x, VECTOR::y, QUAT::y, VECTOR::z, and QUAT::z.

Referenced by UpdatePosition().

00123 {
00124     float DirX;
00125     float DirY;
00126     float DirZ;
00127     float W = Orientation.w;
00128     float X = Orientation.x;
00129     float Y = Orientation.y;
00130     float Z = Orientation.z;
00131     DirX = 2.0 * ( X * Z - W * Y );
00132     DirY = 2.0 * ( Y * Z + W * X );
00133     DirZ = 1.0 - 2.0 * ( X * X + Y * Y );
00134     Position.x += DirX * Movement_z * Multiplier;
00135     Position.y += DirY * Movement_z * Multiplier;
00136     Position.z += DirZ * Movement_z * Multiplier;
00137 }

void OBJECT::Reset  
 

Reimplemented in CAMERA, and LIGHT.

Definition at line 22 of file object.cpp.

References Delta_x, Delta_y, Delta_z, Movement_x, Movement_y, Movement_z, Orientation, Position, VECTOR::Reset(), and QUAT::Reset().

00023 {
00024     Orientation.Reset();
00025     Position.Reset();
00026         Delta_x = 0.0;
00027         Delta_y = 0.0;
00028         Delta_z = 0.0;
00029         Movement_x = 0.0;
00030         Movement_y = 0.0;
00031         Movement_z = 0.0;
00032 }

void OBJECT::Rotate  
 

Definition at line 34 of file object.cpp.

References Delta_x, Delta_y, Delta_z, QUAT::EulerToQuat(), Multiplier, QUAT::MultQuat(), Orientation, and radian.

Referenced by CAMERA::Update().

00035 {
00036     QUAT temp_quat;
00037     temp_quat.EulerToQuat(Delta_x * radian * Multiplier, Delta_y * radian * Multiplier, Delta_z * radian * Multiplier);
00038     Orientation.MultQuat(temp_quat);
00039 }

void OBJECT::UpdatePosition float    x,
float    y,
float    z
 

Definition at line 60 of file object.cpp.

References MoveX(), MoveY(), and MoveZ().

00061 {
00062     if (x != 0)
00063         MoveX(x);
00064     if (y != 0)
00065         MoveY(y);
00066     if (z != 0)
00067         MoveZ(z);
00068 }

void OBJECT::UpdatePosition  
 

Definition at line 46 of file object.cpp.

References Movement_x, Movement_y, Movement_z, MoveX(), MoveY(), and MoveZ().

Referenced by LIGHT::Apply(), and CAMERA::Update().

00047 {
00048     if (Movement_x != 0)
00049         MoveX();
00050     if (Movement_y != 0)
00051         MoveY();
00052     if (Movement_z != 0)
00053         MoveZ();
00054 
00055     Movement_x = 0.0;
00056     Movement_y = 0.0;
00057     Movement_z = 0.0;
00058 }


Member Data Documentation

float OBJECT::Delta_x
 

Definition at line 32 of file object.h.

Referenced by OBJECT(), Reset(), LIGHT::Reset(), CAMERA::Reset(), and Rotate().

float OBJECT::Delta_y
 

Definition at line 33 of file object.h.

Referenced by OBJECT(), Reset(), LIGHT::Reset(), CAMERA::Reset(), and Rotate().

float OBJECT::Delta_z
 

Definition at line 34 of file object.h.

Referenced by OBJECT(), Reset(), LIGHT::Reset(), CAMERA::Reset(), and Rotate().

float OBJECT::Movement_x
 

Definition at line 35 of file object.h.

Referenced by MoveX(), OBJECT(), Reset(), LIGHT::Reset(), and UpdatePosition().

float OBJECT::Movement_y
 

Definition at line 36 of file object.h.

Referenced by MoveY(), OBJECT(), Reset(), LIGHT::Reset(), and UpdatePosition().

float OBJECT::Movement_z
 

Definition at line 37 of file object.h.

Referenced by MoveZ(), OBJECT(), Reset(), LIGHT::Reset(), and UpdatePosition().

float OBJECT::Multiplier
 

Definition at line 38 of file object.h.

Referenced by MoveX(), MoveY(), MoveZ(), and Rotate().

QUAT OBJECT::Orientation
 

Definition at line 30 of file object.h.

Referenced by CAMERA::Apply(), GetXUnit(), GetYUnit(), GetZUnit(), MoveX(), MoveY(), MoveZ(), Reset(), LIGHT::Reset(), CAMERA::Reset(), and Rotate().

VECTOR OBJECT::Position
 

Definition at line 31 of file object.h.

Referenced by LIGHT::Apply(), CAMERA::Apply(), CheckClipPlanes(), DrawGLScene(), MoveX(), MoveY(), MoveZ(), Reset(), LIGHT::Reset(), and CAMERA::Reset().


The documentation for this class was generated from the following files:
Generated on Fri Dec 23 05:21:21 2005 for Skybox by doxygen1.2.15