Add setUserIndex/getUserIndex (int index) to btCollisionShape

Share physics setup of BasicDemo between different graphics frameworks, see Demos\BasicDemo\BasicDemoPhysicsSetup.*
Plan is to do this for all Bullet demos.
Improve gwen performance and cursor navigation for tree control.
tweak shadowmap size
SimpleOpenGL3App::registerCubeShape accepts half extents
This commit is contained in:
erwin coumans
2014-05-20 12:02:01 -07:00
parent f213b00022
commit eb74688c18
23 changed files with 657 additions and 303 deletions

View File

@@ -16,9 +16,9 @@ subject to the following restrictions:
///todo: make this configurable in the gui
bool useShadowMap=true;
float shadowMapWidth=16384;
float shadowMapHeight=16384;
float shadowMapWorldSize=1000;
float shadowMapWidth=8192;
float shadowMapHeight=8192;
float shadowMapWorldSize=200;
float WHEEL_MULTIPLIER=0.01f;
float MOUSE_MOVE_MULTIPLIER = 0.4f;
#define MAX_POINTS_IN_BATCH 1024

View File

@@ -86,14 +86,14 @@ public:
{
float pos[4];
float orn[4];
pos[0] = position[0];
pos[1] = position[1];
pos[2] = position[2];
pos[3] = position[3];
orn[0] =orientation[0];
orn[1] =orientation[1];
orn[2] =orientation[2];
orn[3] =orientation[3];
pos[0] = (float)position[0];
pos[1] = (float)position[1];
pos[2] = (float)position[2];
pos[3] = (float)position[3];
orn[0] =(float)orientation[0];
orn[1] =(float)orientation[1];
orn[2] =(float)orientation[2];
orn[3] =(float)orientation[3];
writeSingleInstanceTransformToCPU(pos,orn,srcIndex);
}

View File

@@ -210,12 +210,35 @@ void SimpleOpenGL3App::drawText( const char* txt, int posX, int posY)
glDisable(GL_BLEND);
}
int SimpleOpenGL3App::registerCubeShape()
int SimpleOpenGL3App::registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ)
{
struct GfxVertex
{
float x,y,z,w;
float nx,ny,nz;
float u,v;
};
int strideInBytes = 9*sizeof(float);
int numVertices = sizeof(cube_vertices)/strideInBytes;
int numIndices = sizeof(cube_indices)/sizeof(int);
int shapeId = m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
b3AlignedObjectArray<GfxVertex> verts;
verts.resize(numVertices);
for (int i=0;i<numVertices;i++)
{
verts[i].x = halfExtentsX*cube_vertices[i*9];
verts[i].y = halfExtentsY*cube_vertices[i*9+1];
verts[i].z = halfExtentsZ*cube_vertices[i*9+2];
verts[i].w = cube_vertices[i*9+3];
verts[i].nx = cube_vertices[i*9+4];
verts[i].ny = cube_vertices[i*9+5];
verts[i].nz = cube_vertices[i*9+6];
verts[i].u = cube_vertices[i*9+7];
verts[i].v = cube_vertices[i*9+8];
}
int shapeId = m_instancingRenderer->registerShape(&verts[0].x,numVertices,cube_indices,numIndices);
return shapeId;
}

View File

@@ -16,7 +16,7 @@ struct SimpleOpenGL3App
SimpleOpenGL3App(const char* title, int width,int height);
virtual ~SimpleOpenGL3App();
int registerCubeShape();
int registerCubeShape(float halfExtentsX=1.f,float halfExtentsY=1.f, float halfExtentsZ = 1.f);
int registerGraphicsSphereShape(float radius, bool usePointSprites=true, int largeSphereThreshold=100, int mediumSphereThreshold=10);
void drawGrid(int gridSize=10, float yOffset=0.001);