AnimatLab  2
Test
BlTorus.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 #include "BlJoint.h"
9 #include "BlRigidBody.h"
10 #include "BlTorus.h"
11 #include "BlSimulator.h"
12 
13 namespace BulletAnimatSim
14 {
15  namespace Environment
16  {
17  namespace Bodies
18  {
19 
27 {
28  SetThisPointers();
29 }
30 
31 BlTorus::~BlTorus()
32 {
33  try
34  {
35  DeleteGraphics();
36  DeletePhysics(false);
37  }
38  catch(...)
39  {Std_TraceMsg(0, "Caught Error in desctructor of BlTorus/\r\n", "", -1, false, true);}
40 }
41 
42 void BlTorus::CreateGraphicsGeometry()
43 {
44  m_osgGeometry = CreateTorusGeometry(m_fltInsideRadius, m_fltOutsideRadius, m_iSides, m_iRings);
45 }
46 
47 void BlTorus::CreatePhysicsGeometry()
48 {
49  if(IsCollisionObject())
50  {
51  DeleteCollisionGeometry();
52 
54  //FIX PHYSICS Calculate area here
55  m_btCollisionShape = osgbCollision::btTriMeshCollisionShapeFromOSG(m_osgNode.get());
56  //m_bDisplayDebugCollisionGraphic = true;
57  }
58 }
59 
61 {
62  CreateGeometry();
63 
64  BlRigidBody::CreateItem();
65  Torus::CreateParts();
66 }
67 
69 {
72 
73  Torus::CreateJoints();
74  BlRigidBody::Initialize();
75 }
76 
77  } //Bodies
78  } // Environment
79 } //BulletAnimatSim
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
Definition: BlTorus.cpp:60
virtual bool IsCollisionObject()
Query if this object is collision object.
Definition: RigidBody.cpp:468
float m_fltInsideRadius
The inside radius of the torus.
Definition: Torus.h:31
int m_iRings
The number of rings used to draw the torus.
Definition: Torus.h:37
float m_fltVolume
The volume for the rigid body.
Definition: RigidBody.h:91
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
virtual void CreateJoint()
Creates the joint.
Definition: Joint.cpp:602
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
float m_fltOutsideRadius
The outside radius of the torus.
Definition: Torus.h:28
Declares the vortex Torus class.
int m_iSides
The number of sides used to draw the torus.
Definition: Torus.h:34
virtual void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
Definition: BlTorus.cpp:68