MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / processMeshData

Method processMeshData

examples/SharedMemory/PhysicsDirect.cpp:604–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604bool PhysicsDirect::processMeshData(const struct SharedMemoryCommand& orgCommand)
605{
606 SharedMemoryCommand command = orgCommand;
607
608 const SharedMemoryStatus& serverCmd = m_data->m_serverStatus;
609 do
610 {
611 bool hasStatus = m_data->m_commandProcessor->processCommand(command, m_data->m_serverStatus, &m_data->m_bulletStreamDataServerToClient[0], SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE);
612
613 b3Clock clock;
614 double startTime = clock.getTimeInSeconds();
615 double timeOutInSeconds = m_data->m_timeOutInSeconds;
616
617 while ((!hasStatus) && (clock.getTimeInSeconds() - startTime < timeOutInSeconds))
618 {
619 const SharedMemoryStatus* stat = processServerStatus();
620 if (stat)
621 {
622 hasStatus = true;
623 }
624 }
625
626 m_data->m_hasStatus = hasStatus;
627 if (hasStatus)
628 {
629 btAssert(m_data->m_serverStatus.m_type == CMD_REQUEST_MESH_DATA_COMPLETED);
630
631 if (m_data->m_verboseOutput)
632 {
633 b3Printf("Mesh data OK\n");
634 }
635
636 const b3SendMeshDataArgs& args = serverCmd.m_sendMeshDataArgs;
637 int numTotalPixels = args.m_startingVertex +
638 args.m_numVerticesCopied + args.m_numVerticesRemaining;
639
640 btVector3* verticesReceived =
641 (btVector3*)&m_data->m_bulletStreamDataServerToClient[0];
642
643
644 m_data->m_cachedVertexPositions.resize(args.m_startingVertex +
645 args.m_numVerticesCopied);
646
647 for (int i = 0; i < args.m_numVerticesCopied; i++)
648 {
649 m_data->m_cachedVertexPositions[i + args.m_startingVertex].x = verticesReceived[i].x();
650 m_data->m_cachedVertexPositions[i + args.m_startingVertex].y = verticesReceived[i].y();
651 m_data->m_cachedVertexPositions[i + args.m_startingVertex].z = verticesReceived[i].z();
652 m_data->m_cachedVertexPositions[i + args.m_startingVertex].w = verticesReceived[i].w();
653 }
654
655 if (args.m_numVerticesRemaining > 0 && args.m_numVerticesCopied)
656 {
657 m_data->m_hasStatus = false;
658
659 // continue requesting remaining vertices
660 command.m_type = CMD_REQUEST_MESH_DATA;
661 command.m_requestMeshDataArgs.m_startingVertex =

Callers

nothing calls this directly

Calls 7

processCommandMethod · 0.45
getTimeInSecondsMethod · 0.45
resizeMethod · 0.45
xMethod · 0.45
yMethod · 0.45
zMethod · 0.45
wMethod · 0.45

Tested by

no test coverage detected