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

Method processVisualShapeData

examples/SharedMemory/PhysicsDirect.cpp:352–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352bool PhysicsDirect::processVisualShapeData(const struct SharedMemoryCommand& orgCommand)
353{
354 SharedMemoryCommand command = orgCommand;
355 const SharedMemoryStatus& serverCmd = m_data->m_serverStatus;
356
357 do
358 {
359 bool hasStatus = m_data->m_commandProcessor->processCommand(command, m_data->m_serverStatus, &m_data->m_bulletStreamDataServerToClient[0], SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE);
360
361 b3Clock clock;
362 double startTime = clock.getTimeInSeconds();
363 double timeOutInSeconds = m_data->m_timeOutInSeconds;
364
365 while ((!hasStatus) && (clock.getTimeInSeconds() - startTime < timeOutInSeconds))
366 {
367 const SharedMemoryStatus* stat = processServerStatus();
368 if (stat)
369 {
370 hasStatus = true;
371 }
372 }
373
374 m_data->m_hasStatus = hasStatus;
375 if (hasStatus)
376 {
377 if (m_data->m_verboseOutput)
378 {
379 b3Printf("Visual Shape Information Request OK\n");
380 }
381 int startVisualShapeIndex = serverCmd.m_sendVisualShapeArgs.m_startingVisualShapeIndex;
382 int numVisualShapesCopied = serverCmd.m_sendVisualShapeArgs.m_numVisualShapesCopied;
383 m_data->m_cachedVisualShapes.resize(startVisualShapeIndex + numVisualShapesCopied);
384 b3VisualShapeData* shapeData = (b3VisualShapeData*)&m_data->m_bulletStreamDataServerToClient[0];
385 for (int i = 0; i < numVisualShapesCopied; i++)
386 {
387 m_data->m_cachedVisualShapes[startVisualShapeIndex + i] = shapeData[i];
388 }
389
390 if (serverCmd.m_sendVisualShapeArgs.m_numRemainingVisualShapes > 0 && serverCmd.m_sendVisualShapeArgs.m_numVisualShapesCopied)
391 {
392 m_data->m_hasStatus = false;
393
394 command.m_type = CMD_REQUEST_VISUAL_SHAPE_INFO;
395 command.m_requestVisualShapeDataArguments.m_startingVisualShapeIndex = serverCmd.m_sendVisualShapeArgs.m_startingVisualShapeIndex + serverCmd.m_sendVisualShapeArgs.m_numVisualShapesCopied;
396 command.m_requestVisualShapeDataArguments.m_bodyUniqueId = serverCmd.m_sendVisualShapeArgs.m_bodyUniqueId;
397 }
398 }
399 } while (serverCmd.m_sendVisualShapeArgs.m_numRemainingVisualShapes > 0 && serverCmd.m_sendVisualShapeArgs.m_numVisualShapesCopied);
400
401 return m_data->m_hasStatus;
402}
403
404bool PhysicsDirect::processOverlappingObjects(const struct SharedMemoryCommand& orgCommand)
405{

Callers

nothing calls this directly

Calls 3

processCommandMethod · 0.45
getTimeInSecondsMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected