Add loading texture API.

This commit is contained in:
yunfeibai
2016-10-20 23:40:30 -07:00
parent 05be92d006
commit 4911b14271
8 changed files with 82 additions and 35 deletions

View File

@@ -1252,31 +1252,38 @@ void b3GetVisualShapeInformation(b3PhysicsClientHandle physClient, struct b3Visu
}
}
b3SharedMemoryCommandHandle b3InitUpdateVisualShape(b3PhysicsClientHandle physClient)
b3SharedMemoryCommandHandle b3InitLoadTexture(b3PhysicsClientHandle physClient, const char* filename)
{
/*
PhysicsClient* cl = (PhysicsClient* ) physClient;
b3Assert(cl);
b3Assert(cl->canSubmitCommand());
struct SharedMemoryCommand* command = cl->getAvailableSharedMemoryCommand();
b3Assert(command);
command->m_type = CMD_UPDATE_VISUAL_SHAPE;
command->m_updateFlags = 0;
return (b3SharedMemoryCommandHandle) command;
*/
PhysicsClient* cl = (PhysicsClient* ) physClient;
b3Assert(cl);
b3Assert(cl->canSubmitCommand());
struct SharedMemoryCommand* command = cl->getAvailableSharedMemoryCommand();
b3Assert(command);
command->m_type = CMD_UPDATE_VISUAL_SHAPE;
//command->m_requestVisualShapeDataArguments.m_bodyUniqueId = 0;
//command->m_requestVisualShapeDataArguments.m_startingVisualShapeIndex = 0;
command->m_type = CMD_LOAD_TEXTURE;
int len = strlen(filename);
if (len<MAX_FILENAME_LENGTH)
{
strcpy(command->m_loadTextureArguments.m_textureFileName,filename);
} else
{
command->m_loadTextureArguments.m_textureFileName[0] = 0;
}
command->m_updateFlags = 0;
return (b3SharedMemoryCommandHandle) command;
}
b3SharedMemoryCommandHandle b3InitUpdateVisualShape(b3PhysicsClientHandle physClient, int bodyUniqueId, int textureUniqueId)
{
PhysicsClient* cl = (PhysicsClient* ) physClient;
b3Assert(cl);
b3Assert(cl->canSubmitCommand());
struct SharedMemoryCommand* command = cl->getAvailableSharedMemoryCommand();
b3Assert(command);
command->m_type = CMD_UPDATE_VISUAL_SHAPE;
command->m_updateVisualShapeDataArguments.m_bodyUniqueId = bodyUniqueId;
command->m_updateVisualShapeDataArguments.m_textureUniqueId = textureUniqueId;
command->m_updateFlags = 0;
return (b3SharedMemoryCommandHandle) command;
}
b3SharedMemoryCommandHandle b3ApplyExternalForceCommandInit(b3PhysicsClientHandle physClient)