41 #include "LinearMath/btQuickprof.h"
44 #include "tgGLDebugDrawer.h"
46 #include "BulletSoftBody/btSoftRigidDynamicsWorld.h"
58 BT_PROFILE(
"tgBulletRenderer::renderRod");
59 #endif //BT_NO_PROFILE
66 BT_PROFILE(
"tgBulletRenderer::renderString");
67 #endif //BT_NO_PROFILE
69 btDynamicsWorld& dynamicsWorld =
72 btIDebugDraw*
const pDrawer = dynamicsWorld.getDebugDrawer();
76 if(pDrawer && pSpringCable)
78 const std::vector<const tgSpringCableAnchor*>& anchors = pSpringCable->
getAnchors();
79 std::size_t n = anchors.size() - 1;
80 for (std::size_t i = 0; i < n; i++)
82 const btVector3 lineFrom =
83 anchors[i]->getWorldPosition();
84 const btVector3 lineTo =
85 anchors[i+1]->getWorldPosition();
87 const double stretch =
89 const btVector3 color =
91 btVector3(0.0, 0.0, 1.0) :
92 btVector3(0.5 + stretch / 3.0,
95 pDrawer->drawLine(lineFrom, lineTo, color);
106 #ifndef BT_NO_PROFILE
107 BT_PROFILE(
"tgBulletRenderer::renderCompressionSpring");
108 #endif //BT_NO_PROFILE
112 btIDebugDraw*
const pDrawer = dynamicsWorld.getDebugDrawer();
117 if(pDrawer && pCompressionSpring)
119 const std::vector<const tgSpringCableAnchor*>& anchors =
123 std::size_t n = anchors.size() - 1;
124 for (std::size_t i = 0; i < n; i++)
129 const btVector3 springStartLoc =
130 anchors[i]->getWorldPosition();
134 const btVector3 springEndLoc =
158 btVector3(1.0, 0.0, 0.0) :
159 btVector3(0.0, 1.0, 0.0);
170 btVector3(0.0, 0.0, 1.0) :
171 btVector3(0.0, 1.0, 0.0);
174 pDrawer->drawLine(springStartLoc, springEndLoc, color);
181 #ifndef BT_NO_PROFILE
182 BT_PROFILE(
"tgBulletRenderer::renderModel");
183 #endif //BT_NO_PROFILE
190 btIDebugDraw*
const idraw = dynamicsWorld.getDebugDrawer();
191 for(
int j=0;j<model.getMarkers().size() ;j++)
Contains the definition of class tgCompressionSpringActuator. This class assumes a linear spring...
Definitions of class tgSpringCable.
Contains the definition of class tgWorldBulletPhysicsImpl.
virtual const double getSpringForce() const
static btDynamicsWorld & worldToDynamicsWorld(const tgWorld &world)
virtual const bool isFreeEndAttached() const
virtual void render(const tgSpringCableActuator &mSCA) const
Utility class for class casting and filtering collections by type.
Markers for specific places on a tensegrity.
Contains the definition of abstract base class tgSpringCableActuator. Assumes that the string is line...
tgBulletRenderer(const tgWorld &world)
virtual const btVector3 getSpringEndpoint() const
Contains the definition of class tgWorld $Id$.
Contains the definition of class tgBulletUtil.
Definitions of class tgBulletCompressionSpring.
virtual const std::vector< const tgSpringCableAnchor * > getAnchors() const =0
virtual const double getRestLength() const
Definitions of class tgSpringCableAnchor.
virtual const std::vector< const tgSpringCableAnchor * > getAnchors() const
virtual const double getCurrentLength() const
virtual const tgBulletCompressionSpring * getCompressionSpring() const
Contains the definition of concrete class tgBulletRenderer.
btVector3 getWorldPosition() const
const tgSpringCable * getSpringCable() const