Body.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef BODY_HH
00028 #define BODY_HH
00029
00030 #include <ode/ode.h>
00031 #include "Vector.hh"
00032
00033 #include "GL/gl.h"
00034
00035
00036 class World;
00037 class Geom;
00038 class RenderOptions;
00039
00040
00043 class Body
00044 {
00046 public: Body( const World *world, const char *bodyName = NULL, bool dummy = false );
00047
00049 public: virtual ~Body();
00050
00051
00052 private: void AttachGeom( Geom *geom );
00053
00054
00055 private: void DetachGeom( Geom *geom );
00056
00057
00058 public: void UpdateCoM();
00059
00060
00061 public: int GetNumGeoms() {return this->geomCount;}
00062 public: Geom **GetGeoms() {return this->geoms;}
00063
00064
00065 public: void Enable(bool enable);
00066
00068 public: GzPose GetPose( void ) const;
00069
00071 public: GzVector GetPosition( void ) const;
00072
00074 public: GzQuatern GetRotation( void ) const;
00075
00077 public: void SetPose( GzPose pose );
00078
00080 public: void SetPosition( GzVector pos );
00081
00083 public: void SetRotation( GzQuatern rot );
00084
00085
00086 public: GzPose GetCoMPose( void ) const;
00087
00088
00089 public: GzVector GetLinearVel( void ) const;
00090
00091
00092 public: GzQuatern GetAngularVel( void ) const;
00093
00095 public: void SetLinearVel( GzVector vel );
00096
00098 public: void SetAngularVel( GzVector vel );
00099
00100
00101 public: dBodyID GetBodyId() const;
00102
00103
00104 public: dSpaceID GetSpaceId() const;
00105
00107 public: void SetGravityMode(bool enabled);
00108
00109 public: int GetGravityMode();
00110
00111
00112 public: void SetFiniteRotationAxis(double x,double y,double z);
00113 public: void SetFiniteRotationMode(int mode);
00114
00115
00116 public: void SetPickId( GLuint id );
00117
00118
00119 public: GzVector GetTorque(void);
00120
00122 public: GzVector GetForce(void);
00123
00125 public: void SetForce( GzVector f );
00126
00127 public: void SetTorque( double x, double y, double z);
00128
00129 public: void AddForce( double x, double y, double z);
00130 public: void AddTorque( double x, double y, double z);
00131 public: void AddRelForce( double x, double y, double z);
00132 public: void AddRelTorque( double x, double y, double z);
00133
00134 public: void AddForceAtPos( double x, double y, double z,
00135 double pos_x,double pos_y,double pos_z);
00136 public: void AddForceAtRelPos( double x, double y, double z,
00137 double pos_x,double pos_y,double pos_z);
00138
00139
00140 public: void Render( int pass, RenderOptions *renderOpt );
00141
00142
00143 private: void RenderAxes(RenderOptions *renderOpt);
00144
00145
00146 private: void DrawAxis(GzPose pose, double size, const char *text);
00147
00148
00149 public: char *bodyName;
00150
00151
00152 protected: dWorldID worldId;
00153
00154
00155 protected: dBodyID bodyId;
00156
00157
00158 private: GzPose comPose;
00159
00160
00161 protected: GzPose dummyPose;
00162
00163
00164 private: int geomCount, geomMaxCount;
00165 private: Geom **geoms;
00166
00167
00168 protected: dMass mass;
00169
00170
00171 friend class Geom;
00172 friend class BaseGeom;
00173 friend class Camera;
00174 };
00175
00176
00177
00178 #endif
00179
Last updated 12 September 2005 21:38:45
|