AnimatLab  2
Test
VsRigidBody.h
1 // VsRigidBody.h: interface for the VsRigidBody class.
2 //
4 
5 #if !defined(AFX_VSRIGIDBODY_H__BE00E72D_B205_450A_9A20_58752ED37EED__INCLUDED_)
6 #define AFX_VSRIGIDBODY_H__BE00E72D_B205_450A_9A20_58752ED37EED__INCLUDED_
7 
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif
11 
12 namespace VortexAnimatSim
13 {
14  namespace Environment
15  {
16 
55  class VORTEX_PORT VsRigidBody : public VsBody
56  {
57  protected:
58  //The physics part that this body is
59  VxCollisionSensor *m_vxSensor;
60  VxPart *m_vxPart;
61  VxGeometry *m_vxGeometry;
62  VxCollisionGeometry *m_vxCollisionGeometry;
63  VxNode m_vxGraphicNode;
64 
65  RigidBody *m_lpThisRB;
66 
67  //Keeps track of the bouyancy force applied to this rigid body at each time step.
68  //We need the report variable because it must be rescaled back for display.
69  //float m_fltBuoyancy;
70  //float m_fltReportBuoyancy;
71 
72  //We need these arrays to store body data that could potentially be charted.
73  //this may be scaled so we need to store it in here instead of just using the
74  //body data directly from the physics engine.
75  CStdFPoint m_vPos;
76  //float m_vPosition[3];
77  //float m_vRotation[3];
78  float m_vLinearVelocity[3];
79  float m_vAngularVelocity[3];
80  float m_vLinearAcceleration[3];
81  float m_vAngularAcceleration[3];
82  float m_vForce[3];
83  float m_vTorque[3];
84 
90 
93 
96  float m_fltBlank;
97 
98  virtual void SetThisPointers();
99 
100  virtual void ProcessContacts();
101 
102  virtual void DeletePhysics();
103  virtual void CreateSensorPart();
104  virtual void CreateStaticPart();
105  virtual void CreateDynamicPart();
106  virtual void RemoveStaticPart();
107 
108  CStdFPoint Physics_GetCurrentPosition();
109  virtual void GetBaseValues();
110  virtual void UpdatePositionAndRotationFromMatrix();
111  virtual void ResetStaticCollisionGeom();
112  virtual void ResetSensorCollisionGeom();
113  virtual void SetFollowEntity(VsRigidBody *lpEntity);
114 
115  virtual void ShowSelectedVertex();
116  virtual void HideSelectedVertex();
117 
118  virtual void CalculateEstimatedMassAndVolume() {};
119 
120  public:
121  VsRigidBody();
122  virtual ~VsRigidBody();
123 
124  Vx::VxCollisionSensor* Sensor();
125  Vx::VxPart* Part();
126  Vx::VxNode GraphicsNode();
127  Vx::VxCollisionGeometry *CollisionGeometry();
128  virtual void CollisionGeometry(Vx::VxCollisionGeometry *vxGeometry);
129 
130  virtual int GetPartIndex(VxPart *vxP0, VxPart *vxP1);
131 
132  virtual osg::Group *ParentOSG();
133  virtual void SetupPhysics();
134 
135  virtual void SetBody();
136 
137  virtual void Initialize();
138  virtual void BuildLocalMatrix();
139  virtual void Physics_ResetSimulation();
140  virtual void Physics_EnableCollision(RigidBody *lpBody);
141  virtual void Physics_DisableCollision(RigidBody *lpBody);
142  virtual void Physics_CollectData();
143  virtual void Physics_CollectExtraData();
144  virtual float *Physics_GetDataPointer(const std::string &strDataType);
145  virtual void Physics_UpdateMatrix();
146  virtual void Physics_SetFreeze(bool bVal);
147  virtual void Physics_SetDensity(float fltVal);
148  virtual void Physics_SetMass(float fltVal) {};
149  virtual void Physics_SetMaterialID(std::string strID);
150  virtual void Physics_SetVelocityDamping(float fltLinear, float fltAngular);
151  virtual void Physics_SetCenterOfMass(float fltTx, float fltTy, float fltTz);
152  virtual void Physics_SetColor();
153  virtual void Physics_TextureChanged();
154  virtual void Physics_UpdateNode();
155  virtual void Physics_Resize();
156  virtual void Physics_SelectedVertex(float fltXPos, float fltYPos, float fltZPos);
157  virtual void Physics_ResizeSelectedReceptiveFieldVertex();
158  virtual void Physics_FluidDataChanged();
159  virtual bool Physics_IsDefined();
160  virtual bool Physics_IsGeometryDefined();
161  virtual void Physics_WakeDynamics();
162 
163  virtual void Physics_AddBodyForceAtLocalPos(float fltPx, float fltPy, float fltPz, float fltFx, float fltFy, float fltFz, bool bScaleUnits);
164  virtual void Physics_AddBodyForceAtWorldPos(float fltPx, float fltPy, float fltPz, float fltFx, float fltFy, float fltFz, bool bScaleUnits);
165  virtual void Physics_AddBodyTorque(float fltTx, float fltTy, float fltTz, bool bScaleUnits);
166  virtual CStdFPoint Physics_GetVelocityAtPoint(float x, float y, float z);
167  virtual float Physics_GetMass();
168  virtual float Physics_GetDensity();
169  virtual bool Physics_HasCollisionGeometry();
170  };
171 
172  } // Environment
173 } //VortexAnimatSim
174 
175 #endif // !defined(AFX_VSRIGIDBODY_H__BE00E72D_B205_450A_9A20_58752ED37EED__INCLUDED_)
A common class for all rigid body data specific to vortex.
Definition: VsRigidBody.h:55
float m_fltEstimatedVolume
The estimated volume. See m_fltEstimatedMass desciption.
Definition: VsRigidBody.h:92
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
Vortex base body class.
Definition: VsBody.h:19