added non-uniform scaling to btMultiSphereShape
added ray-aabb check modified Raycast demo to be more useful for debugging collision shapes
This commit is contained in:
@@ -61,3 +61,36 @@ void GLDebugDrawer::drawContactPoint(const btVector3& pointOnB,const btVector3&
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GLDebugDrawer::drawAabb(const btVector3& from,const btVector3& to,const btVector3& color)
|
||||
{
|
||||
|
||||
btVector3 halfExtents = (to-from)* 0.5f;
|
||||
btVector3 center = (to+from) *0.5f;
|
||||
int i,j;
|
||||
|
||||
btVector3 edgecoord(1.f,1.f,1.f),pa,pb;
|
||||
for (i=0;i<4;i++)
|
||||
{
|
||||
for (j=0;j<3;j++)
|
||||
{
|
||||
pa = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1],
|
||||
edgecoord[2]*halfExtents[2]);
|
||||
pa+=center;
|
||||
|
||||
int othercoord = j%3;
|
||||
edgecoord[othercoord]*=-1.f;
|
||||
pb = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1],
|
||||
edgecoord[2]*halfExtents[2]);
|
||||
pb+=center;
|
||||
|
||||
drawLine(pa,pb,color);
|
||||
}
|
||||
edgecoord = btVector3(-1.f,-1.f,-1.f);
|
||||
if (i<3)
|
||||
edgecoord[i]*=-1.f;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,6 +13,8 @@ public:
|
||||
|
||||
GLDebugDrawer();
|
||||
|
||||
void drawAabb(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);
|
||||
|
||||
@@ -53,7 +53,7 @@ void renderTexture::grapicalPrintf(char* str, BMF_FontData* fontData, int startx
|
||||
for (int x=0;x<cd.width;x++)
|
||||
{
|
||||
char packedColor = bitmap[y];
|
||||
float colorf = packedColor & bit ? 1.f : 0.f;
|
||||
float colorf = packedColor & bit ? 0.f : 1.f;
|
||||
btVector4 rgba(colorf,colorf,colorf,1.f);
|
||||
setPixel(rasterposx+x,rasterposy+8-y-1,rgba);
|
||||
bit >>=1;
|
||||
|
||||
@@ -43,6 +43,15 @@ public:
|
||||
pixel[3] = (unsigned char)(255*rgba.getW());
|
||||
}
|
||||
|
||||
inline btVector4 getPixel(int x,int y)
|
||||
{
|
||||
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
|
||||
return btVector4(pixel[0]*1.f/255.f,
|
||||
pixel[1]*1.f/255.f,
|
||||
pixel[2]*1.f/255.f,
|
||||
pixel[3]*1.f/255.f);
|
||||
}
|
||||
|
||||
const unsigned char* getBuffer() const { return m_buffer;}
|
||||
int getWidth() const { return m_width;}
|
||||
int getHeight() const { return m_height;}
|
||||
|
||||
Reference in New Issue
Block a user