fix padding issue under Linux (where b3Vector3 is not 16-byte aligned)
w
This commit is contained in:
@@ -48,7 +48,7 @@ static void MyResizeCallback( float width, float height)
|
||||
|
||||
b3gWindowInterface* window=0;
|
||||
GwenUserInterface* gui = 0;
|
||||
bool gPause = false;
|
||||
bool gPause = true;
|
||||
bool gReset = false;
|
||||
|
||||
enum
|
||||
@@ -68,34 +68,34 @@ int selectedDemo = 0;
|
||||
GpuDemo::CreateFunc* allDemos[]=
|
||||
{
|
||||
// ConcaveCompound2Scene::MyCreateFunc,
|
||||
|
||||
GpuBoxPlaneScene::MyCreateFunc,
|
||||
GpuConvexScene::MyCreateFunc,
|
||||
GpuBoxPlaneScene::MyCreateFunc,
|
||||
GpuConvexPlaneScene::MyCreateFunc,
|
||||
|
||||
|
||||
ConcaveSphereScene::MyCreateFunc,
|
||||
|
||||
GpuCompoundScene::MyCreateFunc,
|
||||
|
||||
GpuConvexScene::MyCreateFunc,
|
||||
|
||||
|
||||
|
||||
ConcaveSphereScene::MyCreateFunc,
|
||||
|
||||
ConcaveScene::MyCreateFunc,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ConcaveCompoundScene::MyCreateFunc,
|
||||
|
||||
GpuCompoundPlaneScene::MyCreateFunc,
|
||||
|
||||
GpuSphereScene::MyCreateFunc,
|
||||
|
||||
|
||||
GpuSoftClothDemo::MyCreateFunc,
|
||||
|
||||
|
||||
Bullet2FileDemo::MyCreateFunc,
|
||||
|
||||
PairBench::MyCreateFunc,
|
||||
|
||||
PairBench::MyCreateFunc,
|
||||
|
||||
|
||||
//GpuRigidBodyDemo::MyCreateFunc,
|
||||
@@ -106,9 +106,9 @@ GpuDemo::CreateFunc* allDemos[]=
|
||||
|
||||
|
||||
//ParticleDemo::MyCreateFunc,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//GpuCompoundDemo::CreateFunc,
|
||||
//EmptyDemo::CreateFunc,
|
||||
};
|
||||
@@ -204,7 +204,7 @@ sth_stash* initFont(GLPrimitiveRenderer* primRender)
|
||||
|
||||
struct sth_stash* stash = 0;
|
||||
int datasize;
|
||||
|
||||
|
||||
float sx,sy,dx,dy,lh;
|
||||
GLuint texture;
|
||||
|
||||
@@ -392,7 +392,7 @@ extern bool useNewBatchingKernel;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
|
||||
b3Vector3 test(1,2,3);
|
||||
test.x = 1;
|
||||
test.y = 4;
|
||||
@@ -408,10 +408,10 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
args.GetCmdLineArgument("selected_demo",selectedDemo);
|
||||
|
||||
|
||||
|
||||
if (args.CheckCmdLineFlag("new_batching"))
|
||||
{
|
||||
useNewBatchingKernel = true;
|
||||
@@ -600,7 +600,7 @@ int main(int argc, char* argv[])
|
||||
ci.m_gui = gui;
|
||||
ci.m_instancingRenderer->init();
|
||||
ci.m_instancingRenderer->InitShaders();
|
||||
|
||||
|
||||
// render.init();
|
||||
|
||||
demo->initPhysics(ci);
|
||||
|
||||
@@ -28,8 +28,8 @@ void GpuConvexScene::setupScene(const ConstructionInfo& ci)
|
||||
index+=createDynamicsObjects(ci);
|
||||
|
||||
m_data->m_rigidBodyPipeline->writeAllInstancesToGpu();
|
||||
|
||||
|
||||
|
||||
|
||||
float camPos[4]={ci.arraySizeX,ci.arraySizeY/2,ci.arraySizeZ,0};
|
||||
//float camPos[4]={1,12.5,1.5,0};
|
||||
m_instancingRenderer->setCameraTargetPosition(camPos);
|
||||
@@ -44,10 +44,15 @@ void GpuConvexScene::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
int GpuConvexScene::createDynamicsObjects(const ConstructionInfo& ci)
|
||||
{
|
||||
int strideInBytes = 9*sizeof(float);
|
||||
/* int strideInBytes = 9*sizeof(float);
|
||||
int numVertices = sizeof(barrel_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(barrel_indices)/sizeof(int);
|
||||
return createDynamicsObjects2(ci,barrel_vertices,numVertices,barrel_indices,numIndices);
|
||||
*/
|
||||
int strideInBytes = 9*sizeof(float);
|
||||
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(cube_indices)/sizeof(int);
|
||||
return createDynamicsObjects2(ci,cube_vertices,numVertices,cube_indices,numIndices);
|
||||
}
|
||||
|
||||
int GpuBoxPlaneScene::createDynamicsObjects(const ConstructionInfo& ci)
|
||||
@@ -67,20 +72,20 @@ int GpuConvexScene::createDynamicsObjects2(const ConstructionInfo& ci, const flo
|
||||
int group=1;
|
||||
int mask=1;
|
||||
int index=0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
b3Vector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
b3Vector4(1,1,0,1),
|
||||
};
|
||||
|
||||
|
||||
int curColor = 0;
|
||||
float scaling[4] = {1,1,1,1};
|
||||
int prevBody = -1;
|
||||
@@ -100,17 +105,17 @@ int GpuConvexScene::createDynamicsObjects2(const ConstructionInfo& ci, const flo
|
||||
//mass=0.f;
|
||||
}
|
||||
//b3Vector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
|
||||
b3Vector3 position(i*2.2,10+j*2.2,k*2.2);
|
||||
|
||||
b3Vector3 position(i*2.2,10+j*1.9,k*2.2);
|
||||
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
b3Vector4 scaling(1,1,1,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
||||
|
||||
|
||||
|
||||
if (prevBody>=0)
|
||||
{
|
||||
@@ -137,19 +142,19 @@ void GpuConvexScene::createStaticEnvironment(const ConstructionInfo& ci)
|
||||
int group=1;
|
||||
int mask=1;
|
||||
int index=0;
|
||||
|
||||
|
||||
|
||||
{
|
||||
b3Vector4 scaling(400,1,400,1);
|
||||
int colIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
|
||||
b3Vector3 position(0,0,0);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
|
||||
b3Vector4 color(0,0,1,1);
|
||||
|
||||
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,9 +173,9 @@ void GpuConvexPlaneScene::createStaticEnvironment(const ConstructionInfo& ci)
|
||||
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(cube_indices)/sizeof(int);
|
||||
int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
||||
|
||||
|
||||
|
||||
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user