From 4ed666a72a790abd4ea637ac02f3185de09699a0 Mon Sep 17 00:00:00 2001 From: erwin coumans Date: Wed, 29 Apr 2015 13:21:26 -0700 Subject: [PATCH] fix double-precision compile problem fix profile window (See View/Profiler in ExampleBrowser) --- .../CommonInterfaces/CommonCameraInterface.h | 3 +++ .../ExampleBrowser/OpenGLExampleBrowser.cpp | 19 ++++++++++--------- examples/OpenGLWindow/SimpleCamera.cpp | 15 +++++++++++++++ examples/OpenGLWindow/SimpleCamera.h | 4 ++++ 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/examples/CommonInterfaces/CommonCameraInterface.h b/examples/CommonInterfaces/CommonCameraInterface.h index 9ad70527a..8f0565986 100644 --- a/examples/CommonInterfaces/CommonCameraInterface.h +++ b/examples/CommonInterfaces/CommonCameraInterface.h @@ -9,6 +9,9 @@ struct CommonCameraInterface virtual void getCameraTargetPosition(float pos[3]) const = 0; virtual void getCameraPosition(float pos[3]) const = 0; + virtual void getCameraTargetPosition(double pos[3]) const = 0; + virtual void getCameraPosition(double pos[3]) const = 0; + virtual void setCameraTargetPosition(float x,float y,float z) = 0; virtual void setCameraDistance(float dist) = 0; virtual float getCameraDistance() const = 0; diff --git a/examples/ExampleBrowser/OpenGLExampleBrowser.cpp b/examples/ExampleBrowser/OpenGLExampleBrowser.cpp index ea0b8b3ce..052ce7fc3 100644 --- a/examples/ExampleBrowser/OpenGLExampleBrowser.cpp +++ b/examples/ExampleBrowser/OpenGLExampleBrowser.cpp @@ -34,12 +34,13 @@ #include "ExampleEntries.h" #include "OpenGLGuiHelper.h" #include "LinearMath/btIDebugDraw.h" -CommonGraphicsApp* s_app=0; +static CommonGraphicsApp* s_app=0; -CommonWindowInterface* s_window = 0; -CommonParameterInterface* s_parameterInterface=0; -CommonRenderInterface* s_instancingRenderer=0; -OpenGLGuiHelper* s_guiHelper=0; +static CommonWindowInterface* s_window = 0; +static CommonParameterInterface* s_parameterInterface=0; +static CommonRenderInterface* s_instancingRenderer=0; +static OpenGLGuiHelper* s_guiHelper=0; +static MyProfileWindow* s_profWindow =0; #define DEMO_SELECTION_COMBOBOX 13 const char* startFileName = "bulletDemo.txt"; @@ -606,8 +607,8 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[]) //gui->getInternalData()->pRenderer->setTextureLoader(myTexLoader); - MyProfileWindow* profWindow = setupProfileWindow(gui->getInternalData()); - profileWindowSetVisible(profWindow,false); + s_profWindow= setupProfileWindow(gui->getInternalData()); + profileWindowSetVisible(s_profWindow,false); gui->setFocus(); s_parameterInterface = s_app->m_parameterInterface = new GwenParameterInterface(gui->getInternalData()); @@ -775,8 +776,8 @@ void OpenGLExampleBrowser::update(float deltaTime) static int toggle = 1; if (1) { - //if (!pauseSimulation) - // processProfileData(profWindow,false); + if (!pauseSimulation) + processProfileData(s_profWindow,false); if (sUseOpenGL2) { diff --git a/examples/OpenGLWindow/SimpleCamera.cpp b/examples/OpenGLWindow/SimpleCamera.cpp index d14764231..a01f9499f 100644 --- a/examples/OpenGLWindow/SimpleCamera.cpp +++ b/examples/OpenGLWindow/SimpleCamera.cpp @@ -217,6 +217,21 @@ void SimpleCamera::getCameraViewMatrix(float viewMatrix[16]) const b3CreateLookAt(m_data->m_cameraPosition,m_data->m_cameraTargetPosition,m_data->m_cameraUp,viewMatrix); } +void SimpleCamera::getCameraTargetPosition(double pos[3]) const +{ + pos[0] =m_data->m_cameraTargetPosition[0]; + pos[1] =m_data->m_cameraTargetPosition[1]; + pos[2] =m_data->m_cameraTargetPosition[2]; +} + +void SimpleCamera::getCameraPosition(double pos[3]) const +{ + pos[0] =m_data->m_cameraPosition[0]; + pos[1] =m_data->m_cameraPosition[1]; + pos[2] =m_data->m_cameraPosition[2]; +} + + void SimpleCamera::getCameraTargetPosition(float pos[3]) const { pos[0] =m_data->m_cameraTargetPosition[0]; diff --git a/examples/OpenGLWindow/SimpleCamera.h b/examples/OpenGLWindow/SimpleCamera.h index 5a499e5bf..51a6c3c1b 100644 --- a/examples/OpenGLWindow/SimpleCamera.h +++ b/examples/OpenGLWindow/SimpleCamera.h @@ -17,6 +17,10 @@ struct SimpleCamera : public CommonCameraInterface virtual void getCameraTargetPosition(float pos[3]) const; virtual void getCameraPosition(float pos[3]) const; + virtual void getCameraTargetPosition(double pos[3]) const; + virtual void getCameraPosition(double pos[3]) const; + + virtual void setCameraTargetPosition(float x,float y,float z); virtual void setCameraDistance(float dist); virtual float getCameraDistance() const;