mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-06-08 08:13:55 +00:00
got the data tunnelt with getMeshData
This commit is contained in:
@@ -5678,6 +5678,22 @@ bool PhysicsServerCommandProcessor::processRequestMeshDataCommand(const struct S
|
||||
}
|
||||
bool requestVelocity = clientCmd.m_updateFlags & B3_MESH_DATA_SIMULATION_MESH_VELOCITY;
|
||||
|
||||
|
||||
|
||||
int numTetra = psb->m_tetras.size();
|
||||
int maxNumnumVertecies = bufferSizeInBytes / totalBytesPerVertex - 1;
|
||||
int numVerticesRemaining = numTetra * 4;
|
||||
int verticesCopied = btMin(maxNumnumVertecies, numVerticesRemaining);
|
||||
for (int i = 0; i < verticesCopied; i += 4)
|
||||
{
|
||||
const btSoftBody::Tetra& n = psb->m_tetras[i/4];
|
||||
verticesOut[i].setValue(n.m_n[0]->m_x.x(), n.m_n[0]->m_x.y(), n.m_n[0]->m_x.z());
|
||||
verticesOut[i+1].setValue(n.m_n[1]->m_x.x(), n.m_n[1]->m_x.y(), n.m_n[1]->m_x.z());
|
||||
verticesOut[i+2].setValue(n.m_n[2]->m_x.x(), n.m_n[2]->m_x.y(), n.m_n[2]->m_x.z());
|
||||
verticesOut[i+3].setValue(n.m_n[3]->m_x.x(), n.m_n[3]->m_x.y(), n.m_n[3]->m_x.z());
|
||||
}
|
||||
|
||||
/*
|
||||
int numVertices = separateRenderMesh ? psb->m_renderNodes.size() : psb->m_nodes.size();
|
||||
int maxNumVertices = bufferSizeInBytes / totalBytesPerVertex - 1;
|
||||
int numVerticesRemaining = numVertices - clientCmd.m_requestMeshDataArgs.m_startingVertex;
|
||||
@@ -5704,6 +5720,8 @@ bool PhysicsServerCommandProcessor::processRequestMeshDataCommand(const struct S
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
sizeInBytes = verticesCopied * sizeof(btVector3);
|
||||
serverStatusOut.m_type = CMD_REQUEST_MESH_DATA_COMPLETED;
|
||||
serverStatusOut.m_sendMeshDataArgs.m_numVerticesCopied = verticesCopied;
|
||||
@@ -5729,7 +5747,7 @@ bool PhysicsServerCommandProcessor::processRequestTetraMeshDataCommand(const str
|
||||
InternalBodyHandle* bodyHandle = m_data->m_bodyHandles.getHandle(clientCmd.m_resetTetraMeshDataArgs.m_bodyUniqueId);
|
||||
if (bodyHandle)
|
||||
{
|
||||
int totalBytesPerTetra = sizeof(btVector3) * 4;
|
||||
int totalBytesPerVertex = sizeof(btVector3);
|
||||
btVector3* verticesOut = (btVector3*)bufferServerToClient;
|
||||
const btCollisionShape* colShape = 0;
|
||||
|
||||
@@ -5738,18 +5756,18 @@ bool PhysicsServerCommandProcessor::processRequestTetraMeshDataCommand(const str
|
||||
btSoftBody* psb = bodyHandle->m_softBody;
|
||||
|
||||
int numTetra = psb->m_tetras.size();
|
||||
int maxNumnumVertecies = bufferSizeInBytes / totalBytesPerTetra - 1;
|
||||
int numVerticesRemaining = numTetra * 4 - clientCmd.m_resetTetraMeshDataArgs.m_startingVertex;
|
||||
int maxNumnumVertecies = bufferSizeInBytes / totalBytesPerVertex - 1;
|
||||
int numVerticesRemaining = numTetra * 4;
|
||||
int verticesCopied = btMin(maxNumnumVertecies, numVerticesRemaining);
|
||||
for (int i = 0; i < verticesCopied; i += 4)
|
||||
{
|
||||
const btSoftBody::Tetra& n = psb->m_tetras[i / 4];
|
||||
|
||||
const btSoftBody::Tetra& n = psb->m_tetras[i/4];
|
||||
verticesOut[i].setValue(n.m_n[0]->m_x.x(), n.m_n[0]->m_x.y(), n.m_n[0]->m_x.z());
|
||||
verticesOut[i+1].setValue(n.m_n[1]->m_x.x(), n.m_n[1]->m_x.y(), n.m_n[1]->m_x.z());
|
||||
verticesOut[i+2].setValue(n.m_n[2]->m_x.x(), n.m_n[2]->m_x.y(), n.m_n[2]->m_x.z());
|
||||
verticesOut[i+3].setValue(n.m_n[3]->m_x.x(), n.m_n[3]->m_x.y(), n.m_n[3]->m_x.z());
|
||||
}
|
||||
|
||||
sizeInBytes = verticesCopied * sizeof(btVector3);
|
||||
serverStatusOut.m_type = CMD_REQUEST_TETRA_MESH_DATA_COMPLETED;
|
||||
serverStatusOut.m_sendMeshDataArgs.m_numVerticesCopied = verticesCopied;
|
||||
|
||||
@@ -9202,7 +9202,7 @@ static PyObject* pybullet_getTetraMeshData(PyObject* self, PyObject* args, PyObj
|
||||
|
||||
int physicsClientId = 0;
|
||||
static char* kwlist[] = {"bodyUniqueId", "flags", "physicsClientId", NULL};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "i|iiii", kwlist, &bodyUniqueId, &flags , &physicsClientId))
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "i|iii", kwlist, &bodyUniqueId, &flags , &physicsClientId))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user