expose the double sided flag

This commit is contained in:
Erwin Coumans 2019-11-12 20:36:20 -08:00
parent 9ca957387f
commit cabef63b1c
4 changed files with 15 additions and 1 deletions

View File

@ -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) {}

View File

@ -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()

View File

@ -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)

View File

@ -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);