Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 11, 2015, 9:28:39 PM (10 years ago)
Author:
landauf
Message:

added customized visualization for cylinders and cones to BulletDebugDrawer.
improved DebugDrawer by making circle, cylinder, and sphere rotatable. added rendering function for cones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/tools/BulletDebugDrawer.cc

    r10190 r10191  
    5959    void BulletDebugDrawer::drawSphere(const btVector3& p, btScalar radius, const btVector3& color)
    6060    {
    61         this->drawer->drawSphere(vector3(p), radius, colour(color, 1.0f), true);
     61        this->drawer->drawSphere(vector3(p), Ogre::Quaternion::IDENTITY, radius, colour(color, 1.0f), true);
    6262    }
    6363
    6464    void BulletDebugDrawer::drawSphere(btScalar radius, const btTransform& transform, const btVector3& color)
    6565    {
    66         this->drawSphere(transform.getOrigin(), radius, color);
     66        Ogre::Matrix4 matrix = matrix4(transform);
     67        this->drawer->drawSphere(matrix.getTrans(), matrix.extractQuaternion(), radius, colour(color, 1.0f), true);
    6768    }
    6869
     
    9394        corners[7]  = Ogre::Vector3(trans * btVector3(bbMax[0], bbMin[1], bbMax[2]));
    9495        this->drawer->drawCuboid(corners, colour(color, 1.0f), true);
     96    }
     97
     98    void BulletDebugDrawer::drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color)
     99    {
     100        Ogre::Matrix4 matrix = matrix4(transform);
     101        this->drawer->drawCylinder(matrix.getTrans(), matrix.extractQuaternion(), radius, halfHeight * 2, colour(color, 1.0f), true);
     102    }
     103
     104    void BulletDebugDrawer::drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color)
     105    {
     106        Ogre::Matrix4 matrix = matrix4(transform);
     107        this->drawer->drawCone(matrix.getTrans(), matrix.extractQuaternion(), radius, height, colour(color, 1.0f), true);
    95108    }
    96109
Note: See TracChangeset for help on using the changeset viewer.