pass render nodes instead of simulated nodes to renderer
This commit is contained in:
@@ -5055,15 +5055,24 @@ bool PhysicsServerCommandProcessor::processRequestMeshDataCommand(const struct S
|
|||||||
{
|
{
|
||||||
btSoftBody* psb = bodyHandle->m_softBody;
|
btSoftBody* psb = bodyHandle->m_softBody;
|
||||||
int totalBytesPerVertex = sizeof(btVector3);
|
int totalBytesPerVertex = sizeof(btVector3);
|
||||||
int numVertices = psb->m_nodes.size();
|
bool separateRenderMesh = (psb->m_renderNodes.size() != 0);
|
||||||
|
int numVertices = separateRenderMesh ? psb->m_renderNodes.size() : psb->m_nodes.size();
|
||||||
int maxNumVertices = bufferSizeInBytes / totalBytesPerVertex - 1;
|
int maxNumVertices = bufferSizeInBytes / totalBytesPerVertex - 1;
|
||||||
int numVerticesRemaining = numVertices - clientCmd.m_requestMeshDataArgs.m_startingVertex;
|
int numVerticesRemaining = numVertices - clientCmd.m_requestMeshDataArgs.m_startingVertex;
|
||||||
int verticesCopied = btMin(maxNumVertices, numVerticesRemaining);
|
int verticesCopied = btMin(maxNumVertices, numVerticesRemaining);
|
||||||
btVector3* verticesOut = (btVector3*)bufferServerToClient;
|
btVector3* verticesOut = (btVector3*)bufferServerToClient;
|
||||||
for (int i = 0; i < verticesCopied; ++i)
|
for (int i = 0; i < verticesCopied; ++i)
|
||||||
{
|
{
|
||||||
|
if (separateRenderMesh)
|
||||||
|
{
|
||||||
|
const btSoftBody::Node& n = psb->m_renderNodes[i + clientCmd.m_requestMeshDataArgs.m_startingVertex];
|
||||||
|
verticesOut[i] = n.m_x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
const btSoftBody::Node& n = psb->m_nodes[i + clientCmd.m_requestMeshDataArgs.m_startingVertex];
|
const btSoftBody::Node& n = psb->m_nodes[i + clientCmd.m_requestMeshDataArgs.m_startingVertex];
|
||||||
verticesOut[i] = n.m_x;
|
verticesOut[i] = n.m_x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
serverStatusOut.m_type = CMD_REQUEST_MESH_DATA_COMPLETED;
|
serverStatusOut.m_type = CMD_REQUEST_MESH_DATA_COMPLETED;
|
||||||
@@ -7990,7 +7999,7 @@ bool PhysicsServerCommandProcessor::processLoadSoftBodyCommand(const struct Shar
|
|||||||
|
|
||||||
{
|
{
|
||||||
btSoftBody* psb = NULL;
|
btSoftBody* psb = NULL;
|
||||||
btScalar spring_elastic_stiffness, spring_damping_stiffness;
|
|
||||||
|
|
||||||
CommonFileIOInterface* fileIO(m_data->m_pluginManager.getFileIOInterface());
|
CommonFileIOInterface* fileIO(m_data->m_pluginManager.getFileIOInterface());
|
||||||
char relativeFileName[1024];
|
char relativeFileName[1024];
|
||||||
@@ -8052,6 +8061,7 @@ bool PhysicsServerCommandProcessor::processLoadSoftBodyCommand(const struct Shar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef SKIP_DEFORMABLE_BODY
|
#ifndef SKIP_DEFORMABLE_BODY
|
||||||
|
btScalar spring_elastic_stiffness, spring_damping_stiffness;
|
||||||
if (clientCmd.m_updateFlags & LOAD_SOFT_BODY_ADD_MASS_SPRING_FORCE)
|
if (clientCmd.m_updateFlags & LOAD_SOFT_BODY_ADD_MASS_SPRING_FORCE)
|
||||||
{
|
{
|
||||||
spring_elastic_stiffness = clientCmd.m_loadSoftBodyArguments.m_springElasticStiffness;
|
spring_elastic_stiffness = clientCmd.m_loadSoftBodyArguments.m_springElasticStiffness;
|
||||||
@@ -8097,6 +8107,10 @@ bool PhysicsServerCommandProcessor::processLoadSoftBodyCommand(const struct Shar
|
|||||||
btSoftBodyHelpers::readRenderMeshFromObj(out_found_filename.c_str(), psb);
|
btSoftBodyHelpers::readRenderMeshFromObj(out_found_filename.c_str(), psb);
|
||||||
btSoftBodyHelpers::interpolateBarycentricWeights(psb);
|
btSoftBodyHelpers::interpolateBarycentricWeights(psb);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
psb->m_renderNodes.resize(0);
|
||||||
|
}
|
||||||
btVector3 gravity = m_data->m_dynamicsWorld->getGravity();
|
btVector3 gravity = m_data->m_dynamicsWorld->getGravity();
|
||||||
if (clientCmd.m_updateFlags & LOAD_SOFT_BODY_ADD_GRAVITY_FORCE)
|
if (clientCmd.m_updateFlags & LOAD_SOFT_BODY_ADD_GRAVITY_FORCE)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user