AnimatLab  2
Test
VsPlane.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 #include "VsMovableItem.h"
9 #include "VsBody.h"
10 #include "VsJoint.h"
11 #include "VsMotorizedJoint.h"
12 #include "VsRigidBody.h"
13 #include "VsPlane.h"
14 #include "VsStructure.h"
15 #include "VsSimulator.h"
16 #include "VsOsgUserData.h"
17 #include "VsOsgUserDataVisitor.h"
18 #include "VsDragger.h"
19 
20 namespace VortexAnimatSim
21 {
22  namespace Environment
23  {
24  namespace Bodies
25  {
26 
34 {
35  SetThisPointers();
36  m_bCullBackfaces = true; //we want back face culling on by default for planes.
37 }
38 
46 {
47  try
48  {
49  DeleteGraphics();
50  DeletePhysics();
51  }
52  catch(...)
53  {Std_TraceMsg(0, "Caught Error in desctructor of VsPlane/\r\n", "", -1, false, true);}
54 }
55 
56 void VsPlane::CreateGraphicsGeometry()
57 {
58  m_osgGeometry = CreatePlaneGeometry(CornerX(), CornerY(), m_ptSize.x, m_ptSize.y, GridX(), GridY(), false);
59 }
60 
61 void VsPlane::CreatePhysicsGeometry()
62 {
63  if(IsCollisionObject())
64  m_vxGeometry = new VxPlane();
65 }
66 
68 {
69  CreateGeometry();
70 
71  //Create the geometry and osg drawable nodes.
72  m_eControlType = VxEntity::kControlNode; //This is not a dynamic part.
73 
74  VsRigidBody::CreateItem();
75  Plane::CreateParts();
76  VsRigidBody::SetBody();
77 }
78 
79 void VsPlane::ResizePhysicsGeometry()
80 {
81  if(m_vxGeometry)
82  m_vxGeometry = new VxPlane();
83 }
84 //Planes can never have fluid interactions/dynamics.
85 void VsPlane::Physics_FluidDataChanged()
86 {}
87 
88  } //Bodies
89  } // Environment
90 } //VortexAnimatSim
virtual bool IsCollisionObject()
Query if this object is collision object.
Definition: RigidBody.cpp:468
virtual float GridY()
Gets the length of a segment for the y dimension of the plane.
Definition: Plane.cpp:118
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
Definition: VsPlane.cpp:67
virtual float CornerX()
Gets the corner x coordinate.
Definition: Plane.cpp:78
virtual float GridX()
Gets the width of a segment for the x dimension of the plane.
Definition: Plane.cpp:104
Declares the vortex plane class.
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.
virtual float CornerY()
Gets the corner y coordinate.
Definition: Plane.cpp:90
Declares the vortex structure class.