fix demo/gpudemo build
This commit is contained in:
@@ -1,132 +0,0 @@
|
||||
hasCL = findOpenCL_AMD()
|
||||
|
||||
if (hasCL) then
|
||||
|
||||
project "bullet2_gpu_demo_opengl3core"
|
||||
|
||||
initOpenCL_AMD()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"gwen"
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../gwenUserInterface.cpp",
|
||||
"../gwenUserInterface.h",
|
||||
"../ParticleDemo.cpp",
|
||||
"../ParticleDemo.h",
|
||||
"../BroadphaseBenchmark.cpp",
|
||||
"../BroadphaseBenchmark.h",
|
||||
|
||||
"../main_opengl3core.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.cpp",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.h",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
}
|
||||
|
||||
if os.is("Windows") then
|
||||
files {
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
}
|
||||
end
|
||||
if os.is("Linux") then
|
||||
files{
|
||||
"../../../../rendering/rendertest/X11OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/X11OpenGLWindow.h",
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,266 +0,0 @@
|
||||
|
||||
hasCL = findOpenCL_Apple()
|
||||
|
||||
if (hasCL) then
|
||||
|
||||
project "bullet2_gpu_demo_opengl2_Apple"
|
||||
|
||||
initOpenCL_Apple()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../rendering/rendertest",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"BulletSoftBody",
|
||||
"BulletDynamics",
|
||||
"BulletCollision",
|
||||
"LinearMath"
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../main_opengl2.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL2Renderer.cpp",
|
||||
"../../../DemosCommon/OpenGL2Renderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
}
|
||||
|
||||
if os.is("windows") then
|
||||
files
|
||||
{
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
}
|
||||
end
|
||||
|
||||
if os.is("macosx") then
|
||||
files
|
||||
{
|
||||
"../../../../rendering/rendertest/MacOpenGLWindow.mm",
|
||||
"../../../../rendering/rendertest/MacOpenGLWindow.h"
|
||||
}
|
||||
links {"Cocoa.framework"}
|
||||
end
|
||||
|
||||
project "bullet2_gpu_demo_opengl3core_Apple"
|
||||
|
||||
initOpenCL_Apple()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../rendering/rendertest",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"BulletSoftBody",
|
||||
"BulletDynamics",
|
||||
"BulletCollision",
|
||||
"LinearMath",
|
||||
"gwen",
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../GwenUserInterface.cpp",
|
||||
"../GwenUserInterface.h",
|
||||
"../ParticleDemo.cpp",
|
||||
"../ParticleDemo.h",
|
||||
"../BroadphaseBenchmark.cpp",
|
||||
"../BroadphaseBenchmark.h",
|
||||
"../main_opengl3core.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.cpp",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.h",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
}
|
||||
|
||||
if os.is("windows") then
|
||||
files
|
||||
{
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
}
|
||||
end
|
||||
|
||||
if os.is("macosx") then
|
||||
files
|
||||
{
|
||||
"../../../../rendering/rendertest/MacOpenGLWindow.mm",
|
||||
"../../../../rendering/rendertest/MacOpenGLWindow.h"
|
||||
}
|
||||
links {"Cocoa.framework"}
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,265 +0,0 @@
|
||||
|
||||
hasCL = findOpenCL_Apple()
|
||||
|
||||
if (hasCL) then
|
||||
|
||||
project "bullet2_gpu_demo_opengl2_Apple"
|
||||
|
||||
initOpenCL_Apple()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../rendering/rendertest",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"BulletSoftBody",
|
||||
"BulletDynamics",
|
||||
"BulletCollision",
|
||||
"LinearMath"
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../main_opengl2.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL2Renderer.cpp",
|
||||
"../../../DemosCommon/OpenGL2Renderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
}
|
||||
|
||||
if os.is("windows") then
|
||||
files
|
||||
{
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
}
|
||||
end
|
||||
|
||||
if os.is("macosx") then
|
||||
files
|
||||
{
|
||||
"../../../../rendering/rendertest/MacOpenGLWindow.mm",
|
||||
"../../../../rendering/rendertest/MacOpenGLWindow.h"
|
||||
}
|
||||
links {"Cocoa.framework"}
|
||||
end
|
||||
|
||||
project "bullet2_gpu_demo_opengl3core_Apple"
|
||||
|
||||
initOpenCL_Apple()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../rendering/rendertest",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"BulletSoftBody",
|
||||
"BulletDynamics",
|
||||
"BulletCollision",
|
||||
"LinearMath",
|
||||
"gwen",
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../GwenUserInterface.cpp",
|
||||
"../GwenUserInterface.h",
|
||||
"../ParticleDemo.cpp",
|
||||
"../ParticleDemo.h",
|
||||
|
||||
"../main_opengl3core.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.cpp",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.h",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
}
|
||||
|
||||
if os.is("windows") then
|
||||
files
|
||||
{
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
}
|
||||
end
|
||||
|
||||
if os.is("macosx") then
|
||||
files
|
||||
{
|
||||
"../../../../rendering/rendertest/MacOpenGLWindow.mm",
|
||||
"../../../../rendering/rendertest/MacOpenGLWindow.h"
|
||||
}
|
||||
links {"Cocoa.framework"}
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,611 +0,0 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#include "btCpuDynamicsWorld.h"
|
||||
#include "btGpuDynamicsWorld.h"
|
||||
|
||||
|
||||
#define SCALING 1.
|
||||
#define START_POS_X -5
|
||||
#define START_POS_Y 10
|
||||
#define START_POS_Z -3
|
||||
|
||||
#include "LinearMath/btVector3.h"
|
||||
|
||||
#include "GpuDemo.h"
|
||||
//#include "GlutStuff.h"
|
||||
///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
|
||||
//#include "btBulletDynamicsCommon.h"
|
||||
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btTriangleMesh.h"
|
||||
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btSphereShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btConvexHullShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btBoxShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
|
||||
|
||||
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
||||
#include "LinearMath/btDefaultMotionState.h"
|
||||
#include "LinearMath/btQuickprof.h"
|
||||
|
||||
|
||||
#include <stdio.h> //printf debugging
|
||||
|
||||
|
||||
void GpuDemo::clientMoveAndDisplay()
|
||||
{
|
||||
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
//simple dynamics world doesn't handle fixed-time-stepping
|
||||
float dt = getDeltaTimeInSeconds();
|
||||
|
||||
///step the simulation
|
||||
if (m_dynamicsWorld)
|
||||
{
|
||||
static bool once = true;
|
||||
if (once)
|
||||
{
|
||||
once=false;
|
||||
btDefaultSerializer* serializer = new btDefaultSerializer();
|
||||
m_dynamicsWorld->serialize(serializer);
|
||||
|
||||
FILE* file = fopen("testFile.bullet","wb");
|
||||
fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1, file);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
m_dynamicsWorld->stepSimulation(dt);
|
||||
static int count=0;
|
||||
count++;
|
||||
if (count==25)
|
||||
{
|
||||
//CProfileManager::dumpAll();
|
||||
}
|
||||
}
|
||||
|
||||
// renderme();
|
||||
|
||||
|
||||
//swapBuffers();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
btAlignedObjectArray<btVector3> vertices;
|
||||
|
||||
void EmptyDemo::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
//empty test
|
||||
}
|
||||
|
||||
void SpheresDemo::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
|
||||
|
||||
if (1)
|
||||
{
|
||||
btSphereShape* sphere = new btSphereShape(1);
|
||||
m_collisionShapes.push_back(sphere);
|
||||
|
||||
/// Create Dynamic Objects
|
||||
btTransform startTransform;
|
||||
startTransform.setIdentity();
|
||||
|
||||
|
||||
|
||||
float start_x = START_POS_X - ci.gapX*ci.arraySizeX/2;
|
||||
float start_y = START_POS_Y;
|
||||
float start_z = START_POS_Z - ci.gapZ*ci.arraySizeZ/2;
|
||||
|
||||
for (int k=0;k<ci.arraySizeY;k++)
|
||||
{
|
||||
int sizeX = ci.arraySizeX;
|
||||
int startX = -sizeX/2;
|
||||
float gapX = ci.gapX;
|
||||
|
||||
for (int i=0;i<sizeX;i++)
|
||||
{
|
||||
int sizeZ = ci.arraySizeZ;
|
||||
int startZ = -sizeX/2;
|
||||
float gapZ =ci.gapZ;
|
||||
for(int j = 0;j<sizeZ;j++)
|
||||
{
|
||||
//btCollisionShape* shape = k==0? boxShape : colShape;
|
||||
|
||||
btCollisionShape* shape = sphere;
|
||||
|
||||
|
||||
btScalar mass = 1;
|
||||
if (!ci.m_useConcaveMesh && k==0)
|
||||
mass = k==0? 0.f : 1.f;
|
||||
|
||||
//rigidbody is dynamic if and only if mass is non zero, otherwise static
|
||||
bool isDynamic = (mass != 0.f);
|
||||
|
||||
btVector3 localInertia(0,0,0);
|
||||
if (isDynamic)
|
||||
shape->calculateLocalInertia(mass,localInertia);
|
||||
|
||||
startTransform.setOrigin(SCALING*btVector3(
|
||||
btScalar(gapX*i + start_x),
|
||||
btScalar(ci.gapY*k + start_y),
|
||||
btScalar(gapZ*j + start_z)));
|
||||
|
||||
|
||||
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
|
||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
|
||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
|
||||
btRigidBody* body = new btRigidBody(rbInfo);
|
||||
|
||||
|
||||
m_dynamicsWorld->addRigidBody(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
btVector3 planeNormal(0,1,0);
|
||||
btScalar planeConstant=0;
|
||||
|
||||
btCollisionShape* shape = new btStaticPlaneShape(planeNormal,planeConstant);
|
||||
//btBoxShape* plane = new btBoxShape(btVector3(100,1,100));
|
||||
//plane->initializePolyhedralFeatures();
|
||||
//btSphereShape* shape = new btSphereShape(1000);
|
||||
|
||||
btScalar mass(0.);
|
||||
|
||||
//rigidbody is dynamic if and only if mass is non zero, otherwise static
|
||||
bool isDynamic = (mass != 0.f);
|
||||
|
||||
btVector3 localInertia(0,0,0);
|
||||
btTransform groundTransform;
|
||||
groundTransform.setIdentity();
|
||||
groundTransform.setRotation(btQuaternion(btVector3(1,0,0),0.3));
|
||||
groundTransform.setOrigin(btVector3(0,0,0));
|
||||
|
||||
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
|
||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
|
||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
|
||||
btRigidBody* body = new btRigidBody(rbInfo);
|
||||
|
||||
//add the body to the dynamics world
|
||||
m_dynamicsWorld->addRigidBody(body);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpuCompoundDemo::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
btCollisionShape* groundShape =0;
|
||||
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
|
||||
|
||||
if (ci.m_useConcaveMesh)
|
||||
{
|
||||
btTriangleMesh* meshInterface = new btTriangleMesh();
|
||||
|
||||
btAlignedObjectArray<btVector3> concaveVertices;
|
||||
concaveVertices.push_back(btVector3(0,-20,0));
|
||||
concaveVertices.push_back(btVector3(80,10,80));
|
||||
concaveVertices.push_back(btVector3(80,10,-80));
|
||||
concaveVertices.push_back(btVector3(-80,10,-80));
|
||||
concaveVertices.push_back(btVector3(-80,10,80));
|
||||
|
||||
meshInterface->addTriangle(concaveVertices[0],concaveVertices[1],concaveVertices[2],true);
|
||||
meshInterface->addTriangle(concaveVertices[0],concaveVertices[2],concaveVertices[3],true);
|
||||
meshInterface->addTriangle(concaveVertices[0],concaveVertices[3],concaveVertices[4],true);
|
||||
meshInterface->addTriangle(concaveVertices[0],concaveVertices[4],concaveVertices[1],true);
|
||||
|
||||
#if 0
|
||||
groundShape = new btBvhTriangleMeshShape(meshInterface,true);//btStaticPlaneShape(btVector3(0,1,0),50);
|
||||
#else
|
||||
btBoxShape* shape =new btBoxShape(btVector3(btScalar(250.),btScalar(10.),btScalar(250.)));
|
||||
shape->initializePolyhedralFeatures();
|
||||
groundShape = shape;
|
||||
#endif
|
||||
|
||||
} else
|
||||
{
|
||||
groundShape = new btBoxShape(btVector3(btScalar(250.),btScalar(50.),btScalar(250.)));
|
||||
}
|
||||
|
||||
m_collisionShapes.push_back(groundShape);
|
||||
|
||||
btTransform groundTransform;
|
||||
groundTransform.setIdentity();
|
||||
groundTransform.setOrigin(btVector3(0,0,0));
|
||||
|
||||
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
|
||||
if (ci.m_useConcaveMesh)
|
||||
{
|
||||
btScalar mass(0.);
|
||||
|
||||
//rigidbody is dynamic if and only if mass is non zero, otherwise static
|
||||
bool isDynamic = (mass != 0.f);
|
||||
|
||||
btVector3 localInertia(0,0,0);
|
||||
if (isDynamic)
|
||||
groundShape->calculateLocalInertia(mass,localInertia);
|
||||
|
||||
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
|
||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
|
||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
|
||||
btRigidBody* body = new btRigidBody(rbInfo);
|
||||
|
||||
//add the body to the dynamics world
|
||||
m_dynamicsWorld->addRigidBody(body);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//create a few dynamic rigidbodies
|
||||
// Re-using the same collision is better for memory usage and performance
|
||||
|
||||
//vertices.push_back(btVector3(0,1,0));
|
||||
vertices.push_back(btVector3(1,1,1));
|
||||
vertices.push_back(btVector3(1,1,-1));
|
||||
vertices.push_back(btVector3(-1,1,-1));
|
||||
vertices.push_back(btVector3(-1,1,1));
|
||||
vertices.push_back(btVector3(1,-1,1));
|
||||
vertices.push_back(btVector3(1,-1,-1));
|
||||
vertices.push_back(btVector3(-1,-1,-1));
|
||||
vertices.push_back(btVector3(-1,-1,1));
|
||||
|
||||
#if 0
|
||||
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
|
||||
colShape->initializePolyhedralFeatures();
|
||||
#else
|
||||
btCompoundShape* compoundShape = 0;
|
||||
{
|
||||
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
|
||||
colShape->initializePolyhedralFeatures();
|
||||
compoundShape = new btCompoundShape();
|
||||
btTransform tr;
|
||||
tr.setIdentity();
|
||||
tr.setOrigin(btVector3(0,-1,0));
|
||||
compoundShape->addChildShape(tr,colShape);
|
||||
tr.setOrigin(btVector3(0,0,2));
|
||||
compoundShape->addChildShape(tr,colShape);
|
||||
tr.setOrigin(btVector3(2,0,0));
|
||||
compoundShape->addChildShape(tr,colShape);
|
||||
}
|
||||
btCollisionShape* colShape = compoundShape;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
btPolyhedralConvexShape* boxShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
|
||||
boxShape->initializePolyhedralFeatures();
|
||||
|
||||
|
||||
|
||||
|
||||
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
|
||||
m_collisionShapes.push_back(colShape);
|
||||
m_collisionShapes.push_back(boxShape);
|
||||
|
||||
/// Create Dynamic Objects
|
||||
btTransform startTransform;
|
||||
startTransform.setIdentity();
|
||||
|
||||
|
||||
|
||||
float start_x = START_POS_X - ci.arraySizeX/2;
|
||||
float start_y = START_POS_Y;
|
||||
float start_z = START_POS_Z - ci.arraySizeZ/2;
|
||||
|
||||
for (int k=0;k<ci.arraySizeY;k++)
|
||||
{
|
||||
int sizeX = ci.arraySizeX;
|
||||
if (!ci.m_useConcaveMesh && k==0)
|
||||
sizeX = 50;
|
||||
|
||||
int startX = !ci.m_useConcaveMesh&&k==0? -20 : 0;
|
||||
float gapX = !ci.m_useConcaveMesh&&k==0? 3.05 : ci.gapX;
|
||||
for (int i=0;i<sizeX;i++)
|
||||
{
|
||||
int sizeZ = !ci.m_useConcaveMesh&&k==0? 50 : ci.arraySizeZ;
|
||||
int startZ = (!ci.m_useConcaveMesh)&&k==0? -20 : 0;
|
||||
float gapZ = !ci.m_useConcaveMesh&&k==0? 3.05 : ci.gapZ;
|
||||
for(int j = 0;j<sizeZ;j++)
|
||||
{
|
||||
//btCollisionShape* shape = k==0? boxShape : colShape;
|
||||
|
||||
btCollisionShape* shape = colShape;
|
||||
|
||||
|
||||
btScalar mass = 1;
|
||||
if (!ci.m_useConcaveMesh && k==0)
|
||||
mass = k==0? 0.f : 1.f;
|
||||
|
||||
//rigidbody is dynamic if and only if mass is non zero, otherwise static
|
||||
bool isDynamic = (mass != 0.f);
|
||||
|
||||
btVector3 localInertia(0,0,0);
|
||||
if (isDynamic)
|
||||
shape->calculateLocalInertia(mass,localInertia);
|
||||
|
||||
startTransform.setOrigin(SCALING*btVector3(
|
||||
btScalar(startX+gapX*i + start_x),
|
||||
btScalar(20+ci.gapY*k + start_y),
|
||||
btScalar(startZ+gapZ*j + start_z)));
|
||||
|
||||
|
||||
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
|
||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
|
||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
|
||||
btRigidBody* body = new btRigidBody(rbInfo);
|
||||
|
||||
|
||||
m_dynamicsWorld->addRigidBody(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GpuBoxDemo::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
btCollisionShape* groundShape =0;
|
||||
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
|
||||
|
||||
if (ci.m_useConcaveMesh)
|
||||
{
|
||||
btTriangleMesh* meshInterface = new btTriangleMesh();
|
||||
|
||||
btAlignedObjectArray<btVector3> concaveVertices;
|
||||
concaveVertices.push_back(btVector3(0,-20,0));
|
||||
concaveVertices.push_back(btVector3(80,10,80));
|
||||
concaveVertices.push_back(btVector3(80,10,-80));
|
||||
concaveVertices.push_back(btVector3(-80,10,-80));
|
||||
concaveVertices.push_back(btVector3(-80,10,80));
|
||||
|
||||
meshInterface->addTriangle(concaveVertices[0],concaveVertices[1],concaveVertices[2],true);
|
||||
meshInterface->addTriangle(concaveVertices[0],concaveVertices[2],concaveVertices[3],true);
|
||||
meshInterface->addTriangle(concaveVertices[0],concaveVertices[3],concaveVertices[4],true);
|
||||
meshInterface->addTriangle(concaveVertices[0],concaveVertices[4],concaveVertices[1],true);
|
||||
|
||||
#if 0
|
||||
groundShape = new btBvhTriangleMeshShape(meshInterface,true);//btStaticPlaneShape(btVector3(0,1,0),50);
|
||||
#else
|
||||
btBoxShape* shape =new btBoxShape(btVector3(btScalar(250.),btScalar(10.),btScalar(250.)));
|
||||
shape->initializePolyhedralFeatures();
|
||||
groundShape = shape;
|
||||
#endif
|
||||
|
||||
} else
|
||||
{
|
||||
groundShape = new btBoxShape(btVector3(btScalar(250.),btScalar(50.),btScalar(250.)));
|
||||
}
|
||||
|
||||
m_collisionShapes.push_back(groundShape);
|
||||
|
||||
btTransform groundTransform;
|
||||
groundTransform.setIdentity();
|
||||
groundTransform.setOrigin(btVector3(0,0,0));
|
||||
|
||||
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
|
||||
if (ci.m_useConcaveMesh)
|
||||
{
|
||||
btScalar mass(0.);
|
||||
|
||||
//rigidbody is dynamic if and only if mass is non zero, otherwise static
|
||||
bool isDynamic = (mass != 0.f);
|
||||
|
||||
btVector3 localInertia(0,0,0);
|
||||
if (isDynamic)
|
||||
groundShape->calculateLocalInertia(mass,localInertia);
|
||||
|
||||
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
|
||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
|
||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
|
||||
btRigidBody* body = new btRigidBody(rbInfo);
|
||||
|
||||
//add the body to the dynamics world
|
||||
m_dynamicsWorld->addRigidBody(body);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//create a few dynamic rigidbodies
|
||||
// Re-using the same collision is better for memory usage and performance
|
||||
|
||||
//vertices.push_back(btVector3(0,1,0));
|
||||
vertices.push_back(btVector3(1,1,1));
|
||||
vertices.push_back(btVector3(1,1,-1));
|
||||
vertices.push_back(btVector3(-1,1,-1));
|
||||
vertices.push_back(btVector3(-1,1,1));
|
||||
vertices.push_back(btVector3(1,-1,1));
|
||||
vertices.push_back(btVector3(1,-1,-1));
|
||||
vertices.push_back(btVector3(-1,-1,-1));
|
||||
vertices.push_back(btVector3(-1,-1,1));
|
||||
|
||||
#if 1
|
||||
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
|
||||
colShape->initializePolyhedralFeatures();
|
||||
#else
|
||||
btCompoundShape* compoundShape = 0;
|
||||
{
|
||||
btPolyhedralConvexShape* colShape = new btConvexHullShape(&vertices[0].getX(),vertices.size());
|
||||
colShape->initializePolyhedralFeatures();
|
||||
compoundShape = new btCompoundShape();
|
||||
btTransform tr;
|
||||
tr.setIdentity();
|
||||
tr.setOrigin(btVector3(0,-1,0));
|
||||
compoundShape->addChildShape(tr,colShape);
|
||||
tr.setOrigin(btVector3(0,0,2));
|
||||
compoundShape->addChildShape(tr,colShape);
|
||||
tr.setOrigin(btVector3(2,0,0));
|
||||
compoundShape->addChildShape(tr,colShape);
|
||||
}
|
||||
btCollisionShape* colShape = compoundShape;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
btPolyhedralConvexShape* boxShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
|
||||
boxShape->initializePolyhedralFeatures();
|
||||
|
||||
|
||||
|
||||
|
||||
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
|
||||
m_collisionShapes.push_back(colShape);
|
||||
m_collisionShapes.push_back(boxShape);
|
||||
|
||||
/// Create Dynamic Objects
|
||||
btTransform startTransform;
|
||||
startTransform.setIdentity();
|
||||
|
||||
|
||||
|
||||
float start_x = START_POS_X - ci.arraySizeX/2;
|
||||
float start_y = START_POS_Y;
|
||||
float start_z = START_POS_Z - ci.arraySizeZ/2;
|
||||
|
||||
for (int k=0;k<ci.arraySizeY;k++)
|
||||
{
|
||||
int sizeX = ci.arraySizeX;
|
||||
if (!ci.m_useConcaveMesh && k==0)
|
||||
sizeX = 50;
|
||||
|
||||
int startX = !ci.m_useConcaveMesh&&k==0? -20 : 0;
|
||||
float gapX = !ci.m_useConcaveMesh&&k==0? 3.05 : ci.gapX;
|
||||
for (int i=0;i<sizeX;i++)
|
||||
{
|
||||
int sizeZ = !ci.m_useConcaveMesh&&k==0? 50 : ci.arraySizeZ;
|
||||
int startZ = (!ci.m_useConcaveMesh)&&k==0? -20 : 0;
|
||||
float gapZ = !ci.m_useConcaveMesh&&k==0? 3.05 : ci.gapZ;
|
||||
for(int j = 0;j<sizeZ;j++)
|
||||
{
|
||||
//btCollisionShape* shape = k==0? boxShape : colShape;
|
||||
|
||||
btCollisionShape* shape = colShape;
|
||||
|
||||
|
||||
btScalar mass = 1;
|
||||
if (!ci.m_useConcaveMesh && k==0)
|
||||
mass = k==0? 0.f : 1.f;
|
||||
|
||||
//rigidbody is dynamic if and only if mass is non zero, otherwise static
|
||||
bool isDynamic = (mass != 0.f);
|
||||
|
||||
btVector3 localInertia(0,0,0);
|
||||
if (isDynamic)
|
||||
shape->calculateLocalInertia(mass,localInertia);
|
||||
|
||||
startTransform.setOrigin(SCALING*btVector3(
|
||||
btScalar(startX+gapX*i + start_x),
|
||||
btScalar(ci.gapY*(k+0.5) + start_y),
|
||||
btScalar(startZ+gapZ*j + start_z)));
|
||||
|
||||
|
||||
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
|
||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
|
||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
|
||||
btRigidBody* body = new btRigidBody(rbInfo);
|
||||
|
||||
|
||||
m_dynamicsWorld->addRigidBody(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GpuDemo::initPhysics(const ConstructionInfo& ci)
|
||||
{
|
||||
|
||||
// setTexturing(true);
|
||||
//setShadows(false);
|
||||
|
||||
// setCameraDistance(btScalar(SCALING*250.));
|
||||
|
||||
///collision configuration contains default setup for memory, collision setup
|
||||
if (ci.useOpenCL)
|
||||
{
|
||||
m_dynamicsWorld = new btGpuDynamicsWorld(ci.preferredOpenCLPlatformIndex,ci.preferredOpenCLDeviceIndex);
|
||||
} else
|
||||
{
|
||||
m_dynamicsWorld = new btCpuDynamicsWorld();
|
||||
}
|
||||
|
||||
|
||||
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
|
||||
|
||||
///create a few basic rigid bodies
|
||||
|
||||
setupScene(ci);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*void GpuDemo::clientResetScene()
|
||||
{
|
||||
exitPhysics();
|
||||
initPhysics();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void GpuDemo::exitPhysics()
|
||||
{
|
||||
|
||||
//cleanup in the reverse order of creation/initialization
|
||||
|
||||
//remove the rigidbodies from the dynamics world and delete them
|
||||
int i;
|
||||
if (m_dynamicsWorld)
|
||||
{
|
||||
for (i=m_dynamicsWorld->getNumCollisionObjects()-1; i>=0 ;i--)
|
||||
{
|
||||
btCollisionObject* obj = m_dynamicsWorld->getCollisionObjectArray()[i];
|
||||
btRigidBody* body = btRigidBody::upcast(obj);
|
||||
if (body && body->getMotionState())
|
||||
{
|
||||
delete body->getMotionState();
|
||||
}
|
||||
m_dynamicsWorld->removeCollisionObject( obj );
|
||||
delete obj;
|
||||
}
|
||||
}
|
||||
|
||||
//delete collision shapes
|
||||
for (int j=0;j<m_collisionShapes.size();j++)
|
||||
{
|
||||
btCollisionShape* shape = m_collisionShapes[j];
|
||||
delete shape;
|
||||
}
|
||||
m_collisionShapes.clear();
|
||||
|
||||
delete m_dynamicsWorld;
|
||||
m_dynamicsWorld=0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#ifndef GPU_DEMO_H
|
||||
#define GPU_DEMO_H
|
||||
|
||||
|
||||
#include "BulletCommon/btAlignedObjectArray.h"
|
||||
|
||||
|
||||
class btBroadphaseInterface;
|
||||
class btCollisionShape;
|
||||
class btOverlappingPairCache;
|
||||
class btCollisionDispatcher;
|
||||
class btConstraintSolver;
|
||||
struct btCollisionAlgorithmCreateFunc;
|
||||
class btDefaultCollisionConfiguration;
|
||||
class btDynamicsWorld;
|
||||
class GLInstancingRenderer;
|
||||
|
||||
///GpuDemo is good starting point for learning the code base and porting.
|
||||
|
||||
|
||||
|
||||
class GpuDemo
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
btDynamicsWorld* m_dynamicsWorld;
|
||||
|
||||
//keep the collision shapes, for deletion/cleanup
|
||||
btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
|
||||
|
||||
float getDeltaTimeInSeconds()
|
||||
{
|
||||
return 1./60.f;
|
||||
}
|
||||
public:
|
||||
|
||||
typedef class GpuDemo* (CreateFunc)();
|
||||
|
||||
struct ConstructionInfo
|
||||
{
|
||||
bool useOpenCL;
|
||||
int preferredOpenCLPlatformIndex;
|
||||
int preferredOpenCLDeviceIndex;
|
||||
int arraySizeX;
|
||||
int arraySizeY;
|
||||
int arraySizeZ;
|
||||
bool m_useConcaveMesh;
|
||||
float gapX;
|
||||
float gapY;
|
||||
float gapZ;
|
||||
GLInstancingRenderer* m_instancingRenderer;
|
||||
ConstructionInfo()
|
||||
:useOpenCL(false),//true),
|
||||
preferredOpenCLPlatformIndex(-1),
|
||||
preferredOpenCLDeviceIndex(-1),
|
||||
arraySizeX(10),
|
||||
arraySizeY(10 ),
|
||||
arraySizeZ(10),
|
||||
m_useConcaveMesh(false),
|
||||
gapX(4.3),
|
||||
gapY(4.0),
|
||||
gapZ(4.3),
|
||||
m_instancingRenderer(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void setupScene(const ConstructionInfo& ci)=0;
|
||||
public:
|
||||
|
||||
GpuDemo()
|
||||
{
|
||||
m_dynamicsWorld=0;
|
||||
|
||||
}
|
||||
virtual ~GpuDemo()
|
||||
{
|
||||
exitPhysics();
|
||||
}
|
||||
virtual void initPhysics(const ConstructionInfo& ci);
|
||||
|
||||
virtual const char* getName()=0;
|
||||
|
||||
virtual void exitPhysics();
|
||||
|
||||
virtual const btDynamicsWorld* getDynamicsWorld() const
|
||||
{
|
||||
return m_dynamicsWorld;
|
||||
}
|
||||
|
||||
virtual void renderScene()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual void clientMoveAndDisplay();
|
||||
|
||||
|
||||
//virtual void clientResetScene();
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
class GpuCompoundDemo : public GpuDemo
|
||||
{
|
||||
public:
|
||||
virtual void setupScene(const ConstructionInfo& ci);
|
||||
virtual const char* getName()
|
||||
{
|
||||
return "GpuCompoundDemo";
|
||||
}
|
||||
static GpuDemo* CreateFunc()
|
||||
{
|
||||
GpuDemo* demo = new GpuCompoundDemo;
|
||||
return demo;
|
||||
}
|
||||
};
|
||||
|
||||
class GpuBoxDemo : public GpuDemo
|
||||
{
|
||||
public:
|
||||
virtual void setupScene(const ConstructionInfo& ci);
|
||||
virtual const char* getName()
|
||||
{
|
||||
return "GpuBoxDemo";
|
||||
}
|
||||
static GpuDemo* CreateFunc()
|
||||
{
|
||||
GpuDemo* demo = new GpuBoxDemo;
|
||||
return demo;
|
||||
}
|
||||
};
|
||||
|
||||
class EmptyDemo : public GpuDemo
|
||||
{
|
||||
public:
|
||||
virtual void setupScene(const ConstructionInfo& ci);
|
||||
virtual const char* getName()
|
||||
{
|
||||
return "EmptyDemo";
|
||||
}
|
||||
static GpuDemo* CreateFunc()
|
||||
{
|
||||
GpuDemo* demo = new EmptyDemo;
|
||||
return demo;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class SpheresDemo : public GpuDemo
|
||||
{
|
||||
public:
|
||||
virtual void setupScene(const ConstructionInfo& ci);
|
||||
virtual const char* getName()
|
||||
{
|
||||
return "SpheresDemo";
|
||||
}
|
||||
static GpuDemo* CreateFunc()
|
||||
{
|
||||
GpuDemo* demo = new SpheresDemo;
|
||||
return demo;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //GPU_DEMO_H
|
||||
@@ -1,234 +0,0 @@
|
||||
|
||||
hasCL = findOpenCL_NVIDIA()
|
||||
|
||||
if (hasCL) then
|
||||
|
||||
project "bullet2_gpu_demo_opengl2_NVIDIA"
|
||||
|
||||
initOpenCL_NVIDIA()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"BulletSoftBody",
|
||||
"BulletDynamics",
|
||||
"BulletCollision",
|
||||
"LinearMath"
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../main_opengl2.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL2Renderer.cpp",
|
||||
"../../../DemosCommon/OpenGL2Renderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
}
|
||||
|
||||
project "bullet2_gpu_demo_opengl3core_NVIDIA"
|
||||
|
||||
initOpenCL_NVIDIA()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"BulletSoftBody",
|
||||
"BulletDynamics",
|
||||
"BulletCollision",
|
||||
"LinearMath",
|
||||
"gwen",
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../GwenUserInterface.cpp",
|
||||
"../GwenUserInterface.h",
|
||||
"../ParticleDemo.cpp",
|
||||
"../ParticleDemo.h",
|
||||
"../BroadphaseBenchmark.cpp",
|
||||
"../BroadphaseBenchmark.h",
|
||||
"../main_opengl3core.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.cpp",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.h",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
|
||||
}
|
||||
end
|
||||
@@ -1,233 +0,0 @@
|
||||
|
||||
hasCL = findOpenCL_NVIDIA()
|
||||
|
||||
if (hasCL) then
|
||||
|
||||
project "bullet2_gpu_demo_opengl2_NVIDIA"
|
||||
|
||||
initOpenCL_NVIDIA()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"BulletSoftBody",
|
||||
"BulletDynamics",
|
||||
"BulletCollision",
|
||||
"LinearMath"
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../main_opengl2.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL2Renderer.cpp",
|
||||
"../../../DemosCommon/OpenGL2Renderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
}
|
||||
|
||||
project "bullet2_gpu_demo_opengl3core_NVIDIA"
|
||||
|
||||
initOpenCL_NVIDIA()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
targetdir "../../../../bin"
|
||||
|
||||
includedirs {
|
||||
"..",
|
||||
"../../../../bullet2",
|
||||
"../../../../rendering/Gwen"
|
||||
}
|
||||
|
||||
|
||||
links {
|
||||
"BulletSoftBody",
|
||||
"BulletDynamics",
|
||||
"BulletCollision",
|
||||
"LinearMath",
|
||||
"gwen",
|
||||
}
|
||||
|
||||
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
files {
|
||||
"../GpuDemo.cpp",
|
||||
"../GpuDemo.h",
|
||||
"../btGpuDynamicsWorld.cpp",
|
||||
"../btGpuDynamicsWorld.h",
|
||||
"../btCpuDynamicsWorld.cpp",
|
||||
"../btCpuDynamicsWorld.h",
|
||||
"../btGpuIntegrateTransforms.cpp",
|
||||
"../btGpuIntegrateTransforms.h",
|
||||
"../GwenUserInterface.cpp",
|
||||
"../GwenUserInterface.h",
|
||||
"../ParticleDemo.cpp",
|
||||
"../ParticleDemo.h",
|
||||
|
||||
"../main_opengl3core.cpp",
|
||||
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.cpp",
|
||||
"../../../../opencl/opengl_interop/btOpenCLGLInteropBuffer.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/CLPhysicsDemo.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btPgsJacobiSolver.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/btGpuSapBroadphase.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline2/ConvexHullContact.h",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btPrefixScanCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btRadixSort32CL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btFillCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btBoundSearchCL.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btConvexUtility.h",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.cpp",
|
||||
"../../../../opencl/gpu_rigidbody_pipeline/btGpuNarrowPhaseAndSolver.h",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.cpp",
|
||||
"../../../../dynamics/basic_demo/ConvexHeightFieldShape.h",
|
||||
"../../../../dynamics/basic_demo/Stubs/ChNarrowphase.cpp",
|
||||
"../../../../dynamics/basic_demo/Stubs/Solver.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/findPairsOpenCL.h",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.cpp",
|
||||
"../../../../opencl/broadphase_benchmark/btGridBroadphaseCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/bt3dGridBroadphaseOCL.h",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.cpp",
|
||||
"../../../../opencl/3dGridBroadphase/Shared/btGpu3DGridBroadphase.h",
|
||||
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../../../opencl/basic_initialize/btOpenCLInclude.h",
|
||||
|
||||
|
||||
"../../../DemosCommon/GL_ShapeDrawer.cpp",
|
||||
"../../../DemosCommon/GL_ShapeDrawer.h",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.cpp",
|
||||
"../../../DemosCommon/OpenGL3CoreRenderer.h",
|
||||
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/string_extra.h",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/objLoader.h",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/obj_parser.h",
|
||||
"../../../../rendering/WavefrontObjLoader/list.cpp",
|
||||
"../../../../rendering/WavefrontObjLoader/list.h",
|
||||
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLInstancingRenderer.h",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.cpp",
|
||||
"../../../../rendering/rendertest/GLPrimitiveRenderer.h",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.cpp",
|
||||
"../../../../rendering/rendertest/Win32OpenGLWindow.h",
|
||||
"../../../../rendering/rendertest/Win32Window.cpp",
|
||||
"../../../../rendering/rendertest/Win32Window.h",
|
||||
"../../../../rendering/rendertest/LoadShader.cpp",
|
||||
"../../../../rendering/rendertest/LoadShader.h",
|
||||
"../../../../rendering/rendertest/TwFonts.cpp",
|
||||
"../../../../rendering/rendertest/TwFonts.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../../../rendering/OpenGLTrueTypeFont/fontstash.h",
|
||||
|
||||
}
|
||||
end
|
||||
@@ -1,677 +0,0 @@
|
||||
|
||||
#include "OpenGL3CoreRenderer.h"
|
||||
#include "../../rendering/rendertest/GLInstancingRenderer.h"
|
||||
#include "../../rendering/rendertest/ShapeData.h"
|
||||
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||
#include "LinearMath/btQuickprof.h"
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btConvexPolyhedron.h"
|
||||
#include "BulletCollision/CollisionShapes/btConvexHullShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btBoxShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btSphereShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
|
||||
|
||||
#include "../../rendering/WavefrontObjLoader/objLoader.h"
|
||||
|
||||
OpenGL3CoreRenderer::OpenGL3CoreRenderer()
|
||||
{
|
||||
int maxNumObjects = 2*1024*1024;
|
||||
m_instancingRenderer = new GLInstancingRenderer(maxNumObjects);
|
||||
m_instancingRenderer->setCameraDistance(150);
|
||||
}
|
||||
OpenGL3CoreRenderer::~OpenGL3CoreRenderer()
|
||||
{
|
||||
delete m_instancingRenderer;
|
||||
}
|
||||
|
||||
void OpenGL3CoreRenderer::init()
|
||||
{
|
||||
m_instancingRenderer->InitShaders();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OpenGL3CoreRenderer::reshape(int w, int h)
|
||||
{
|
||||
m_instancingRenderer->resize(w,h);
|
||||
}
|
||||
void OpenGL3CoreRenderer::keyboardCallback(unsigned char key)
|
||||
{
|
||||
}
|
||||
|
||||
struct GraphicsVertex
|
||||
{
|
||||
float xyzw[4];
|
||||
float normal[3];
|
||||
float uv[2];
|
||||
};
|
||||
struct GraphicsShape
|
||||
{
|
||||
const float* m_vertices;
|
||||
int m_numvertices;
|
||||
const int* m_indices;
|
||||
int m_numIndices;
|
||||
float m_scaling[4];
|
||||
};
|
||||
|
||||
|
||||
|
||||
GraphicsShape* createGraphicsShapeFromConvexHull(const btConvexPolyhedron* utilPtr)
|
||||
{
|
||||
|
||||
btAlignedObjectArray<GraphicsVertex>* vertices = new btAlignedObjectArray<GraphicsVertex>;
|
||||
{
|
||||
int numVertices = utilPtr->m_vertices.size();
|
||||
int numIndices = 0;
|
||||
btAlignedObjectArray<int>* indicesPtr = new btAlignedObjectArray<int>;
|
||||
for (int f=0;f<utilPtr->m_faces.size();f++)
|
||||
{
|
||||
const btFace& face = utilPtr->m_faces[f];
|
||||
btVector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
|
||||
if (face.m_indices.size()>2)
|
||||
{
|
||||
|
||||
GraphicsVertex vtx;
|
||||
const btVector3& orgVertex = utilPtr->m_vertices[face.m_indices[0]];
|
||||
vtx.xyzw[0] = orgVertex[0];vtx.xyzw[1] = orgVertex[1];vtx.xyzw[2] = orgVertex[2];vtx.xyzw[3] = 0.f;
|
||||
vtx.normal[0] = normal[0];vtx.normal[1] = normal[1];vtx.normal[2] = normal[2];
|
||||
vtx.uv[0] = 0.5f;vtx.uv[1] = 0.5f;
|
||||
int newvtxindex0 = vertices->size();
|
||||
vertices->push_back(vtx);
|
||||
|
||||
for (int j=1;j<face.m_indices.size()-1;j++)
|
||||
{
|
||||
indicesPtr->push_back(newvtxindex0);
|
||||
{
|
||||
GraphicsVertex vtx;
|
||||
const btVector3& orgVertex = utilPtr->m_vertices[face.m_indices[j]];
|
||||
vtx.xyzw[0] = orgVertex[0];vtx.xyzw[1] = orgVertex[1];vtx.xyzw[2] = orgVertex[2];vtx.xyzw[3] = 0.f;
|
||||
vtx.normal[0] = normal[0];vtx.normal[1] = normal[1];vtx.normal[2] = normal[2];
|
||||
vtx.uv[0] = 0.5f;vtx.uv[1] = 0.5f;
|
||||
int newvtxindexj = vertices->size();
|
||||
vertices->push_back(vtx);
|
||||
indicesPtr->push_back(newvtxindexj);
|
||||
}
|
||||
|
||||
{
|
||||
GraphicsVertex vtx;
|
||||
const btVector3& orgVertex = utilPtr->m_vertices[face.m_indices[j+1]];
|
||||
vtx.xyzw[0] = orgVertex[0];vtx.xyzw[1] = orgVertex[1];vtx.xyzw[2] = orgVertex[2];vtx.xyzw[3] = 0.f;
|
||||
vtx.normal[0] = normal[0];vtx.normal[1] = normal[1];vtx.normal[2] = normal[2];
|
||||
vtx.uv[0] = 0.5f;vtx.uv[1] = 0.5f;
|
||||
int newvtxindexj1 = vertices->size();
|
||||
vertices->push_back(vtx);
|
||||
indicesPtr->push_back(newvtxindexj1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GraphicsShape* gfxShape = new GraphicsShape;
|
||||
gfxShape->m_vertices = &vertices->at(0).xyzw[0];
|
||||
gfxShape->m_numvertices = vertices->size();
|
||||
gfxShape->m_indices = &indicesPtr->at(0);
|
||||
gfxShape->m_numIndices = indicesPtr->size();
|
||||
for (int i=0;i<4;i++)
|
||||
gfxShape->m_scaling[i] = 1;//bake the scaling into the vertices
|
||||
return gfxShape;
|
||||
}
|
||||
}
|
||||
|
||||
GraphicsShape* createGraphicsShapeFromCompoundShape(btCompoundShape* compound)
|
||||
{
|
||||
GraphicsShape* gfxShape = new GraphicsShape();
|
||||
btAlignedObjectArray<GraphicsVertex>* vertexArray = new btAlignedObjectArray<GraphicsVertex>;
|
||||
btAlignedObjectArray<int>* indexArray = new btAlignedObjectArray<int>;
|
||||
|
||||
|
||||
|
||||
//create a graphics shape for each child, combine them into a single graphics shape using their child transforms
|
||||
for (int i=0;i<compound->getNumChildShapes();i++)
|
||||
{
|
||||
btAssert(compound->getChildShape(i)->isPolyhedral());
|
||||
if (compound->getChildShape(i)->isPolyhedral())
|
||||
{
|
||||
btPolyhedralConvexShape* convexHull = (btPolyhedralConvexShape*) compound->getChildShape(i);
|
||||
btTransform tr = compound->getChildTransform(i);
|
||||
|
||||
const btConvexPolyhedron* polyhedron = convexHull->getConvexPolyhedron();
|
||||
GraphicsShape* childGfxShape = createGraphicsShapeFromConvexHull(polyhedron);
|
||||
int baseIndex = vertexArray->size();
|
||||
|
||||
for (int j=0;j<childGfxShape->m_numIndices;j++)
|
||||
indexArray->push_back(childGfxShape->m_indices[j]+baseIndex);
|
||||
|
||||
GraphicsVertex* orgVerts = (GraphicsVertex*)childGfxShape->m_vertices;
|
||||
|
||||
for (int j=0;j<childGfxShape->m_numvertices;j++)
|
||||
{
|
||||
GraphicsVertex vtx;
|
||||
btVector3 pos(orgVerts[j].xyzw[0],orgVerts[j].xyzw[1],orgVerts[j].xyzw[2]);
|
||||
pos = tr*pos;
|
||||
vtx.xyzw[0] = childGfxShape->m_scaling[0]*pos.x();
|
||||
vtx.xyzw[1] = childGfxShape->m_scaling[1]*pos.y();
|
||||
vtx.xyzw[2] = childGfxShape->m_scaling[2]*pos.z();
|
||||
vtx.xyzw[3] = 10.f;
|
||||
|
||||
vtx.uv[0] = 0.5f;
|
||||
vtx.uv[1] = 0.5f;
|
||||
|
||||
btVector3 normal(orgVerts[j].normal[0],orgVerts[j].normal[1],orgVerts[j].normal[2]);
|
||||
normal = tr.getBasis()*normal;
|
||||
vtx.normal[0] = normal.x();
|
||||
vtx.normal[1] = normal.y();
|
||||
vtx.normal[2] = normal.z();
|
||||
vertexArray->push_back(vtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
btPolyhedralConvexShape* convexHull = (btPolyhedralConvexShape*) compound->getChildShape(0);
|
||||
const btConvexPolyhedron* polyhedron = convexHull->getConvexPolyhedron();
|
||||
GraphicsShape* childGfxShape = createGraphicsShapeFromConvexHull(polyhedron);
|
||||
|
||||
gfxShape->m_indices = &indexArray->at(0);
|
||||
gfxShape->m_numIndices = indexArray->size();
|
||||
gfxShape->m_vertices = &vertexArray->at(0).xyzw[0];
|
||||
gfxShape->m_numvertices = vertexArray->size();
|
||||
gfxShape->m_scaling[0] = 1;
|
||||
gfxShape->m_scaling[1] = 1;
|
||||
gfxShape->m_scaling[2] = 1;
|
||||
gfxShape->m_scaling[3] = 1;
|
||||
|
||||
return gfxShape;
|
||||
}
|
||||
|
||||
GraphicsShape* createGraphicsShapeFromConcaveMesh(const btBvhTriangleMeshShape* trimesh)
|
||||
{
|
||||
|
||||
btAlignedObjectArray<GraphicsVertex>* vertices = new btAlignedObjectArray<GraphicsVertex>;
|
||||
btAlignedObjectArray<int>* indicesPtr = new btAlignedObjectArray<int>;
|
||||
|
||||
const btStridingMeshInterface* meshInterface = trimesh->getMeshInterface();
|
||||
|
||||
btVector3 trimeshScaling(1,1,1);
|
||||
for (int partId=0;partId<meshInterface->getNumSubParts();partId++)
|
||||
{
|
||||
|
||||
const unsigned char *vertexbase = 0;
|
||||
int numverts = 0;
|
||||
PHY_ScalarType type = PHY_INTEGER;
|
||||
int stride = 0;
|
||||
const unsigned char *indexbase = 0;
|
||||
int indexstride = 0;
|
||||
int numfaces = 0;
|
||||
PHY_ScalarType indicestype = PHY_INTEGER;
|
||||
//PHY_ScalarType indexType=0;
|
||||
|
||||
btVector3 triangleVerts[3];
|
||||
meshInterface->getLockedReadOnlyVertexIndexBase(&vertexbase,numverts, type,stride,&indexbase,indexstride,numfaces,indicestype,partId);
|
||||
btVector3 aabbMin,aabbMax;
|
||||
|
||||
for (int triangleIndex = 0 ; triangleIndex < numfaces;triangleIndex++)
|
||||
{
|
||||
unsigned int* gfxbase = (unsigned int*)(indexbase+triangleIndex*indexstride);
|
||||
|
||||
for (int j=2;j>=0;j--)
|
||||
{
|
||||
|
||||
int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
|
||||
if (type == PHY_FLOAT)
|
||||
{
|
||||
float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
|
||||
triangleVerts[j] = btVector3(
|
||||
graphicsbase[0]*trimeshScaling.getX(),
|
||||
graphicsbase[1]*trimeshScaling.getY(),
|
||||
graphicsbase[2]*trimeshScaling.getZ());
|
||||
}
|
||||
else
|
||||
{
|
||||
double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
|
||||
triangleVerts[j] = btVector3( btScalar(graphicsbase[0]*trimeshScaling.getX()),
|
||||
btScalar(graphicsbase[1]*trimeshScaling.getY()),
|
||||
btScalar(graphicsbase[2]*trimeshScaling.getZ()));
|
||||
}
|
||||
}
|
||||
btVector3 normal = (triangleVerts[2]-triangleVerts[0]).cross(triangleVerts[1]-triangleVerts[0]);
|
||||
normal.normalize();
|
||||
|
||||
GraphicsVertex vtx0,vtx1,vtx2;
|
||||
vtx0.xyzw[0] = triangleVerts[0].getX();
|
||||
vtx0.xyzw[1] = triangleVerts[0].getY();
|
||||
vtx0.xyzw[2] = triangleVerts[0].getZ();
|
||||
vtx0.xyzw[3] = 0;
|
||||
vtx0.uv[0] = 0.5f;
|
||||
vtx0.uv[1] = 0.5f;
|
||||
vtx0.normal[0] = normal[0];
|
||||
vtx0.normal[1] = normal[1];
|
||||
vtx0.normal[2] = normal[2];
|
||||
|
||||
vtx1.xyzw[0] = triangleVerts[1].getX();
|
||||
vtx1.xyzw[1] = triangleVerts[1].getY();
|
||||
vtx1.xyzw[2] = triangleVerts[1].getZ();
|
||||
vtx1.xyzw[3] = 0;
|
||||
vtx1.uv[0] = 0.5f;
|
||||
vtx1.uv[1] = 0.5f;
|
||||
vtx1.normal[0] = normal[0];
|
||||
vtx1.normal[1] = normal[1];
|
||||
vtx1.normal[2] = normal[2];
|
||||
|
||||
vtx2.xyzw[0] = triangleVerts[2].getX();
|
||||
vtx2.xyzw[1] = triangleVerts[2].getY();
|
||||
vtx2.xyzw[2] = triangleVerts[2].getZ();
|
||||
vtx2.xyzw[3] = 0;
|
||||
vtx2.uv[0] = 0.5f;
|
||||
vtx2.uv[1] = 0.5f;
|
||||
vtx2.normal[0] = normal[0];
|
||||
vtx2.normal[1] = normal[1];
|
||||
vtx2.normal[2] = normal[2];
|
||||
|
||||
// triangleVerts[1]
|
||||
// triangleVerts[1]
|
||||
// triangleVerts[2]
|
||||
vertices->push_back(vtx0);
|
||||
vertices->push_back(vtx1);
|
||||
vertices->push_back(vtx2);
|
||||
indicesPtr->push_back(indicesPtr->size());
|
||||
indicesPtr->push_back(indicesPtr->size());
|
||||
indicesPtr->push_back(indicesPtr->size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GraphicsShape* gfxShape = new GraphicsShape;
|
||||
gfxShape->m_vertices = &vertices->at(0).xyzw[0];
|
||||
gfxShape->m_numvertices = vertices->size();
|
||||
gfxShape->m_indices = &indicesPtr->at(0);
|
||||
gfxShape->m_numIndices = indicesPtr->size();
|
||||
for (int i=0;i<4;i++)
|
||||
gfxShape->m_scaling[i] = 1;//bake the scaling into the vertices
|
||||
return gfxShape;
|
||||
}
|
||||
|
||||
|
||||
GraphicsShape* createGraphicsShapeFromWavefrontObj(objLoader* obj)
|
||||
{
|
||||
btAlignedObjectArray<GraphicsVertex>* vertices = new btAlignedObjectArray<GraphicsVertex>;
|
||||
{
|
||||
// int numVertices = obj->vertexCount;
|
||||
// int numIndices = 0;
|
||||
btAlignedObjectArray<int>* indicesPtr = new btAlignedObjectArray<int>;
|
||||
/*
|
||||
for (int v=0;v<obj->vertexCount;v++)
|
||||
{
|
||||
vtx.xyzw[0] = obj->vertexList[v]->e[0];
|
||||
vtx.xyzw[1] = obj->vertexList[v]->e[1];
|
||||
vtx.xyzw[2] = obj->vertexList[v]->e[2];
|
||||
btVector3 n(vtx.xyzw[0],vtx.xyzw[1],vtx.xyzw[2]);
|
||||
if (n.length2()>SIMD_EPSILON)
|
||||
{
|
||||
n.normalize();
|
||||
vtx.normal[0] = n[0];
|
||||
vtx.normal[1] = n[1];
|
||||
vtx.normal[2] = n[2];
|
||||
|
||||
} else
|
||||
{
|
||||
vtx.normal[0] = 0; //todo
|
||||
vtx.normal[1] = 1;
|
||||
vtx.normal[2] = 0;
|
||||
}
|
||||
vtx.uv[0] = 0.5f;vtx.uv[1] = 0.5f; //todo
|
||||
vertices->push_back(vtx);
|
||||
}
|
||||
*/
|
||||
|
||||
for (int f=0;f<obj->faceCount;f++)
|
||||
{
|
||||
obj_face* face = obj->faceList[f];
|
||||
//btVector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
|
||||
if (face->vertex_count>=3)
|
||||
{
|
||||
btVector3 normal(0,1,0);
|
||||
int vtxBaseIndex = vertices->size();
|
||||
|
||||
if (face->vertex_count<=4)
|
||||
{
|
||||
indicesPtr->push_back(vtxBaseIndex);
|
||||
indicesPtr->push_back(vtxBaseIndex+1);
|
||||
indicesPtr->push_back(vtxBaseIndex+2);
|
||||
|
||||
GraphicsVertex vtx0;
|
||||
vtx0.xyzw[0] = obj->vertexList[face->vertex_index[0]]->e[0];
|
||||
vtx0.xyzw[1] = obj->vertexList[face->vertex_index[0]]->e[1];
|
||||
vtx0.xyzw[2] = obj->vertexList[face->vertex_index[0]]->e[2];
|
||||
vtx0.uv[0] = obj->textureList[face->vertex_index[0]]->e[0];
|
||||
vtx0.uv[1] = obj->textureList[face->vertex_index[0]]->e[1];
|
||||
|
||||
GraphicsVertex vtx1;
|
||||
vtx1.xyzw[0] = obj->vertexList[face->vertex_index[1]]->e[0];
|
||||
vtx1.xyzw[1] = obj->vertexList[face->vertex_index[1]]->e[1];
|
||||
vtx1.xyzw[2] = obj->vertexList[face->vertex_index[1]]->e[2];
|
||||
vtx1.uv[0] = obj->textureList[face->vertex_index[1]]->e[0];
|
||||
vtx1.uv[1] = obj->textureList[face->vertex_index[1]]->e[1];
|
||||
|
||||
GraphicsVertex vtx2;
|
||||
vtx2.xyzw[0] = obj->vertexList[face->vertex_index[2]]->e[0];
|
||||
vtx2.xyzw[1] = obj->vertexList[face->vertex_index[2]]->e[1];
|
||||
vtx2.xyzw[2] = obj->vertexList[face->vertex_index[2]]->e[2];
|
||||
vtx2.uv[0] = obj->textureList[face->vertex_index[2]]->e[0];
|
||||
vtx2.uv[1] = obj->textureList[face->vertex_index[2]]->e[1];
|
||||
|
||||
|
||||
btVector3 v0(vtx0.xyzw[0],vtx0.xyzw[1],vtx0.xyzw[2]);
|
||||
btVector3 v1(vtx1.xyzw[0],vtx1.xyzw[1],vtx1.xyzw[2]);
|
||||
btVector3 v2(vtx2.xyzw[0],vtx2.xyzw[1],vtx2.xyzw[2]);
|
||||
|
||||
normal = (v1-v0).cross(v2-v0);
|
||||
normal.normalize();
|
||||
vtx0.normal[0] = normal[0];
|
||||
vtx0.normal[1] = normal[1];
|
||||
vtx0.normal[2] = normal[2];
|
||||
vtx1.normal[0] = normal[0];
|
||||
vtx1.normal[1] = normal[1];
|
||||
vtx1.normal[2] = normal[2];
|
||||
vtx2.normal[0] = normal[0];
|
||||
vtx2.normal[1] = normal[1];
|
||||
vtx2.normal[2] = normal[2];
|
||||
vertices->push_back(vtx0);
|
||||
vertices->push_back(vtx1);
|
||||
vertices->push_back(vtx2);
|
||||
}
|
||||
if (face->vertex_count==4)
|
||||
{
|
||||
|
||||
indicesPtr->push_back(vtxBaseIndex);
|
||||
indicesPtr->push_back(vtxBaseIndex+1);
|
||||
indicesPtr->push_back(vtxBaseIndex+2);
|
||||
indicesPtr->push_back(vtxBaseIndex+3);
|
||||
//
|
||||
GraphicsVertex vtx3;
|
||||
vtx3.xyzw[0] = obj->vertexList[face->vertex_index[3]]->e[0];
|
||||
vtx3.xyzw[1] = obj->vertexList[face->vertex_index[3]]->e[1];
|
||||
vtx3.xyzw[2] = obj->vertexList[face->vertex_index[3]]->e[2];
|
||||
vtx3.uv[0] = 0.5;
|
||||
vtx3.uv[1] = 0.5;
|
||||
|
||||
vtx3.normal[0] = normal[0];
|
||||
vtx3.normal[1] = normal[1];
|
||||
vtx3.normal[2] = normal[2];
|
||||
|
||||
vertices->push_back(vtx3);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GraphicsShape* gfxShape = new GraphicsShape;
|
||||
gfxShape->m_vertices = &vertices->at(0).xyzw[0];
|
||||
gfxShape->m_numvertices = vertices->size();
|
||||
gfxShape->m_indices = &indicesPtr->at(0);
|
||||
gfxShape->m_numIndices = indicesPtr->size();
|
||||
for (int i=0;i<4;i++)
|
||||
gfxShape->m_scaling[i] = 1;//bake the scaling into the vertices
|
||||
return gfxShape;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//very incomplete conversion from physics to graphics
|
||||
void graphics_from_physics(GLInstancingRenderer& renderer, bool syncTransformsOnly, int numObjects, btCollisionObject** colObjArray)
|
||||
{
|
||||
///@todo: we need to sort the objects based on collision shape type, so we can share instances
|
||||
BT_PROFILE("graphics_from_physics");
|
||||
|
||||
int strideInBytes = sizeof(float)*9;
|
||||
|
||||
int prevGraphicsShapeIndex = -1;
|
||||
btCollisionShape* prevShape = 0;
|
||||
|
||||
|
||||
int numColObj = numObjects;
|
||||
int curGraphicsIndex = 0;
|
||||
|
||||
float localScaling[4] = {1,1,1,1};
|
||||
|
||||
|
||||
for (int i=0;i<numColObj;i++)
|
||||
{
|
||||
btCollisionObject* colObj = colObjArray[i];
|
||||
|
||||
btVector3 pos = colObj->getWorldTransform().getOrigin();
|
||||
btQuaternion orn = colObj->getWorldTransform().getRotation();
|
||||
|
||||
float position[4] = {pos.getX(),pos.getY(),pos.getZ(),0.f};
|
||||
float orientation[4] = {orn.getX(),orn.getY(),orn.getZ(),orn.getW()};
|
||||
float color[4] = {0,0,0,1};
|
||||
btVector3 localScaling = colObj->getCollisionShape()->getLocalScaling();
|
||||
|
||||
|
||||
if (colObj->isStaticOrKinematicObject())
|
||||
{
|
||||
color[0]=1.f;
|
||||
}else
|
||||
{
|
||||
color[1]=1.f;
|
||||
}
|
||||
|
||||
if (!syncTransformsOnly)
|
||||
{
|
||||
|
||||
if (prevShape != colObj->getCollisionShape())
|
||||
{
|
||||
if (colObj->getCollisionShape()->isPolyhedral())
|
||||
{
|
||||
btPolyhedralConvexShape* polyShape = (btPolyhedralConvexShape*)colObj->getCollisionShape();
|
||||
const btConvexPolyhedron* pol = polyShape->getConvexPolyhedron();
|
||||
GraphicsShape* gfxShape = createGraphicsShapeFromConvexHull(pol);
|
||||
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
|
||||
prevShape = colObj->getCollisionShape();
|
||||
const btVector3& scaling = prevShape->getLocalScaling();
|
||||
localScaling[0] = scaling.getX();localScaling[1] = scaling.getY();localScaling[2] = scaling.getZ();
|
||||
} else
|
||||
{
|
||||
if (colObj->getCollisionShape()->getShapeType()==TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
{
|
||||
btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*) colObj->getCollisionShape();
|
||||
GraphicsShape* gfxShape = createGraphicsShapeFromConcaveMesh(trimesh);
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
|
||||
prevShape = colObj->getCollisionShape();
|
||||
const btVector3& scaling = prevShape->getLocalScaling();
|
||||
localScaling[0] = scaling.getX();localScaling[1] = scaling.getY();localScaling[2] = scaling.getZ();
|
||||
} else
|
||||
{
|
||||
if (colObj->getCollisionShape()->getShapeType()==COMPOUND_SHAPE_PROXYTYPE)
|
||||
{
|
||||
btCompoundShape* compound = (btCompoundShape*) colObj->getCollisionShape();
|
||||
GraphicsShape* gfxShape = createGraphicsShapeFromCompoundShape(compound);
|
||||
if (gfxShape)
|
||||
{
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
|
||||
prevShape = colObj->getCollisionShape();
|
||||
const btVector3& scaling = prevShape->getLocalScaling();
|
||||
localScaling[0] = scaling.getX();localScaling[1] = scaling.getY();localScaling[2] = scaling.getZ();
|
||||
} else
|
||||
{
|
||||
prevGraphicsShapeIndex = -1;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (colObj->getCollisionShape()->getShapeType()==SPHERE_SHAPE_PROXYTYPE)
|
||||
{
|
||||
btSphereShape* sphere = (btSphereShape*) colObj->getCollisionShape();
|
||||
btScalar radius = sphere->getRadius();
|
||||
|
||||
//btConvexHullShape* spherePoly = new btConvexHullShape(
|
||||
//const btConvexPolyhedron* pol = polyShape->getConvexPolyhedron();
|
||||
|
||||
/*
|
||||
objLoader loader;
|
||||
|
||||
int result = loader.load("../../bin/wavefront/sphere_low.obj");
|
||||
|
||||
|
||||
GraphicsShape* gfxShape = createGraphicsShapeFromWavefrontObj(&loader);
|
||||
|
||||
|
||||
int vertexStrideInBytes = 9*sizeof(float);
|
||||
|
||||
|
||||
printf("vertices (%d):\n",gfxShape->m_numvertices);
|
||||
for (int i=0;i<gfxShape->m_numvertices;i++)
|
||||
{
|
||||
gfxShape->m_vertices[i*9+4] = gfxShape->m_vertices[i*9];
|
||||
gfxShape->m_vertices[i*9+5] = gfxShape->m_vertices[i*9+1];
|
||||
gfxShape->m_vertices[i*9+6] = gfxShape->m_vertices[i*9+2];
|
||||
|
||||
printf("%f,%f,%f,%f,%f,%f,%f,%f,%f,\n",
|
||||
gfxShape->m_vertices[i*9],
|
||||
gfxShape->m_vertices[i*9+1],
|
||||
gfxShape->m_vertices[i*9+2],
|
||||
0.f,//gfxShape->m_vertices[i*9+3],
|
||||
//gfxShape->m_vertices[i*9+4],//face normals
|
||||
//gfxShape->m_vertices[i*9+5],
|
||||
//gfxShape->m_vertices[i*9+6],
|
||||
|
||||
gfxShape->m_vertices[i*9+0],
|
||||
gfxShape->m_vertices[i*9+1],
|
||||
gfxShape->m_vertices[i*9+2],
|
||||
|
||||
gfxShape->m_vertices[i*9+7],
|
||||
gfxShape->m_vertices[i*9+8]);
|
||||
}
|
||||
printf("indices (%d):\n",gfxShape->m_numIndices);
|
||||
for (int i=0;i<gfxShape->m_numIndices/3;i++)
|
||||
{
|
||||
printf("%d,%d,%d,\n",gfxShape->m_indices[i*3],
|
||||
gfxShape->m_indices[i*3+1],
|
||||
gfxShape->m_indices[i*3+2]);
|
||||
}
|
||||
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&gfxShape->m_vertices[0],gfxShape->m_numvertices,gfxShape->m_indices,gfxShape->m_numIndices);
|
||||
*/
|
||||
|
||||
if (radius>=100)
|
||||
{
|
||||
int numVertices = sizeof(detailed_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(detailed_sphere_indices)/sizeof(int);
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&detailed_sphere_vertices[0],numVertices,detailed_sphere_indices,numIndices);
|
||||
} else
|
||||
{
|
||||
bool usePointSprites = true;
|
||||
if (usePointSprites)
|
||||
{
|
||||
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(point_sphere_indices)/sizeof(int);
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,BT_GL_POINTS);
|
||||
} else
|
||||
{
|
||||
if (radius>=10)
|
||||
{
|
||||
int numVertices = sizeof(medium_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(medium_sphere_indices)/sizeof(int);
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&medium_sphere_vertices[0],numVertices,medium_sphere_indices,numIndices);
|
||||
} else
|
||||
{
|
||||
int numVertices = sizeof(low_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(low_sphere_indices)/sizeof(int);
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&low_sphere_vertices[0],numVertices,low_sphere_indices,numIndices);
|
||||
}
|
||||
}
|
||||
}
|
||||
prevShape = sphere;
|
||||
const btVector3& scaling = prevShape->getLocalScaling();
|
||||
//assume uniform scaling, using X component
|
||||
float sphereScale = radius*scaling.getX();
|
||||
localScaling[0] = sphereScale;
|
||||
localScaling[1] = sphereScale;
|
||||
localScaling[2] = sphereScale;
|
||||
} else
|
||||
{
|
||||
if (colObj->getCollisionShape()->getShapeType()==STATIC_PLANE_PROXYTYPE)
|
||||
{
|
||||
btStaticPlaneShape* plane= (btStaticPlaneShape*) colObj->getCollisionShape();
|
||||
prevShape = colObj->getCollisionShape();
|
||||
|
||||
//plane->getPlaneNormal()
|
||||
//plane->getPlaneConstant()
|
||||
if (1)
|
||||
{
|
||||
int numVertices = sizeof(quad_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(quad_indices)/sizeof(int);
|
||||
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&quad_vertices[0],numVertices,quad_indices,numIndices);
|
||||
} else
|
||||
{
|
||||
int numVertices = sizeof(detailed_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(detailed_sphere_indices)/sizeof(int);
|
||||
prevGraphicsShapeIndex = renderer.registerShape(&detailed_sphere_vertices[0],numVertices,detailed_sphere_indices,numIndices);
|
||||
}
|
||||
|
||||
localScaling[0] = 100;
|
||||
localScaling[1] = 1;
|
||||
localScaling[2] = 100;
|
||||
} else
|
||||
{
|
||||
printf("Error: unsupported collision shape type in %s %d\n", __FILE__, __LINE__);
|
||||
prevGraphicsShapeIndex = -1;
|
||||
btAssert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
if (!syncTransformsOnly)
|
||||
{
|
||||
if (prevShape && prevGraphicsShapeIndex>=0)
|
||||
{
|
||||
|
||||
renderer.registerGraphicsInstance(prevGraphicsShapeIndex,position,orientation,color,localScaling);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.writeSingleInstanceTransformToCPU(position,orientation,curGraphicsIndex);
|
||||
|
||||
}
|
||||
curGraphicsIndex++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OpenGL3CoreRenderer::renderPhysicsWorld(int numObjects, btCollisionObject** colObjArray, bool syncOnly)
|
||||
{
|
||||
//sync changes from physics world to render world
|
||||
//for now, we don't deal with adding/removing objects to the world during the simulation, to keep the rendererer simpler
|
||||
|
||||
|
||||
m_instancingRenderer->writeTransforms();
|
||||
|
||||
graphics_from_physics(*m_instancingRenderer,syncOnly,numObjects, colObjArray);
|
||||
|
||||
|
||||
//render
|
||||
|
||||
m_instancingRenderer->RenderScene();
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef OPENGL3_CORE_RENDERER_H
|
||||
#define OPENGL3_CORE_RENDERER_H
|
||||
|
||||
class btCollisionObject;
|
||||
class GLInstancingRenderer;
|
||||
|
||||
class OpenGL3CoreRenderer
|
||||
{
|
||||
|
||||
GLInstancingRenderer* m_instancingRenderer;
|
||||
public:
|
||||
OpenGL3CoreRenderer();
|
||||
virtual ~OpenGL3CoreRenderer();
|
||||
void init();
|
||||
void reshape(int w, int h);
|
||||
void keyboardCallback(unsigned char key);
|
||||
void renderPhysicsWorld(int numObjects, btCollisionObject** colObjArray, bool syncOnly);
|
||||
|
||||
GLInstancingRenderer* getInstancingRenderer()
|
||||
{
|
||||
return m_instancingRenderer;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //OPENGL3_CORE_RENDERER_H
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
static char* particleKernelsString =
|
||||
#include "ParticleKernels.cl"
|
||||
|
||||
#define INTEROPKERNEL_SRC_PATH "../../demos/gpudemo/ParticleKernels.cl"
|
||||
#define INTEROPKERNEL_SRC_PATH "demo/gpudemo/ParticleKernels.cl"
|
||||
#include "BulletCommon/btVector3.h"
|
||||
#include "OpenGLWindow/OpenGLInclude.h"
|
||||
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||
@@ -207,7 +207,7 @@ void ParticleDemo::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
int numParticles = NUM_PARTICLES_X*NUM_PARTICLES_Y*NUM_PARTICLES_Z;
|
||||
|
||||
btOverlappingPairCache* overlappingPairCache=0;
|
||||
|
||||
int maxObjects = NUM_PARTICLES_X*NUM_PARTICLES_Y*NUM_PARTICLES_Z+1024;
|
||||
|
||||
int maxPairsSmallProxy = 32;
|
||||
|
||||
@@ -1,13 +1,49 @@
|
||||
#ifndef PARTICLE_DEMO_H
|
||||
#define PARTICLE_DEMO_H
|
||||
|
||||
#include "GpuDemo.h"
|
||||
//#include "GpuDemo.h"
|
||||
struct GLInstancingRenderer;
|
||||
class ParticleDemo;
|
||||
|
||||
class ParticleDemo : public GpuDemo
|
||||
class ParticleDemo //: public GpuDemo
|
||||
{
|
||||
|
||||
protected:
|
||||
public:
|
||||
|
||||
typedef class ParticleDemo* (CreateFunc)();
|
||||
|
||||
|
||||
|
||||
|
||||
struct ConstructionInfo
|
||||
{
|
||||
bool useOpenCL;
|
||||
int preferredOpenCLPlatformIndex;
|
||||
int preferredOpenCLDeviceIndex;
|
||||
int arraySizeX;
|
||||
int arraySizeY;
|
||||
int arraySizeZ;
|
||||
bool m_useConcaveMesh;
|
||||
float gapX;
|
||||
float gapY;
|
||||
float gapZ;
|
||||
GLInstancingRenderer* m_instancingRenderer;
|
||||
ConstructionInfo()
|
||||
:useOpenCL(false),//true),
|
||||
preferredOpenCLPlatformIndex(-1),
|
||||
preferredOpenCLDeviceIndex(-1),
|
||||
arraySizeX(10),
|
||||
arraySizeY(10 ),
|
||||
arraySizeZ(10),
|
||||
m_useConcaveMesh(false),
|
||||
gapX(4.3),
|
||||
gapY(4.0),
|
||||
gapZ(4.3),
|
||||
m_instancingRenderer(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
struct ParticleInternalData* m_data;
|
||||
|
||||
GLInstancingRenderer* m_instancingRenderer;
|
||||
@@ -31,16 +67,13 @@ public:
|
||||
{
|
||||
return "ParticleDemo";
|
||||
}
|
||||
static GpuDemo* CreateFunc()
|
||||
static ParticleDemo* MyCreateFunc()
|
||||
{
|
||||
GpuDemo* demo = new ParticleDemo;
|
||||
ParticleDemo* demo = new ParticleDemo;
|
||||
return demo;
|
||||
}
|
||||
|
||||
virtual const btDynamicsWorld* getDynamicsWorld() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
virtual void renderScene();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#include "GpuDemo.h"
|
||||
//#include "GpuDemo.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h> //for GetLocalTime/GetSystemTime
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "OpenGLWindow/GLPrimitiveRenderer.h"
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
#include "OpenGL3CoreRenderer.h"
|
||||
//#include "OpenGL3CoreRenderer.h"
|
||||
#include "BulletCommon/btQuickprof.h"
|
||||
//#include "btGpuDynamicsWorld.h"
|
||||
#include <assert.h>
|
||||
@@ -29,6 +29,7 @@
|
||||
int g_OpenGLWidth=1024;
|
||||
int g_OpenGLHeight = 768;
|
||||
bool dump_timings = false;
|
||||
extern char OpenSansData[];
|
||||
|
||||
static void MyResizeCallback( float width, float height)
|
||||
{
|
||||
@@ -55,11 +56,11 @@ enum
|
||||
|
||||
btAlignedObjectArray<const char*> demoNames;
|
||||
int selectedDemo = 0;
|
||||
GpuDemo::CreateFunc* allDemos[]=
|
||||
ParticleDemo::CreateFunc* allDemos[]=
|
||||
{
|
||||
//BroadphaseBenchmark::CreateFunc,
|
||||
//GpuBoxDemo::CreateFunc,
|
||||
ParticleDemo::CreateFunc,
|
||||
ParticleDemo::MyCreateFunc,
|
||||
//SpheresDemo::CreateFunc,
|
||||
//GpuCompoundDemo::CreateFunc,
|
||||
//EmptyDemo::CreateFunc,
|
||||
@@ -141,12 +142,12 @@ void MyKeyboardCallback(int key, int state)
|
||||
|
||||
|
||||
|
||||
extern bool enableExperimentalCpuConcaveCollision;
|
||||
bool enableExperimentalCpuConcaveCollision=false;
|
||||
|
||||
|
||||
|
||||
|
||||
int droidRegular, droidItalic, droidBold, droidJapanese, dejavu;
|
||||
int droidRegular=0;//, droidItalic, droidBold, droidJapanese, dejavu;
|
||||
|
||||
sth_stash* stash=0;
|
||||
|
||||
@@ -156,7 +157,7 @@ sth_stash* initFont(GLPrimitiveRenderer* primRender)
|
||||
|
||||
struct sth_stash* stash = 0;
|
||||
int datasize;
|
||||
unsigned char* data;
|
||||
|
||||
float sx,sy,dx,dy,lh;
|
||||
GLuint texture;
|
||||
|
||||
@@ -171,7 +172,8 @@ sth_stash* initFont(GLPrimitiveRenderer* primRender)
|
||||
fprintf(stderr, "Could not create stash.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LOAD_FONT_FROM_FILE
|
||||
unsigned char* data=0;
|
||||
const char* fontPaths[]={
|
||||
"./",
|
||||
"../../bin/",
|
||||
@@ -250,6 +252,15 @@ sth_stash* initFont(GLPrimitiveRenderer* primRender)
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
#else//LOAD_FONT_FROM_FILE
|
||||
char* data2 = OpenSansData;
|
||||
unsigned char* data = (unsigned char*) data2;
|
||||
if (!(droidRegular = sth_add_font_from_memory(stash, data)))
|
||||
{
|
||||
printf("error!\n");
|
||||
}
|
||||
|
||||
#endif//LOAD_FONT_FROM_FILE
|
||||
err = glGetError();
|
||||
assert(err==GL_NO_ERROR);
|
||||
|
||||
@@ -327,14 +338,15 @@ void DumpSimulationTime(FILE* f)
|
||||
|
||||
|
||||
}
|
||||
extern const char* g_deviceName;
|
||||
///extern const char* g_deviceName;
|
||||
const char* g_deviceName = "blaat";
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("main start");
|
||||
|
||||
CommandLineArgs args(argc,argv);
|
||||
GpuDemo::ConstructionInfo ci;
|
||||
ParticleDemo::ConstructionInfo ci;
|
||||
|
||||
if (args.CheckCmdLineFlag("help"))
|
||||
{
|
||||
@@ -418,11 +430,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
|
||||
int numItems = sizeof(allDemos)/sizeof(GpuDemo::CreateFunc*);
|
||||
int numItems = sizeof(allDemos)/sizeof(ParticleDemo::CreateFunc*);
|
||||
demoNames.clear();
|
||||
for (int i=0;i<numItems;i++)
|
||||
{
|
||||
GpuDemo* demo = allDemos[i]();
|
||||
ParticleDemo* demo = allDemos[i]();
|
||||
demoNames.push_back(demo->getName());
|
||||
delete demo;
|
||||
}
|
||||
@@ -497,7 +509,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
once=false;
|
||||
|
||||
OpenGL3CoreRenderer render;
|
||||
// OpenGL3CoreRenderer render;
|
||||
|
||||
glClearColor(0,1,0,1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
@@ -514,13 +526,18 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
{
|
||||
GpuDemo* demo = allDemos[selectedDemo]();
|
||||
ParticleDemo* demo = allDemos[selectedDemo]();
|
||||
// demo->myinit();
|
||||
bool useGpu = false;
|
||||
|
||||
|
||||
ci.m_instancingRenderer = render.getInstancingRenderer();
|
||||
render.init();
|
||||
int maxObjectCapacity=128*1024;
|
||||
|
||||
ci.m_instancingRenderer = new GLInstancingRenderer(maxObjectCapacity);//render.getInstancingRenderer();
|
||||
ci.m_instancingRenderer->init();
|
||||
ci.m_instancingRenderer->InitShaders();
|
||||
|
||||
// render.init();
|
||||
|
||||
demo->initPhysics(ci);
|
||||
printf("-----------------------------------------------------\n");
|
||||
@@ -565,7 +582,7 @@ int main(int argc, char* argv[])
|
||||
CProfileManager::Reset();
|
||||
CProfileManager::Increment_Frame_Counter();
|
||||
|
||||
render.reshape(g_OpenGLWidth,g_OpenGLHeight);
|
||||
// render.reshape(g_OpenGLWidth,g_OpenGLHeight);
|
||||
|
||||
window->startRendering();
|
||||
|
||||
|
||||
@@ -34,7 +34,40 @@ function createProject(vendor)
|
||||
"gwenUserInterface.h",
|
||||
"ParticleDemo.cpp",
|
||||
"ParticleDemo.h",
|
||||
|
||||
"../../src/BulletCommon/btAlignedAllocator.cpp",
|
||||
"../../src/BulletCommon/btAlignedAllocator.h",
|
||||
"../../src/BulletCommon/btQuickprof.cpp",
|
||||
"../../src/BulletCommon/btQuickprof.h",
|
||||
"../../src/BulletGeometry/btConvexHullComputer.cpp",
|
||||
"../../src/BulletGeometry/btConvexHullComputer.h",
|
||||
|
||||
"../../btgui/OpenGLWindow/GLInstancingRenderer.cpp",
|
||||
"../../btgui/OpenGLWindow/GLInstancingRenderer.h",
|
||||
"../../btgui/OpenGLWindow/GLPrimitiveRenderer.cpp",
|
||||
"../../btgui/OpenGLWindow/GLPrimitiveRenderer.h",
|
||||
"../../btgui/OpenGLWindow/LoadShader.cpp",
|
||||
"../../btgui/OpenGLWindow/LoadShader.h",
|
||||
"../../btgui/OpenGLWindow/TwFonts.cpp",
|
||||
"../../btgui/OpenGLWindow/TwFonts.h",
|
||||
"../../btgui/OpenGLTrueTypeFont/fontstash.cpp",
|
||||
"../../btgui/OpenGLTrueTypeFont/fontstash.h",
|
||||
"../../btgui/OpenGLTrueTypeFont/opengl_fontstashcallbacks.cpp",
|
||||
"../../btgui/OpenGLTrueTypeFont/opengl_fontstashcallbacks.h",
|
||||
"../../btgui/FontFiles/OpenSans.cpp",
|
||||
"../../opencl/basic_initialize/btOpenCLUtils.cpp",
|
||||
"../../opencl/basic_initialize/btOpenCLUtils.h",
|
||||
"../../opencl/gpu_broadphase/host/btGpuSapBroadphase.cpp",
|
||||
"../../opencl/gpu_sat/host/btConvexUtility.cpp",
|
||||
"../../opencl/gpu_sat/host/ConvexHullContact.cpp",
|
||||
"../../opencl/gpu_sat/host/ConvexHullContact.h",
|
||||
"../../opencl/parallel_primitives/host/btBoundSearchCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/btBoundSearchCL.h",
|
||||
"../../opencl/parallel_primitives/host/btFillCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/btFillCL.h",
|
||||
"../../opencl/parallel_primitives/host/btPrefixScanCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/btPrefixScanCL.h",
|
||||
"../../opencl/parallel_primitives/host/btRadixSort32CL.cpp",
|
||||
"../../opencl/parallel_primitives/host/btRadixSort32CL.h",
|
||||
}
|
||||
|
||||
if os.is("Windows") then
|
||||
|
||||
Reference in New Issue
Block a user