Refactoring: another huge number of changes, renamed methods to start with lower-case.
This commit is contained in:
@@ -126,7 +126,7 @@ int BMF_DrawCharacter(BMF_Font* font, char c)
|
||||
int BMF_DrawString(BMF_Font* font, const char* str)
|
||||
{
|
||||
if (!font) return 0;
|
||||
((BMF_BitmapFont*)font)->DrawString(str);
|
||||
((BMF_BitmapFont*)font)->drawString(str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -141,22 +141,22 @@ int BMF_GetCharacterWidth(BMF_Font* font, char c)
|
||||
int BMF_GetStringWidth(BMF_Font* font, char* str)
|
||||
{
|
||||
if (!font) return 0;
|
||||
return ((BMF_BitmapFont*)font)->GetStringWidth(str);
|
||||
return ((BMF_BitmapFont*)font)->getStringWidth(str);
|
||||
}
|
||||
|
||||
|
||||
void BMF_GetBoundingBox(BMF_Font* font, int *xmin_r, int *ymin_r, int *xmax_r, int *ymax_r)
|
||||
{
|
||||
if (!font) return;
|
||||
((BMF_BitmapFont*)font)->GetBoundingBox(*xmin_r, *ymin_r, *xmax_r, *ymax_r);
|
||||
((BMF_BitmapFont*)font)->getBoundingBox(*xmin_r, *ymin_r, *xmax_r, *ymax_r);
|
||||
}
|
||||
|
||||
int BMF_GetFontTexture(BMF_Font* font) {
|
||||
if (!font) return -1;
|
||||
return ((BMF_BitmapFont*)font)->GetTexture();
|
||||
return ((BMF_BitmapFont*)font)->getTexture();
|
||||
}
|
||||
|
||||
void BMF_DrawStringTexture(BMF_Font* font, char *string, float x, float y, float z) {
|
||||
if (!font) return;
|
||||
((BMF_BitmapFont*)font)->DrawStringTexture(string, x, y, z);
|
||||
((BMF_BitmapFont*)font)->drawStringTexture(string, x, y, z);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void BMF_GetBoundingBox(BMF_Font* font, int *xmin_r, int *ymin_r, int *xmax_r, i
|
||||
/**
|
||||
* Convert the given @a font to a texture, and return the GL texture
|
||||
* ID of the texture. If the texture ID is bound, text can
|
||||
* be drawn using the texture by calling DrawStringTexture.
|
||||
* be drawn using the texture by calling drawStringTexture.
|
||||
*
|
||||
* @param font The font to create the texture from.
|
||||
* @return The GL texture ID of the new texture, or -1 if unable
|
||||
@@ -109,7 +109,7 @@ int BMF_GetFontTexture(BMF_Font* font);
|
||||
/**
|
||||
* Draw the given @a str at the point @a x, @a y, @a z, using
|
||||
* texture coordinates. This assumes that an appropriate texture
|
||||
* has been bound, see BMF_BitmapFont::GetTexture(). The string
|
||||
* has been bound, see BMF_BitmapFont::getTexture(). The string
|
||||
* is drawn along the positive X axis.
|
||||
*
|
||||
* @param font The font to draw with.
|
||||
|
||||
@@ -64,7 +64,7 @@ BMF_BitmapFont::~BMF_BitmapFont(void)
|
||||
}
|
||||
|
||||
|
||||
void BMF_BitmapFont::DrawString(const char* str)
|
||||
void BMF_BitmapFont::drawString(const char* str)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
@@ -93,7 +93,7 @@ void BMF_BitmapFont::DrawString(const char* str)
|
||||
}
|
||||
|
||||
|
||||
int BMF_BitmapFont::GetStringWidth(char* str)
|
||||
int BMF_BitmapFont::getStringWidth(char* str)
|
||||
{
|
||||
unsigned char c;
|
||||
int length = 0;
|
||||
@@ -105,7 +105,7 @@ int BMF_BitmapFont::GetStringWidth(char* str)
|
||||
return length;
|
||||
}
|
||||
|
||||
void BMF_BitmapFont::GetBoundingBox(int & xMin, int & yMin, int & xMax, int & yMax)
|
||||
void BMF_BitmapFont::getBoundingBox(int & xMin, int & yMin, int & xMax, int & yMax)
|
||||
{
|
||||
xMin = m_fontData->xmin;
|
||||
yMin = m_fontData->ymin;
|
||||
@@ -113,7 +113,7 @@ void BMF_BitmapFont::GetBoundingBox(int & xMin, int & yMin, int & xMax, int & yM
|
||||
yMax = m_fontData->ymax;
|
||||
}
|
||||
|
||||
int BMF_BitmapFont::GetTexture()
|
||||
int BMF_BitmapFont::getTexture()
|
||||
{
|
||||
int fWidth = m_fontData->xmax - m_fontData->xmin;
|
||||
int fHeight = m_fontData->ymax - m_fontData->ymin;
|
||||
@@ -174,7 +174,7 @@ int BMF_BitmapFont::GetTexture()
|
||||
return texId;
|
||||
}
|
||||
|
||||
void BMF_BitmapFont::DrawStringTexture(char *str, float x, float y, float z)
|
||||
void BMF_BitmapFont::drawStringTexture(char *str, float x, float y, float z)
|
||||
{
|
||||
unsigned char c;
|
||||
float pos = 0;
|
||||
|
||||
@@ -58,9 +58,9 @@ public:
|
||||
* Draws a string at the current raster position.
|
||||
* @param str The string to draw.
|
||||
*/
|
||||
void DrawString(const char* str);
|
||||
void drawString(const char* str);
|
||||
|
||||
void DrawStringMemory(char* str);
|
||||
void drawStringMemory(char* str);
|
||||
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
* @param str The string to draw.
|
||||
* @return The width of the string.
|
||||
*/
|
||||
int GetStringWidth(char* str);
|
||||
int getStringWidth(char* str);
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the font. The width and
|
||||
@@ -77,22 +77,22 @@ public:
|
||||
* box represent the extent of the font and its positioning
|
||||
* about the origin.
|
||||
*/
|
||||
void GetBoundingBox(int & xMin, int & yMin, int & xMax, int & yMax);
|
||||
void getBoundingBox(int & xMin, int & yMin, int & xMax, int & yMax);
|
||||
|
||||
/**
|
||||
* Convert the font to a texture, and return the GL texture
|
||||
* ID of the texture. If the texture ID is bound, text can
|
||||
* be drawn using the texture by calling DrawStringTexture.
|
||||
* be drawn using the texture by calling drawStringTexture.
|
||||
*
|
||||
* @return The GL texture ID of the new texture, or -1 if unable
|
||||
* to create.
|
||||
*/
|
||||
int GetTexture();
|
||||
int getTexture();
|
||||
|
||||
/**
|
||||
* Draw the given @a string at the point @a x, @a y, @a z, using
|
||||
* texture coordinates. This assumes that an appropriate texture
|
||||
* has been bound, see BMF_BitmapFont::GetTexture(). The string
|
||||
* has been bound, see BMF_BitmapFont::getTexture(). The string
|
||||
* is drawn along the positive X axis.
|
||||
*
|
||||
* @param string The c-string to draw.
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
* @param y The y coordinate to start drawing at.
|
||||
* @param z The z coordinate to start drawing at.
|
||||
*/
|
||||
void DrawStringTexture(char* string, float x, float y, float z);
|
||||
void drawStringTexture(char* string, float x, float y, float z);
|
||||
|
||||
protected:
|
||||
/** Pointer to the font data. */
|
||||
|
||||
@@ -46,7 +46,7 @@ struct btDebugCastResult : public btConvexCast::CastResult
|
||||
{
|
||||
}
|
||||
|
||||
virtual void DrawCoordSystem(const btTransform& tr)
|
||||
virtual void drawCoordSystem(const btTransform& tr)
|
||||
{
|
||||
float m[16];
|
||||
tr.getOpenGLMatrix(m);
|
||||
@@ -71,9 +71,9 @@ struct btDebugCastResult : public btConvexCast::CastResult
|
||||
|
||||
float m[16];
|
||||
btTransform hitTrans;
|
||||
btTransformUtil::IntegrateTransform(m_fromTrans,m_linVel,m_angVel,fraction,hitTrans);
|
||||
btTransformUtil::integrateTransform(m_fromTrans,m_linVel,m_angVel,fraction,hitTrans);
|
||||
hitTrans.getOpenGLMatrix(m);
|
||||
GL_ShapeDrawer::DrawOpenGL(m,m_shape,btVector3(1,0,0),btIDebugDraw::DBG_NoDebug);
|
||||
GL_ShapeDrawer::drawOpenGL(m,m_shape,btVector3(1,0,0),btIDebugDraw::DBG_NoDebug);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -397,8 +397,8 @@ void DemoApplication::shootBox(const btVector3& destination)
|
||||
startTransform.setOrigin(camPos);
|
||||
btCollisionShape* boxShape = new btBoxShape(btVector3(1.f,1.f,1.f));
|
||||
|
||||
btRigidBody* body = this->LocalCreateRigidBody(isDynamic, mass, startTransform,boxShape);
|
||||
m_dynamicsWorld->AddCollisionObject(body);
|
||||
btRigidBody* body = this->localCreateRigidBody(isDynamic, mass, startTransform,boxShape);
|
||||
m_dynamicsWorld->addCollisionObject(body);
|
||||
|
||||
btVector3 linVel(destination[0]-camPos[0],destination[1]-camPos[1],destination[2]-camPos[2]);
|
||||
linVel.normalize();
|
||||
@@ -420,7 +420,7 @@ void DemoApplication::shootBox(const btVector3& destination)
|
||||
startTransform.setOrigin(camPos);
|
||||
btCollisionShape* boxShape = new btBoxShape(btVector3(1.f,1.f,1.f));
|
||||
|
||||
CcdPhysicsController* newBox = LocalCreatePhysicsObject(isDynamic, mass, startTransform,boxShape);
|
||||
CcdPhysicsController* newBox = localCreatePhysicsObject(isDynamic, mass, startTransform,boxShape);
|
||||
|
||||
btVector3 linVel(destination[0]-camPos[0],destination[1]-camPos[1],destination[2]-camPos[2]);
|
||||
linVel.normalize();
|
||||
@@ -440,7 +440,7 @@ float gOldPickingDist = 0.f;
|
||||
btRigidBody* pickedBody = 0;//for deactivation state
|
||||
|
||||
|
||||
btVector3 DemoApplication::GetRayTo(int x,int y)
|
||||
btVector3 DemoApplication::getRayTo(int x,int y)
|
||||
{
|
||||
|
||||
float top = 1.f;
|
||||
@@ -482,7 +482,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
||||
//printf("button %i, state %i, x=%i,y=%i\n",button,state,x,y);
|
||||
//button 0, state 0 means left mouse down
|
||||
|
||||
btVector3 rayTo = GetRayTo(x,y);
|
||||
btVector3 rayTo = getRayTo(x,y);
|
||||
|
||||
switch (button)
|
||||
{
|
||||
@@ -508,7 +508,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
||||
float normal[3];
|
||||
|
||||
btCollisionWorld::ClosestRayResultCallback rayCallback(m_cameraPosition,rayTo);
|
||||
m_dynamicsWorld->RayTest(m_cameraPosition,rayTo,rayCallback);
|
||||
m_dynamicsWorld->rayTest(m_cameraPosition,rayTo,rayCallback);
|
||||
if (rayCallback.HasHit())
|
||||
{
|
||||
|
||||
@@ -539,7 +539,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
||||
if (hitObj)
|
||||
{
|
||||
CcdPhysicsController* physCtrl = static_cast<CcdPhysicsController*>(hitObj);
|
||||
btRigidBody* body = physCtrl->GetRigidBody();
|
||||
btRigidBody* body = physCtrl->getRigidBody();
|
||||
if (body)
|
||||
{
|
||||
body->SetActivationState(ACTIVE_TAG);
|
||||
@@ -576,7 +576,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
||||
float hit[3];
|
||||
float normal[3];
|
||||
btCollisionWorld::ClosestRayResultCallback rayCallback(m_cameraPosition,rayTo);
|
||||
m_dynamicsWorld->RayTest(m_cameraPosition,rayTo,rayCallback);
|
||||
m_dynamicsWorld->rayTest(m_cameraPosition,rayTo,rayCallback);
|
||||
if (rayCallback.HasHit())
|
||||
{
|
||||
|
||||
@@ -621,7 +621,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
||||
{
|
||||
|
||||
CcdPhysicsController* physCtrl = static_cast<CcdPhysicsController*>(hitObj);
|
||||
btRigidBody* body = physCtrl->GetRigidBody();
|
||||
btRigidBody* body = physCtrl->getRigidBody();
|
||||
|
||||
if (body && !body->IsStatic())
|
||||
{
|
||||
@@ -704,14 +704,14 @@ void DemoApplication::mouseMotionFunc(int x,int y)
|
||||
{
|
||||
//keep it at the same picking distance
|
||||
|
||||
btVector3 newRayTo = GetRayTo(x,y);
|
||||
btVector3 newRayTo = getRayTo(x,y);
|
||||
btVector3 eyePos(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2]);
|
||||
btVector3 dir = newRayTo-eyePos;
|
||||
dir.normalize();
|
||||
dir *= gOldPickingDist;
|
||||
|
||||
btVector3 newPos = eyePos + dir;
|
||||
p2p->SetPivotB(newPos);
|
||||
p2p->setPivotB(newPos);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -726,14 +726,14 @@ void DemoApplication::mouseMotionFunc(int x,int y)
|
||||
{
|
||||
//keep it at the same picking distance
|
||||
|
||||
btVector3 newRayTo = GetRayTo(x,y);
|
||||
btVector3 newRayTo = getRayTo(x,y);
|
||||
btVector3 eyePos(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2]);
|
||||
btVector3 dir = newRayTo-eyePos;
|
||||
dir.normalize();
|
||||
dir *= gOldPickingDist;
|
||||
|
||||
btVector3 newPos = eyePos + dir;
|
||||
p2p->SetPivotB(newPos);
|
||||
p2p->setPivotB(newPos);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -741,11 +741,11 @@ void DemoApplication::mouseMotionFunc(int x,int y)
|
||||
|
||||
|
||||
|
||||
btRigidBody* DemoApplication::LocalCreateRigidBody(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape)
|
||||
btRigidBody* DemoApplication::localCreateRigidBody(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape)
|
||||
{
|
||||
btVector3 localInertia(0,0,0);
|
||||
if (isDynamic)
|
||||
shape->CalculateLocalInertia(mass,localInertia);
|
||||
shape->calculateLocalInertia(mass,localInertia);
|
||||
|
||||
btMassProps massProps(0.f,localInertia);
|
||||
|
||||
@@ -765,7 +765,7 @@ btRigidBody* DemoApplication::LocalCreateRigidBody(bool isDynamic, float mass, c
|
||||
|
||||
|
||||
///Very basic import
|
||||
CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape)
|
||||
CcdPhysicsController* DemoApplication::localCreatePhysicsObject(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape)
|
||||
{
|
||||
|
||||
startTransforms[numObjects] = startTransform;
|
||||
@@ -779,7 +779,7 @@ CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic,
|
||||
int i = numObjects;
|
||||
{
|
||||
gShapePtr[i] = shape;
|
||||
gShapePtr[i]->SetMargin(0.05f);
|
||||
gShapePtr[i]->setMargin(0.05f);
|
||||
|
||||
btQuaternion orn = startTransform.getRotation();
|
||||
|
||||
@@ -806,7 +806,7 @@ CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic,
|
||||
|
||||
if (isDynamic)
|
||||
{
|
||||
gShapePtr[i]->CalculateLocalInertia(ccdObjectCi.m_mass,localInertia);
|
||||
gShapePtr[i]->calculateLocalInertia(ccdObjectCi.m_mass,localInertia);
|
||||
}
|
||||
|
||||
ccdObjectCi.m_localInertiaTensor = localInertia;
|
||||
@@ -816,10 +816,10 @@ CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic,
|
||||
physObjects[i]= new CcdPhysicsController( ccdObjectCi);
|
||||
|
||||
// Only do CCD if motion in one timestep (1.f/60.f) exceeds CUBE_HALF_EXTENTS
|
||||
physObjects[i]->GetRigidBody()->m_ccdSquareMotionTreshold = 0.f;
|
||||
physObjects[i]->getRigidBody()->m_ccdSquareMotionTreshold = 0.f;
|
||||
|
||||
//Experimental: better estimation of CCD Time of Impact:
|
||||
//physObjects[i]->GetRigidBody()->m_ccdSweptShereRadius = 0.5*CUBE_HALF_EXTENTS;
|
||||
//physObjects[i]->getRigidBody()->m_ccdSweptShereRadius = 0.5*CUBE_HALF_EXTENTS;
|
||||
|
||||
m_physicsEnvironmentPtr->addCcdPhysicsController( physObjects[i]);
|
||||
|
||||
@@ -837,11 +837,11 @@ void DemoApplication::renderme()
|
||||
|
||||
if (m_dynamicsWorld)
|
||||
{
|
||||
int numObjects = m_dynamicsWorld->GetNumCollisionObjects();
|
||||
int numObjects = m_dynamicsWorld->getNumCollisionObjects();
|
||||
btVector3 wireColor(1,0,0);
|
||||
for (int i=0;i<numObjects;i++)
|
||||
{
|
||||
btCollisionObject* colObj = m_dynamicsWorld->GetCollisionObjectArray()[i];
|
||||
btCollisionObject* colObj = m_dynamicsWorld->getCollisionObjectArray()[i];
|
||||
colObj->m_worldTransform.getOpenGLMatrix(m);
|
||||
|
||||
btVector3 wireColor(1.f,1.0f,0.5f); //wants deactivation
|
||||
@@ -871,7 +871,7 @@ void DemoApplication::renderme()
|
||||
}
|
||||
}
|
||||
|
||||
GL_ShapeDrawer::DrawOpenGL(m,colObj->m_collisionShape,wireColor,getDebugMode());
|
||||
GL_ShapeDrawer::drawOpenGL(m,colObj->m_collisionShape,wireColor,getDebugMode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -909,7 +909,7 @@ void DemoApplication::renderme()
|
||||
{
|
||||
|
||||
CcdPhysicsController* ctrl = m_physicsEnvironmentPtr->GetPhysicsController(i);
|
||||
btRigidBody* body = ctrl->GetRigidBody();
|
||||
btRigidBody* body = ctrl->getRigidBody();
|
||||
|
||||
body->m_worldTransform.getOpenGLMatrix( m );
|
||||
|
||||
@@ -919,7 +919,7 @@ void DemoApplication::renderme()
|
||||
wireColor = btVector3(0.f,0.0f,1.f);
|
||||
}
|
||||
///color differently for active, sleeping, wantsdeactivation states
|
||||
if (ctrl->GetRigidBody()->GetActivationState() == 1) //active
|
||||
if (ctrl->getRigidBody()->GetActivationState() == 1) //active
|
||||
{
|
||||
if (i & 1)
|
||||
{
|
||||
@@ -929,7 +929,7 @@ void DemoApplication::renderme()
|
||||
wireColor += btVector3 (.5f,0.f,0.f);
|
||||
}
|
||||
}
|
||||
if (ctrl->GetRigidBody()->GetActivationState() == 2) //ISLAND_SLEEPING
|
||||
if (ctrl->getRigidBody()->GetActivationState() == 2) //ISLAND_SLEEPING
|
||||
{
|
||||
if (i & 1)
|
||||
{
|
||||
@@ -941,8 +941,8 @@ void DemoApplication::renderme()
|
||||
}
|
||||
|
||||
char extraDebug[125];
|
||||
sprintf(extraDebug,"Island:%i, Body:%i",ctrl->GetRigidBody()->m_islandTag1,ctrl->GetRigidBody()->m_debugBodyId);
|
||||
ctrl->GetRigidBody()->GetCollisionShape()->SetExtraDebugInfo(extraDebug);
|
||||
sprintf(extraDebug,"Island:%i, Body:%i",ctrl->getRigidBody()->m_islandTag1,ctrl->getRigidBody()->m_debugBodyId);
|
||||
ctrl->getRigidBody()->getCollisionShape()->setExtraDebugInfo(extraDebug);
|
||||
|
||||
float vec[16];
|
||||
btTransform ident;
|
||||
@@ -950,7 +950,7 @@ void DemoApplication::renderme()
|
||||
ident.getOpenGLMatrix(vec);
|
||||
|
||||
|
||||
GL_ShapeDrawer::DrawOpenGL(m,ctrl->GetRigidBody()->GetCollisionShape(),wireColor,getDebugMode());
|
||||
GL_ShapeDrawer::drawOpenGL(m,ctrl->getRigidBody()->getCollisionShape(),wireColor,getDebugMode());
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ class DemoApplication
|
||||
m_debugMode = mode;
|
||||
}
|
||||
|
||||
CcdPhysicsEnvironment* GetPhysicsEnvironment()
|
||||
CcdPhysicsEnvironment* getPhysicsEnvironment()
|
||||
{
|
||||
return m_physicsEnvironmentPtr;
|
||||
}
|
||||
@@ -142,11 +142,11 @@ class DemoApplication
|
||||
///Demo functions
|
||||
void shootBox(const btVector3& destination);
|
||||
|
||||
btVector3 GetRayTo(int x,int y);
|
||||
btVector3 getRayTo(int x,int y);
|
||||
|
||||
CcdPhysicsController* LocalCreatePhysicsObject(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape);
|
||||
CcdPhysicsController* localCreatePhysicsObject(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape);
|
||||
|
||||
btRigidBody* LocalCreateRigidBody(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape);
|
||||
btRigidBody* localCreateRigidBody(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape);
|
||||
|
||||
///callback methods by glut
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ GLDebugDrawer::GLDebugDrawer()
|
||||
{
|
||||
|
||||
}
|
||||
void GLDebugDrawer::DrawLine(const btVector3& from,const btVector3& to,const btVector3& color)
|
||||
void GLDebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
|
||||
{
|
||||
if (m_debugMode > 0)
|
||||
{
|
||||
@@ -34,13 +34,13 @@ void GLDebugDrawer::DrawLine(const btVector3& from,const btVector3& to,const btV
|
||||
}
|
||||
}
|
||||
|
||||
void GLDebugDrawer::SetDebugMode(int debugMode)
|
||||
void GLDebugDrawer::setDebugMode(int debugMode)
|
||||
{
|
||||
m_debugMode = debugMode;
|
||||
|
||||
}
|
||||
|
||||
void GLDebugDrawer::DrawContactPoint(const btVector3& pointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color)
|
||||
void GLDebugDrawer::drawContactPoint(const btVector3& pointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color)
|
||||
{
|
||||
if (m_debugMode & btIDebugDraw::DBG_DrawContactPoints)
|
||||
{
|
||||
|
||||
@@ -13,13 +13,13 @@ public:
|
||||
|
||||
GLDebugDrawer();
|
||||
|
||||
virtual void DrawLine(const btVector3& from,const btVector3& to,const btVector3& color);
|
||||
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
|
||||
|
||||
virtual void DrawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color);
|
||||
virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color);
|
||||
|
||||
virtual void SetDebugMode(int debugMode);
|
||||
virtual void setDebugMode(int debugMode);
|
||||
|
||||
virtual int GetDebugMode() const { return m_debugMode;}
|
||||
virtual int getDebugMode() const { return m_debugMode;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ subject to the following restrictions:
|
||||
#include "BMF_Api.h"
|
||||
#include <stdio.h> //printf debugging
|
||||
|
||||
void GL_ShapeDrawer::DrawCoordSystem() {
|
||||
void GL_ShapeDrawer::drawCoordSystem() {
|
||||
glBegin(GL_LINES);
|
||||
glColor3f(1, 0, 0);
|
||||
glVertex3d(0, 0, 0);
|
||||
@@ -67,7 +67,7 @@ class GlDrawcallback : public btTriangleCallback
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void ProcessTriangle(btVector3* triangle,int partId, int triangleIndex)
|
||||
virtual void processTriangle(btVector3* triangle,int partId, int triangleIndex)
|
||||
{
|
||||
glBegin(GL_LINES);
|
||||
glColor3f(1, 0, 0);
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
class TriangleGlDrawcallback : public btInternalTriangleIndexCallback
|
||||
{
|
||||
public:
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
{
|
||||
glBegin(GL_TRIANGLES);//LINES);
|
||||
glColor3f(1, 0, 0);
|
||||
@@ -104,28 +104,28 @@ public:
|
||||
};
|
||||
|
||||
|
||||
void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const btVector3& color,int debugMode)
|
||||
void GL_ShapeDrawer::drawOpenGL(float* m, const btCollisionShape* shape, const btVector3& color,int debugMode)
|
||||
{
|
||||
|
||||
|
||||
glPushMatrix();
|
||||
glMultMatrixf(m);
|
||||
|
||||
if (shape->GetShapeType() == COMPOUND_SHAPE_PROXYTYPE)
|
||||
if (shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE)
|
||||
{
|
||||
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(shape);
|
||||
for (int i=compoundShape->GetNumChildShapes()-1;i>=0;i--)
|
||||
for (int i=compoundShape->getNumChildShapes()-1;i>=0;i--)
|
||||
{
|
||||
btTransform childTrans = compoundShape->GetChildTransform(i);
|
||||
const btCollisionShape* colShape = compoundShape->GetChildShape(i);
|
||||
btTransform childTrans = compoundShape->getChildTransform(i);
|
||||
const btCollisionShape* colShape = compoundShape->getChildShape(i);
|
||||
float childMat[16];
|
||||
childTrans.getOpenGLMatrix(childMat);
|
||||
DrawOpenGL(childMat,colShape,color,debugMode);
|
||||
drawOpenGL(childMat,colShape,color,debugMode);
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
//DrawCoordSystem();
|
||||
//drawCoordSystem();
|
||||
|
||||
//glPushMatrix();
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
@@ -137,12 +137,12 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
|
||||
if (!(debugMode & btIDebugDraw::DBG_DrawWireframe))
|
||||
{
|
||||
switch (shape->GetShapeType())
|
||||
switch (shape->getShapeType())
|
||||
{
|
||||
case BOX_SHAPE_PROXYTYPE:
|
||||
{
|
||||
const btBoxShape* boxShape = static_cast<const btBoxShape*>(shape);
|
||||
btVector3 halfExtent = boxShape->GetHalfExtents();
|
||||
btVector3 halfExtent = boxShape->getHalfExtents();
|
||||
glScaled(2*halfExtent[0], 2*halfExtent[1], 2*halfExtent[2]);
|
||||
glutSolidCube(1.0);
|
||||
useWireframeFallback = false;
|
||||
@@ -160,7 +160,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
case SPHERE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
const btSphereShape* sphereShape = static_cast<const btSphereShape*>(shape);
|
||||
float radius = sphereShape->GetMargin();//radius doesn't include the margin, so draw with margin
|
||||
float radius = sphereShape->getMargin();//radius doesn't include the margin, so draw with margin
|
||||
glutSolidSphere(radius,10,10);
|
||||
useWireframeFallback = false;
|
||||
break;
|
||||
@@ -169,8 +169,8 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
case CONE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
const btConeShape* coneShape = static_cast<const btConeShape*>(shape);
|
||||
float radius = coneShape->GetRadius();//+coneShape->GetMargin();
|
||||
float height = coneShape->GetHeight();//+coneShape->GetMargin();
|
||||
float radius = coneShape->getRadius();//+coneShape->getMargin();
|
||||
float height = coneShape->getHeight();//+coneShape->getMargin();
|
||||
//glRotatef(-90.0, 1.0, 0.0, 0.0);
|
||||
glTranslatef(0.0, 0.0, -0.5*height);
|
||||
glutSolidCone(radius,height,10,10);
|
||||
@@ -188,11 +188,11 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
case CYLINDER_SHAPE_PROXYTYPE:
|
||||
{
|
||||
const btCylinderShape* cylinder = static_cast<const btCylinderShape*>(shape);
|
||||
int upAxis = cylinder->GetUpAxis();
|
||||
int upAxis = cylinder->getUpAxis();
|
||||
|
||||
GLUquadricObj *quadObj = gluNewQuadric();
|
||||
float radius = cylinder->GetRadius();
|
||||
float halfHeight = cylinder->GetHalfExtents()[upAxis];
|
||||
float radius = cylinder->getRadius();
|
||||
float halfHeight = cylinder->getHalfExtents()[upAxis];
|
||||
|
||||
glPushMatrix();
|
||||
switch (upAxis)
|
||||
@@ -244,7 +244,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
if (useWireframeFallback)
|
||||
{
|
||||
/// for polyhedral shapes
|
||||
if (shape->IsPolyhedral())
|
||||
if (shape->isPolyhedral())
|
||||
{
|
||||
btPolyhedralConvexShape* polyshape = (btPolyhedralConvexShape*) shape;
|
||||
|
||||
@@ -253,10 +253,10 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
|
||||
|
||||
int i;
|
||||
for (i=0;i<polyshape->GetNumEdges();i++)
|
||||
for (i=0;i<polyshape->getNumEdges();i++)
|
||||
{
|
||||
btPoint3 a,b;
|
||||
polyshape->GetEdge(i,a,b);
|
||||
polyshape->getEdge(i,a,b);
|
||||
|
||||
glVertex3f(a.getX(),a.getY(),a.getZ());
|
||||
glVertex3f(b.getX(),b.getY(),b.getZ());
|
||||
@@ -269,24 +269,24 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
if (debugMode==btIDebugDraw::DBG_DrawFeaturesText)
|
||||
{
|
||||
glRasterPos3f(0.0, 0.0, 0.0);
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),polyshape->GetExtraDebugInfo());
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),polyshape->getExtraDebugInfo());
|
||||
|
||||
glColor3f(1.f, 1.f, 1.f);
|
||||
for (i=0;i<polyshape->GetNumVertices();i++)
|
||||
for (i=0;i<polyshape->getNumVertices();i++)
|
||||
{
|
||||
btPoint3 vtx;
|
||||
polyshape->GetVertex(i,vtx);
|
||||
polyshape->getVertex(i,vtx);
|
||||
glRasterPos3f(vtx.x(), vtx.y(), vtx.z());
|
||||
char buf[12];
|
||||
sprintf(buf," %d",i);
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
|
||||
}
|
||||
|
||||
for (i=0;i<polyshape->GetNumPlanes();i++)
|
||||
for (i=0;i<polyshape->getNumPlanes();i++)
|
||||
{
|
||||
btVector3 normal;
|
||||
btPoint3 vtx;
|
||||
polyshape->GetPlane(normal,vtx,i);
|
||||
polyshape->getPlane(normal,vtx,i);
|
||||
btScalar d = vtx.dot(normal);
|
||||
|
||||
glRasterPos3f(normal.x()*d, normal.y()*d, normal.z()*d);
|
||||
@@ -301,7 +301,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
}
|
||||
}
|
||||
|
||||
if (shape->GetShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
{
|
||||
btTriangleMeshShape* concaveMesh = (btTriangleMeshShape*) shape;
|
||||
//btVector3 aabbMax(1e30f,1e30f,1e30f);
|
||||
@@ -313,12 +313,12 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
|
||||
GlDrawcallback drawCallback;
|
||||
|
||||
concaveMesh->ProcessAllTriangles(&drawCallback,aabbMin,aabbMax);
|
||||
concaveMesh->processAllTriangles(&drawCallback,aabbMin,aabbMax);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (shape->GetShapeType() == CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE)
|
||||
if (shape->getShapeType() == CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE)
|
||||
{
|
||||
btConvexTriangleMeshShape* convexMesh = (btConvexTriangleMeshShape*) shape;
|
||||
|
||||
@@ -326,7 +326,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
btVector3 aabbMax(1e30f,1e30f,1e30f);
|
||||
btVector3 aabbMin(-1e30f,-1e30f,-1e30f);
|
||||
TriangleGlDrawcallback drawCallback;
|
||||
convexMesh->GetStridingMesh()->InternalProcessAllTriangles(&drawCallback,aabbMin,aabbMax);
|
||||
convexMesh->getStridingMesh()->InternalProcessAllTriangles(&drawCallback,aabbMin,aabbMax);
|
||||
|
||||
}
|
||||
|
||||
@@ -335,12 +335,12 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const b
|
||||
glRasterPos3f(0,0,0);//mvtx.x(), vtx.y(), vtx.z());
|
||||
if (debugMode&btIDebugDraw::DBG_DrawText)
|
||||
{
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->GetName());
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->getName());
|
||||
}
|
||||
|
||||
if (debugMode& btIDebugDraw::DBG_DrawFeaturesText)
|
||||
{
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->GetExtraDebugInfo());
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->getExtraDebugInfo());
|
||||
}
|
||||
glEnable(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ class GL_ShapeDrawer
|
||||
{
|
||||
public:
|
||||
|
||||
static void DrawOpenGL(float* m, const btCollisionShape* shape, const btVector3& color,int debugMode);
|
||||
static void DrawCoordSystem();
|
||||
static void drawOpenGL(float* m, const btCollisionShape* shape, const btVector3& color,int debugMode);
|
||||
static void drawCoordSystem();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -34,16 +34,16 @@ GL_Simplex1to4::GL_Simplex1to4()
|
||||
}
|
||||
|
||||
///
|
||||
/// Debugging method CalcClosest calculates the closest point to the origin, using m_simplexSolver
|
||||
/// Debugging method calcClosest calculates the closest point to the origin, using m_simplexSolver
|
||||
///
|
||||
void GL_Simplex1to4::CalcClosest(float* m)
|
||||
void GL_Simplex1to4::calcClosest(float* m)
|
||||
{
|
||||
btTransform tr;
|
||||
tr.setFromOpenGLMatrix(m);
|
||||
|
||||
|
||||
|
||||
GL_ShapeDrawer::DrawCoordSystem();
|
||||
GL_ShapeDrawer::drawCoordSystem();
|
||||
|
||||
if (m_simplexSolver)
|
||||
{
|
||||
|
||||
@@ -29,9 +29,9 @@ class GL_Simplex1to4 : public btBU_Simplex1to4
|
||||
|
||||
GL_Simplex1to4();
|
||||
|
||||
void CalcClosest(float* m);
|
||||
void calcClosest(float* m);
|
||||
|
||||
void SetSimplexSolver(btSimplexSolverInterface* simplexSolver) {
|
||||
void setSimplexSolver(btSimplexSolverInterface* simplexSolver) {
|
||||
m_simplexSolver = simplexSolver;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "RenderTexture.h"
|
||||
#include "renderTexture.h"
|
||||
#include <memory.h>
|
||||
#include "BMF_FontData.h"
|
||||
|
||||
RenderTexture::RenderTexture(int width,int height)
|
||||
renderTexture::renderTexture(int width,int height)
|
||||
:m_height(height),m_width(width)
|
||||
{
|
||||
m_buffer = new unsigned char[m_width*m_height*4];
|
||||
@@ -30,14 +30,14 @@ RenderTexture::RenderTexture(int width,int height)
|
||||
{
|
||||
for (int y=0;y<m_height;y++)
|
||||
{
|
||||
SetPixel(x,y,btVector4(float(x),float(y),0.f,1.f));
|
||||
setPixel(x,y,btVector4(float(x),float(y),0.f,1.f));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RenderTexture::Printf(char* str, BMF_FontData* fontData, int startx,int starty)
|
||||
void renderTexture::grapicalPrintf(char* str, BMF_FontData* fontData, int startx,int starty)
|
||||
{
|
||||
unsigned char c;
|
||||
int rasterposx = startx;
|
||||
@@ -55,7 +55,7 @@ void RenderTexture::Printf(char* str, BMF_FontData* fontData, int startx,int sta
|
||||
char packedColor = bitmap[y];
|
||||
float colorf = packedColor & bit ? 1.f : 0.f;
|
||||
btVector4 rgba(colorf,colorf,colorf,1.f);
|
||||
SetPixel(rasterposx+x,rasterposy+8-y-1,rgba);
|
||||
setPixel(rasterposx+x,rasterposy+8-y-1,rgba);
|
||||
bit >>=1;
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ void RenderTexture::Printf(char* str, BMF_FontData* fontData, int startx,int sta
|
||||
}
|
||||
}
|
||||
|
||||
RenderTexture::~RenderTexture()
|
||||
renderTexture::~renderTexture()
|
||||
{
|
||||
delete [] m_buffer;
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ subject to the following restrictions:
|
||||
#include "BMF_FontData.h"
|
||||
|
||||
///
|
||||
///RenderTexture provides a software-render context (setpixel/printf)
|
||||
///renderTexture provides a software-render context (setpixel/printf)
|
||||
///
|
||||
class RenderTexture
|
||||
class renderTexture
|
||||
{
|
||||
int m_height;
|
||||
int m_width;
|
||||
@@ -30,10 +30,10 @@ class RenderTexture
|
||||
|
||||
public:
|
||||
|
||||
RenderTexture(int width,int height);
|
||||
~RenderTexture();
|
||||
renderTexture(int width,int height);
|
||||
~renderTexture();
|
||||
|
||||
inline void SetPixel(int x,int y,const btVector4& rgba)
|
||||
inline void setPixel(int x,int y,const btVector4& rgba)
|
||||
{
|
||||
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
|
||||
|
||||
@@ -43,10 +43,10 @@ public:
|
||||
pixel[3] = (unsigned char)(255*rgba.getW());
|
||||
}
|
||||
|
||||
const unsigned char* GetBuffer() const { return m_buffer;}
|
||||
int GetWidth() const { return m_width;}
|
||||
int GetHeight() const { return m_height;}
|
||||
void Printf(char* str, BMF_FontData* fontData, int startx = 0,int starty=0);
|
||||
const unsigned char* getBuffer() const { return m_buffer;}
|
||||
int getWidth() const { return m_width;}
|
||||
int getHeight() const { return m_height;}
|
||||
void grapicalPrintf(char* str, BMF_FontData* fontData, int startx = 0,int starty=0);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user