diff --git a/examples/CommonInterfaces/CommonGUIHelperInterface.h b/examples/CommonInterfaces/CommonGUIHelperInterface.h index 323fe103a..3e21a120e 100644 --- a/examples/CommonInterfaces/CommonGUIHelperInterface.h +++ b/examples/CommonInterfaces/CommonGUIHelperInterface.h @@ -43,6 +43,7 @@ struct GUIHelperInterface virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling) = 0; virtual void removeAllGraphicsInstances() = 0; virtual void removeGraphicsInstance(int graphicsUid) {} + virtual void changeInstanceFlags(int instanceUid, int flags) {} virtual void changeRGBAColor(int instanceUid, const double rgbaColor[4]) {} virtual void changeSpecularColor(int instanceUid, const double specularColor[3]) {} virtual void changeTexture(int textureUniqueId, const unsigned char* rgbTexels, int width, int height) {} diff --git a/examples/DeformableDemo/DeformableContact.cpp b/examples/DeformableDemo/DeformableContact.cpp index 850bcebb2..8523e0378 100644 --- a/examples/DeformableDemo/DeformableContact.cpp +++ b/examples/DeformableDemo/DeformableContact.cpp @@ -206,7 +206,11 @@ void DeformableContact::initPhysics() int numInstances = m_guiHelper->getRenderInterface()->getTotalNumInstances(); double rgbaColors[3][4] = { { 1, 0, 0, 1 } , { 0, 1, 0, 1 } ,{ 0, 0, 1, 1 } }; - + for (int i = 0; i < numInstances; i++) + { + m_guiHelper->changeInstanceFlags(i, B3_INSTANCE_DOUBLE_SIDED); + } + } void DeformableContact::exitPhysics() diff --git a/examples/ExampleBrowser/OpenGLGuiHelper.cpp b/examples/ExampleBrowser/OpenGLGuiHelper.cpp index 6f4b7686f..610329425 100644 --- a/examples/ExampleBrowser/OpenGLGuiHelper.cpp +++ b/examples/ExampleBrowser/OpenGLGuiHelper.cpp @@ -380,6 +380,14 @@ void OpenGLGuiHelper::replaceTexture(int shapeIndex, int textureUid) m_data->m_glApp->m_renderer->replaceTexture(shapeIndex, textureUid); }; } +void OpenGLGuiHelper::changeInstanceFlags(int instanceUid, int flags) +{ + if (instanceUid >= 0) + { + //careful, flags/instanceUid is swapped + m_data->m_glApp->m_renderer->writeSingleInstanceFlagsToCPU( flags, instanceUid); + } +} void OpenGLGuiHelper::changeRGBAColor(int instanceUid, const double rgbaColor[4]) { if (instanceUid >= 0) diff --git a/examples/ExampleBrowser/OpenGLGuiHelper.h b/examples/ExampleBrowser/OpenGLGuiHelper.h index e4a43b4be..bdaa22772 100644 --- a/examples/ExampleBrowser/OpenGLGuiHelper.h +++ b/examples/ExampleBrowser/OpenGLGuiHelper.h @@ -27,6 +27,7 @@ struct OpenGLGuiHelper : public GUIHelperInterface virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling); virtual void removeAllGraphicsInstances(); virtual void removeGraphicsInstance(int graphicsUid); + virtual void changeInstanceFlags(int instanceUid, int flags); virtual void changeRGBAColor(int instanceUid, const double rgbaColor[4]); virtual void changeSpecularColor(int instanceUid, const double specularColor[3]); virtual void changeTexture(int textureUniqueId, const unsigned char* rgbTexels, int width, int height);