diff --git a/Demos3/GpuDemos/main_opengl3core.cpp b/Demos3/GpuDemos/main_opengl3core.cpp index 65391ecfb..34a2c63fa 100644 --- a/Demos3/GpuDemos/main_opengl3core.cpp +++ b/Demos3/GpuDemos/main_opengl3core.cpp @@ -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); diff --git a/Demos3/GpuDemos/rigidbody/GpuConvexScene.cpp b/Demos3/GpuDemos/rigidbody/GpuConvexScene.cpp index 0f06ea3e1..628175ac0 100644 --- a/Demos3/GpuDemos/rigidbody/GpuConvexScene.cpp +++ b/Demos3/GpuDemos/rigidbody/GpuConvexScene.cpp @@ -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); -} \ No newline at end of file +} diff --git a/build/findOpenGLGlewGlut.lua b/build/findOpenGLGlewGlut.lua index 9afe778b6..dd72ae923 100644 --- a/build/findOpenGLGlewGlut.lua +++ b/build/findOpenGLGlewGlut.lua @@ -42,13 +42,7 @@ files { projectRootDir .. "btgui/OpenGLWindow/GlewWindows/glew.c"} end if os.is("Linux") then - --links{"GLEW"} - defines { "GLEW_STATIC"} - includedirs { - projectRootDir .. "btgui/OpenGLWindow/GlewWindows" - } - files { projectRootDir .. "btgui/OpenGLWindow/GlewWindows/glew.c"} - + links{"GLEW"} end configuration{} end diff --git a/build/stringifyKernel.lua b/build/stringifyKernel.lua index dea0a73fe..fc78bdeee 100644 --- a/build/stringifyKernel.lua +++ b/build/stringifyKernel.lua @@ -24,6 +24,7 @@ function stringifyKernel(filenameIn, filenameOut, kernelMethod) end oneline = string.sub(lines,startpos,endpos) oneline = string.gsub(oneline,"\n","") + oneline = string.gsub(oneline,"\"","\\\""); oneline = '\"' .. oneline .. '\\n\"' oneline = string.gsub(oneline,"\\\\n","") oneline = oneline .. "\n" @@ -75,4 +76,4 @@ function stringifyKernel(filenameIn, filenameOut, kernelMethod) stringifyKernel( _OPTIONS["kernelfile"] , _OPTIONS["headerfile"], _OPTIONS["stringname"]) end -} \ No newline at end of file +} diff --git a/build/stringify_linux.sh b/build/stringify_linux.sh new file mode 100755 index 000000000..e4ff43bd6 --- /dev/null +++ b/build/stringify_linux.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/RadixSort32Kernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/RadixSort32KernelsCL.h" --stringname="radixSort32KernelsCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernelsCL.h" --stringname="boundSearchKernelsCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanKernelsCL.h" --stringname="prefixScanKernelsCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/FillKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/FillKernelsCL.h" --stringname="fillKernelsCL" stringify + +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sap.cl" --headerfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapKernels.h" --stringname="sapCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapFast.cl" --headerfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapFastKernels.h" --stringname="sapFastCL" stringify + +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/sat.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satKernels.h" --stringname="satKernelsCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.h" --stringname="satClipKernelsCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/primitiveContacts.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/primitiveContacts.h" --stringname="primitiveContactsKernelsCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/bvhTraversal.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/bvhTraversal.h" --stringname="bvhTraversalKernelCL" stringify + + +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/integrateKernel.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/integrateKernel.h" --stringname="integrateKernelCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/updateAabbsKernel.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/updateAabbsKernel.h" --stringname="updateAabbsKernelCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup.h" --stringname="solverSetupCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup2.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup2.h" --stringname="solverSetup2CL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernels.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernels.h" --stringname="batchingKernelsCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernelsNew.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernelsNew.h" --stringname="batchingKernelsNewCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverUtils.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverUtils.h" --stringname="solverUtilsCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solveContact.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solveContact.h" --stringname="solveContactCL" stringify +./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solveFriction.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solveFriction.h" --stringname="solveFrictionCL" stringify + diff --git a/build/stringify.sh b/build/stringify_osx.sh similarity index 100% rename from build/stringify.sh rename to build/stringify_osx.sh diff --git a/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexPolyhedronCL.h b/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexPolyhedronCL.h index 7818194a6..97c525b1d 100644 --- a/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexPolyhedronCL.h +++ b/src/Bullet3OpenCL/NarrowphaseCollision/b3ConvexPolyhedronCL.h @@ -8,6 +8,8 @@ struct b3GpuFace b3Vector4 m_plane; int m_indexOffset; int m_numIndices; + int m_unusedPadding1; + int m_unusedPadding2; }; B3_ATTRIBUTE_ALIGNED16(struct) b3ConvexPolyhedronCL @@ -61,4 +63,4 @@ B3_ATTRIBUTE_ALIGNED16(struct) b3ConvexPolyhedronCL }; -#endif //CONVEX_POLYHEDRON_CL \ No newline at end of file +#endif //CONVEX_POLYHEDRON_CL