From 85db288a956468115271caaaf89907d29fd971c9 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Mon, 30 Apr 2018 23:01:15 +0200 Subject: [PATCH] App_PhysicsServer_SharedMemory_VR: expose max_num_object_capacity and max_shape_capacity_in_bytes (and shared_memory_key) Default values are: int maxNumObjectCapacity = 128 * 1024; int maxShapeCapacityInBytes = 128 * 1024 * 1024; int shared_memory_key = -1 --- examples/OpenGLWindow/SimpleOpenGL3App.cpp | 4 ++-- examples/OpenGLWindow/SimpleOpenGL3App.h | 3 ++- examples/StandaloneMain/hellovr_opengl_main.cpp | 17 ++++++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/examples/OpenGLWindow/SimpleOpenGL3App.cpp b/examples/OpenGLWindow/SimpleOpenGL3App.cpp index 3f97826e4..8fa8ad554 100644 --- a/examples/OpenGLWindow/SimpleOpenGL3App.cpp +++ b/examples/OpenGLWindow/SimpleOpenGL3App.cpp @@ -295,7 +295,7 @@ static void printGLString(const char *name, GLenum s) { bool sOpenGLVerbose = true; -SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, bool allowRetina) +SimpleOpenGL3App::SimpleOpenGL3App(const char* title, int width, int height, bool allowRetina, int maxNumObjectCapacity, int maxShapeCapacityInBytes) { gApp = this; @@ -369,7 +369,7 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, boo b3Assert(glGetError() ==GL_NO_ERROR); - m_instancingRenderer = new GLInstancingRenderer(128*1024,128*1024*1024); + m_instancingRenderer = new GLInstancingRenderer(maxNumObjectCapacity, maxShapeCapacityInBytes); m_primRenderer = new GLPrimitiveRenderer(width,height); diff --git a/examples/OpenGLWindow/SimpleOpenGL3App.h b/examples/OpenGLWindow/SimpleOpenGL3App.h index 9a1621350..be7e943e0 100644 --- a/examples/OpenGLWindow/SimpleOpenGL3App.h +++ b/examples/OpenGLWindow/SimpleOpenGL3App.h @@ -16,7 +16,8 @@ struct SimpleOpenGL3App : public CommonGraphicsApp class GLInstancingRenderer* m_instancingRenderer; virtual void setBackgroundColor(float red, float green, float blue); - SimpleOpenGL3App(const char* title, int width,int height, bool allowRetina=true); + SimpleOpenGL3App(const char* title, int width,int height, bool allowRetina=true, int maxNumObjectCapacity = 128 * 1024, int maxShapeCapacityInBytes = 128 * 1024 * 1024); + virtual ~SimpleOpenGL3App(); virtual int registerCubeShape(float halfExtentsX=1.f,float halfExtentsY=1.f, float halfExtentsZ = 1.f, int textureIndex = -1, float textureScaling = 1); diff --git a/examples/StandaloneMain/hellovr_opengl_main.cpp b/examples/StandaloneMain/hellovr_opengl_main.cpp index c3edbcdf8..f1e72ea24 100644 --- a/examples/StandaloneMain/hellovr_opengl_main.cpp +++ b/examples/StandaloneMain/hellovr_opengl_main.cpp @@ -28,9 +28,12 @@ #include "LinearMath/btIDebugDraw.h" int gSharedMemoryKey = -1; -int gDebugDrawFlags = 0; -bool gDisplayDistortion = false; -bool gDisableDesktopGL = false; +static int gDebugDrawFlags = 0; +static bool gDisplayDistortion = false; +static bool gDisableDesktopGL = false; + +static int maxNumObjectCapacity = 128 * 1024; +static int maxShapeCapacityInBytes = 128 * 1024 * 1024; #include @@ -477,7 +480,8 @@ bool CMainApplication::BInit() SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG ); */ - m_app = new SimpleOpenGL3App("SimpleOpenGL3App",m_nWindowWidth,m_nWindowHeight,true); + + m_app = new SimpleOpenGL3App("SimpleOpenGL3App",m_nWindowWidth,m_nWindowHeight,true, maxNumObjectCapacity, maxShapeCapacityInBytes); sGuiPtr = new OpenGLGuiHelper(m_app,false); @@ -2354,7 +2358,10 @@ int main(int argc, char *argv[]) b3ChromeUtilsEnableProfiling(); } - + args.GetCmdLineArgument("max_num_object_capacity", maxNumObjectCapacity); + args.GetCmdLineArgument("max_shape_capacity_in_bytes", maxShapeCapacityInBytes); + args.GetCmdLineArgument("shared_memory_key", gSharedMemoryKey); + #ifdef BT_USE_CUSTOM_PROFILER b3SetCustomEnterProfileZoneFunc(dcEnter); b3SetCustomLeaveProfileZoneFunc(dcLeave);