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 9 of file object.cpp.

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

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

OBJECT::~OBJECT  
 

Definition at line 19 of file object.cpp.

00020 {
00021 }


Member Function Documentation

void OBJECT::Draw  
 

Definition at line 42 of file object.cpp.

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

VECTOR OBJECT::GetXUnit  
 

Definition at line 209 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.

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

VECTOR OBJECT::GetYUnit  
 

Definition at line 237 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.

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

VECTOR OBJECT::GetZUnit  
 

Definition at line 265 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().

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

void OBJECT::MoveX float    x
 

Definition at line 140 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.

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

void OBJECT::MoveX  
 

Definition at line 71 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().

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

void OBJECT::MoveY float    y
 

Definition at line 166 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.

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

void OBJECT::MoveY  
 

Definition at line 97 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().

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

void OBJECT::MoveZ float    z
 

Definition at line 192 of file object.cpp.

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

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

void OBJECT::MoveZ  
 

Definition at line 123 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().

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

void OBJECT::Reset  
 

Reimplemented in CAMERA, and LIGHT.

Definition at line 23 of file object.cpp.

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

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

void OBJECT::Rotate  
 

Definition at line 35 of file object.cpp.

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

Referenced by CAMERA::Update().

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

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

Definition at line 61 of file object.cpp.

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

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

void OBJECT::UpdatePosition  
 

Definition at line 47 of file object.cpp.

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

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

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


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:20:21 2005 for Portals by doxygen1.2.15