AnimatLab  2
Test
BlLine.cpp
1 // BlLine.cpp: implementation of the BlLine class.
2 //
4 
5 #include "StdAfx.h"
6 #include "BlJoint.h"
7 #include "BlMotorizedJoint.h"
8 #include "BlRigidBody.h"
9 #include "BlLine.h"
10 #include "BlBox.h"
11 #include "BlSimulator.h"
12 
13 
14 namespace BulletAnimatSim
15 {
16  namespace Environment
17  {
18 
20 // Construction/Destruction
22 
23 BlLine::BlLine()
24 {
25 }
26 
27 BlLine::~BlLine()
28 {
29 
30 try
31 {
32 }
33 catch(...)
34 {Std_TraceMsg(0, "Caught Error in desctructor of BlLine\r\n", "", -1, false, true);}
35 }
36 
37 void BlLine::SetThisPointers()
38 {
39  BlRigidBody::SetThisPointers();
40  OsgLine::SetThisLinePointers();
41 }
42 
43 
44 void BlLine::SetupGraphics()
45 {
46  //Add it to the root scene graph because the vertices are in global coords.
47  GetBlSimulator()->OSGRoot()->addChild(m_osgNode.get());
48  SetVisible(m_lpThisMI->IsVisible());
49 }
50 
51 void BlLine::DeleteGraphics()
52 {
53  if(m_osgGeometry.valid())
54  {
55  m_osgGeometry->setDataVariance(osg::Object::STATIC);
56  m_osgGeometry->dirtyBound();
57  SetVisible(false);
58  }
59 
60  BlRigidBody::DeleteGraphics();
61 }
62 
63 void BlLine::CreateGraphicsGeometry()
64 {
65  fltA = 0;
66  m_osgGeometry = CreateLineGeometry();
67 }
68 
69 void BlLine::CreatePhysicsGeometry()
70 {
71  m_btCollisionShape = NULL;
72  m_btPart = NULL;
73  m_osgbMotion = NULL;
74 }
75 
76 void BlLine::CreateParts()
77 {
78  CreateGeometry();
79 
80  BlRigidBody::CreateItem();
81 }
82 
83 void BlLine::StepSimulation(float fltTension)
84 {
85  OsgLine::StepLineSimulation(m_lpThisBP->Enabled(), fltTension);
86 }
87 
88 void BlLine::ResetSimulation()
89 {
90  //We do nothing in the reset simulation because we need the attachment points to be reset before we can do anything.
91 }
92 
93 void BlLine::AfterResetSimulation()
94 {
95  DrawLine();
96 }
97 
98 
99  } // Visualization
100 } //BulletAnimatSim
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
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.