Add API to change texture with object id and link index.
This commit is contained in:
@@ -832,6 +832,7 @@ void TinyRendererVisualShapeConverter::resetAll()
|
||||
|
||||
void TinyRendererVisualShapeConverter::activateShapeTexture(int shapeUniqueId, int textureUniqueId)
|
||||
{
|
||||
btAssert(textureUniqueId < m_data->m_textures.size());
|
||||
TinyRendererObjectArray** ptrptr = m_data->m_swRenderInstances.getAtIndex(shapeUniqueId);
|
||||
if (ptrptr && *ptrptr)
|
||||
{
|
||||
@@ -840,6 +841,29 @@ void TinyRendererVisualShapeConverter::activateShapeTexture(int shapeUniqueId, i
|
||||
}
|
||||
}
|
||||
|
||||
void TinyRendererVisualShapeConverter::activateShapeTexture(int objectUniqueId, int jointIndex, int shapeIndex, int textureUniqueId)
|
||||
{
|
||||
int start = -1;
|
||||
//find first one, then count how many
|
||||
for (int i = 0; i < m_data->m_visualShapes.size(); i++)
|
||||
{
|
||||
printf("object id: %d\n", m_data->m_visualShapes[i].m_objectUniqueId);
|
||||
if (m_data->m_visualShapes[i].m_objectUniqueId == objectUniqueId && m_data->m_visualShapes[i].m_linkIndex == jointIndex)
|
||||
{
|
||||
start = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (start >= 0)
|
||||
{
|
||||
if (start + shapeIndex < m_data->m_visualShapes.size())
|
||||
{
|
||||
activateShapeTexture(start + shapeIndex, textureUniqueId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int TinyRendererVisualShapeConverter::registerTexture(unsigned char* texels, int width, int height)
|
||||
{
|
||||
MyTexture2 texData;
|
||||
|
||||
Reference in New Issue
Block a user