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
This commit is contained in:
Erwin Coumans
2018-04-30 23:01:15 +02:00
parent 552cb5852a
commit 85db288a95
3 changed files with 16 additions and 8 deletions

View File

@@ -295,7 +295,7 @@ static void printGLString(const char *name, GLenum s) {
bool sOpenGLVerbose = true; 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; gApp = this;
@@ -369,7 +369,7 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, boo
b3Assert(glGetError() ==GL_NO_ERROR); 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); m_primRenderer = new GLPrimitiveRenderer(width,height);

View File

@@ -16,7 +16,8 @@ struct SimpleOpenGL3App : public CommonGraphicsApp
class GLInstancingRenderer* m_instancingRenderer; class GLInstancingRenderer* m_instancingRenderer;
virtual void setBackgroundColor(float red, float green, float blue); 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 ~SimpleOpenGL3App();
virtual int registerCubeShape(float halfExtentsX=1.f,float halfExtentsY=1.f, float halfExtentsZ = 1.f, int textureIndex = -1, float textureScaling = 1); virtual int registerCubeShape(float halfExtentsX=1.f,float halfExtentsY=1.f, float halfExtentsZ = 1.f, int textureIndex = -1, float textureScaling = 1);

View File

@@ -28,9 +28,12 @@
#include "LinearMath/btIDebugDraw.h" #include "LinearMath/btIDebugDraw.h"
int gSharedMemoryKey = -1; int gSharedMemoryKey = -1;
int gDebugDrawFlags = 0; static int gDebugDrawFlags = 0;
bool gDisplayDistortion = false; static bool gDisplayDistortion = false;
bool gDisableDesktopGL = false; static bool gDisableDesktopGL = false;
static int maxNumObjectCapacity = 128 * 1024;
static int maxShapeCapacityInBytes = 128 * 1024 * 1024;
#include <stdio.h> #include <stdio.h>
@@ -477,7 +480,8 @@ bool CMainApplication::BInit()
SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG ); 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); sGuiPtr = new OpenGLGuiHelper(m_app,false);
@@ -2354,7 +2358,10 @@ int main(int argc, char *argv[])
b3ChromeUtilsEnableProfiling(); 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 #ifdef BT_USE_CUSTOM_PROFILER
b3SetCustomEnterProfileZoneFunc(dcEnter); b3SetCustomEnterProfileZoneFunc(dcEnter);
b3SetCustomLeaveProfileZoneFunc(dcLeave); b3SetCustomLeaveProfileZoneFunc(dcLeave);