Changeset 10193 for code/trunk/src/libraries/tools/BulletDebugDrawer.cc
- Timestamp:
- Jan 11, 2015, 10:06:04 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/tools/BulletDebugDrawer.cc
r10191 r10193 21 21 BulletDebugDrawer::BulletDebugDrawer(Ogre::SceneManager* sceneManager) 22 22 { 23 this->drawer = new DebugDrawer(sceneManager, 0.5f); 23 this->drawer_ = new DebugDrawer(sceneManager, 0.5f); 24 this->bFill_ = true; 24 25 25 26 mContactPoints = &mContactPoints1; 26 //mLines->estimateVertexCount(100000);27 //mLines->estimateIndexCount(0);28 27 29 28 static const char* matName = "OgreBulletCollisionsDebugDefault"; … … 44 43 { 45 44 Ogre::Root::getSingleton().removeFrameListener(this); 46 delete this->drawer ;45 delete this->drawer_; 47 46 } 48 47 49 48 void BulletDebugDrawer::drawLine(const btVector3& from, const btVector3& to, const btVector3& color) 50 49 { 51 this->drawer ->drawLine(vector3(from), vector3(to), colour(color, 1.0f));50 this->drawer_->drawLine(vector3(from), vector3(to), colour(color, 1.0f)); 52 51 } 53 52 … … 59 58 void BulletDebugDrawer::drawSphere(const btVector3& p, btScalar radius, const btVector3& color) 60 59 { 61 this->drawer ->drawSphere(vector3(p), Ogre::Quaternion::IDENTITY, radius, colour(color, 1.0f), true);60 this->drawer_->drawSphere(vector3(p), Ogre::Quaternion::IDENTITY, radius, colour(color, 1.0f), this->bFill_); 62 61 } 63 62 … … 65 64 { 66 65 Ogre::Matrix4 matrix = matrix4(transform); 67 this->drawer ->drawSphere(matrix.getTrans(), matrix.extractQuaternion(), radius, colour(color, 1.0f), true);66 this->drawer_->drawSphere(matrix.getTrans(), matrix.extractQuaternion(), radius, colour(color, 1.0f), this->bFill_); 68 67 } 69 68 … … 79 78 corners[6] = Ogre::Vector3(bbMin[0], bbMin[1], bbMax[2]); 80 79 corners[7] = Ogre::Vector3(bbMax[0], bbMin[1], bbMax[2]); 81 this->drawer ->drawCuboid(corners, colour(color, 1.0f), true);80 this->drawer_->drawCuboid(corners, colour(color, 1.0f), this->bFill_); 82 81 } 83 82 … … 93 92 corners[6] = Ogre::Vector3(trans * btVector3(bbMin[0], bbMin[1], bbMax[2])); 94 93 corners[7] = Ogre::Vector3(trans * btVector3(bbMax[0], bbMin[1], bbMax[2])); 95 this->drawer ->drawCuboid(corners, colour(color, 1.0f), true);94 this->drawer_->drawCuboid(corners, colour(color, 1.0f), this->bFill_); 96 95 } 97 96 … … 99 98 { 100 99 Ogre::Matrix4 matrix = matrix4(transform); 101 this->drawer ->drawCylinder(matrix.getTrans(), matrix.extractQuaternion(), radius, halfHeight * 2, colour(color, 1.0f), true);100 this->drawer_->drawCylinder(matrix.getTrans(), matrix.extractQuaternion(), radius, halfHeight * 2, colour(color, 1.0f), this->bFill_); 102 101 } 103 102 … … 105 104 { 106 105 Ogre::Matrix4 matrix = matrix4(transform); 107 this->drawer ->drawCone(matrix.getTrans(), matrix.extractQuaternion(), radius, height, colour(color, 1.0f), true);106 this->drawer_->drawCone(matrix.getTrans(), matrix.extractQuaternion(), radius, height, colour(color, 1.0f), this->bFill_); 108 107 } 109 108 … … 127 126 { 128 127 ContactPoint& cp = *i; 129 this->drawer ->drawLine(cp.from, cp.to, cp.color);128 this->drawer_->drawLine(cp.from, cp.to, cp.color); 130 129 if (now <= cp.dieTime) 131 130 newCP->push_back(cp); … … 135 134 136 135 // Right before the frame is rendered, call DebugDrawer::build(). 137 this->drawer ->build();136 this->drawer_->build(); 138 137 return true; 139 138 } … … 142 141 { 143 142 // After the frame is rendered, call DebugDrawer::clear() 144 this->drawer ->clear();143 this->drawer_->clear(); 145 144 return true; 146 145 } … … 166 165 return mDebugMode; 167 166 } 167 168 void BulletDebugDrawer::configure(bool bFill, float fillAlpha) 169 { 170 this->bFill_ = bFill; 171 this->drawer_->setFillAlpha(fillAlpha); 172 } 168 173 }
Note: See TracChangeset
for help on using the changeset viewer.