fixes in pybullet.loadTexture, changeVisualShape replacing texture.
(also works for OpenGL3 renderer now)
This commit is contained in:
@@ -392,6 +392,15 @@ GLInstancingRenderer::~GLInstancingRenderer()
|
||||
|
||||
|
||||
|
||||
int GLInstancingRenderer::getShapeIndexFromInstance(int srcIndex)
|
||||
{
|
||||
b3PublicGraphicsInstance* pg = m_data->m_publicGraphicsInstances.getHandle(srcIndex);
|
||||
if (pg)
|
||||
{
|
||||
return pg->m_shapeIndex;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -955,6 +964,17 @@ int GLInstancingRenderer::registerTexture(const unsigned char* texels, int width
|
||||
}
|
||||
|
||||
|
||||
void GLInstancingRenderer::replaceTexture(int shapeIndex, int textureId)
|
||||
{
|
||||
if (shapeIndex >=0 && shapeIndex < m_data->m_textureHandles.size())
|
||||
{
|
||||
b3GraphicsInstance* gfxObj = m_graphicsInstances[shapeIndex];
|
||||
if (textureId>=0)
|
||||
{
|
||||
gfxObj->m_texturehandle = m_data->m_textureHandles[textureId].m_glTexture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GLInstancingRenderer::updateTexture(int textureIndex, const unsigned char* texels, bool flipPixelsY)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,8 @@ public:
|
||||
virtual int registerTexture(const unsigned char* texels, int width, int height, bool flipPixelsY=true);
|
||||
virtual void updateTexture(int textureIndex, const unsigned char* texels, bool flipPixelsY=true);
|
||||
virtual void activateTexture(int textureIndex);
|
||||
|
||||
virtual void replaceTexture(int shapeIndex, int textureId);
|
||||
virtual int getShapeIndexFromInstance(int srcIndex);
|
||||
|
||||
///position x,y,z, quaternion x,y,z,w, color r,g,b,a, scaling x,y,z
|
||||
virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling);
|
||||
|
||||
Reference in New Issue
Block a user