diff --git a/build3/premake4.lua b/build3/premake4.lua index 6534013b3..c4ef1e4e8 100644 --- a/build3/premake4.lua +++ b/build3/premake4.lua @@ -45,6 +45,13 @@ description = "Try to link and use system X11 headers instead of dynamically loading X11 (dlopen is default)" } + newoption + { + trigger = "enable_static_vr_plugin", + description = "Statically link vr plugin (in examples/SharedMemory/plugins/vrSyncPlugin)" + } + + newoption { trigger = "noopengl3", @@ -276,6 +283,11 @@ end if not _OPTIONS["glfw_lib_name"] then _OPTIONS["glfw_lib_name"] = default_glfw_lib_name end + + if (_OPTIONS["enable_static_vr_plugin"]) then + defines("STATIC_LINK_VR_PLUGIN") + end + newoption { trigger = "glfw_include_dir", diff --git a/build_visual_studio_vr_pybullet_double.bat b/build_visual_studio_vr_pybullet_double.bat index 9dee15a2e..c98d916b2 100644 --- a/build_visual_studio_vr_pybullet_double.bat +++ b/build_visual_studio_vr_pybullet_double.bat @@ -17,7 +17,8 @@ del tmp1234.txt cd build3 -premake4 --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010 + +premake4 --double --midi --enable_static_vr_plugin --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010 #premake4 --serial --audio --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010 diff --git a/examples/ExampleBrowser/premake4.lua b/examples/ExampleBrowser/premake4.lua index 5aa3b15b5..0e77672a8 100644 --- a/examples/ExampleBrowser/premake4.lua +++ b/examples/ExampleBrowser/premake4.lua @@ -175,6 +175,11 @@ if (hasCL and findOpenGL3()) then "../OpenCL/rigidbody/GpuRigidBodyDemo.cpp", } end + +if (_OPTIONS["enable_static_vr_plugin"]) then + files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end + if os.is("Linux") then initX11() end diff --git a/examples/Importers/ImportObjDemo/ImportObjExample.cpp b/examples/Importers/ImportObjDemo/ImportObjExample.cpp index e049f5f0f..6c4ece7e2 100644 --- a/examples/Importers/ImportObjDemo/ImportObjExample.cpp +++ b/examples/Importers/ImportObjDemo/ImportObjExample.cpp @@ -65,9 +65,9 @@ int loadAndRegisterMeshFromFile2(const std::string& fileName, CommonRenderInterf { int textureIndex = -1; - if (meshData.m_textureImage) + if (meshData.m_textureImage1) { - textureIndex = renderer->registerTexture(meshData.m_textureImage,meshData.m_textureWidth,meshData.m_textureHeight); + textureIndex = renderer->registerTexture(meshData.m_textureImage1,meshData.m_textureWidth,meshData.m_textureHeight); } shapeId = renderer->registerShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0], @@ -77,7 +77,10 @@ int loadAndRegisterMeshFromFile2(const std::string& fileName, CommonRenderInterf B3_GL_TRIANGLES, textureIndex); delete meshData.m_gfxShape; - delete meshData.m_textureImage; + if (!meshData.m_isCached) + { + delete meshData.m_textureImage1; + } } return shapeId; } diff --git a/examples/RenderingExamples/TinyRendererSetup.cpp b/examples/RenderingExamples/TinyRendererSetup.cpp index a896552ac..64fa77f14 100644 --- a/examples/RenderingExamples/TinyRendererSetup.cpp +++ b/examples/RenderingExamples/TinyRendererSetup.cpp @@ -169,9 +169,9 @@ TinyRendererSetup::TinyRendererSetup(struct GUIHelperInterface* gui) { int textureIndex = -1; - if (meshData.m_textureImage) + if (meshData.m_textureImage1) { - textureIndex = m_guiHelper->getRenderInterface()->registerTexture(meshData.m_textureImage,meshData.m_textureWidth,meshData.m_textureHeight); + textureIndex = m_guiHelper->getRenderInterface()->registerTexture(meshData.m_textureImage1,meshData.m_textureWidth,meshData.m_textureHeight); } shapeId = m_guiHelper->getRenderInterface()->registerShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0], @@ -205,7 +205,7 @@ TinyRendererSetup::TinyRendererSetup(struct GUIHelperInterface* gui) ob->registerMeshShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0], meshData.m_gfxShape->m_numvertices, indices, - meshData.m_gfxShape->m_numIndices,color, meshData.m_textureImage,meshData.m_textureWidth,meshData.m_textureHeight); + meshData.m_gfxShape->m_numIndices,color, meshData.m_textureImage1,meshData.m_textureWidth,meshData.m_textureHeight); ob->m_localScaling.setValue(scaling[0],scaling[1],scaling[2]); @@ -214,7 +214,10 @@ TinyRendererSetup::TinyRendererSetup(struct GUIHelperInterface* gui) delete meshData.m_gfxShape; - delete meshData.m_textureImage; + if (!meshData.m_isCached) + { + delete meshData.m_textureImage1; + } } } } diff --git a/examples/RobotSimulator/premake4.lua b/examples/RobotSimulator/premake4.lua index 368fefd1f..27a1a4e56 100644 --- a/examples/RobotSimulator/premake4.lua +++ b/examples/RobotSimulator/premake4.lua @@ -197,6 +197,11 @@ if not _OPTIONS["no-enet"] then "MinitaurSetup.h", myfiles } + +if (_OPTIONS["enable_static_vr_plugin"]) then + files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end + if os.is("Linux") then initX11() end @@ -280,6 +285,11 @@ project ("App_VRGloveHandSimulator") "b3RobotSimulatorClientAPI.h", myfiles } + +if (_OPTIONS["enable_static_vr_plugin"]) then + files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end + if os.is("Linux") then initX11() end diff --git a/examples/SharedMemory/premake4.lua b/examples/SharedMemory/premake4.lua index f7c004b1e..add34d2fc 100644 --- a/examples/SharedMemory/premake4.lua +++ b/examples/SharedMemory/premake4.lua @@ -104,11 +104,16 @@ myfiles = } + files { myfiles, "main.cpp", } +if (_OPTIONS["enable_static_vr_plugin"]) then + files {"plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end + files { "../MultiThreading/b3ThreadSupportInterface.cpp", @@ -202,6 +207,10 @@ files { "../ExampleBrowser/GL_ShapeDrawer.cpp", "../ExampleBrowser/CollisionShape2TriangleMesh.cpp", } +if (_OPTIONS["enable_static_vr_plugin"]) then + files {"plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end + if os.is("Linux") then initX11() end @@ -353,6 +362,10 @@ if os.is("Windows") then "../ThirdPartyLibs/openvr/samples/shared/pathtools.h", "../ThirdPartyLibs/openvr/samples/shared/Vectors.h", } +if (_OPTIONS["enable_static_vr_plugin"]) then + files {"plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end + if os.is("Windows") then configuration {"x32"} libdirs {"../ThirdPartyLibs/openvr/lib/win32"} diff --git a/examples/pybullet/premake4.lua b/examples/pybullet/premake4.lua index a67b7d8b8..2fef56aa8 100644 --- a/examples/pybullet/premake4.lua +++ b/examples/pybullet/premake4.lua @@ -155,6 +155,11 @@ if not _OPTIONS["no-enet"] then "../../examples/MultiThreading/b3Win32ThreadSupport.cpp", "../../examples/MultiThreading/b3ThreadSupportInterface.cpp", } + +if (_OPTIONS["enable_static_plugins"]) then + files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end + includedirs { _OPTIONS["python_include_dir"], diff --git a/test/SharedMemory/premake4.lua b/test/SharedMemory/premake4.lua index 85b74ccfb..9eb1bb54c 100644 --- a/test/SharedMemory/premake4.lua +++ b/test/SharedMemory/premake4.lua @@ -226,6 +226,10 @@ project ("Test_PhysicsServerLoopBack") "../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp", "../../examples/ThirdPartyLibs/stb_image/stb_image.cpp", } + +if (_OPTIONS["enable_static_plugins"]) then + files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end project ("Test_PhysicsServerDirect") @@ -306,7 +310,9 @@ project ("Test_PhysicsServerLoopBack") "../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp", "../../examples/ThirdPartyLibs/stb_image/stb_image.cpp", } - +if (_OPTIONS["enable_static_plugins"]) then + files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end project ("Test_PhysicsServerInProcessExampleBrowser") @@ -414,6 +420,10 @@ project ("Test_PhysicsServerInProcessExampleBrowser") "../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp", "../../examples/ThirdPartyLibs/stb_image/stb_image.cpp", } +if (_OPTIONS["enable_static_vr_plugin"]) then + files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"} +end + if os.is("Linux") then initX11() end