RemoteGUIHelper.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. #include "RemoteGUIHelper.h"
  2. #include "../CommonInterfaces/CommonExampleInterface.h"
  3. #include "../CommonInterfaces/CommonGUIHelperInterface.h"
  4. #include "Bullet3Common/b3Logging.h"
  5. #include "GraphicsSharedMemoryCommands.h"
  6. #include "PosixSharedMemory.h"
  7. #include "Win32SharedMemory.h"
  8. #include "GraphicsSharedMemoryBlock.h"
  9. #include "Bullet3Common/b3Scalar.h"
  10. #include "LinearMath/btMinMax.h"
  11. #include "BulletCollision/CollisionDispatch/btCollisionObject.h"
  12. #include "BulletCollision/CollisionShapes/btCollisionShape.h"
  13. #include "Bullet3Common/b3AlignedObjectArray.h"
  14. #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
  15. struct RemoteGUIHelperInternalData
  16. {
  17. // GUIHelperInterface* m_guiHelper;
  18. bool m_waitingForServer;
  19. GraphicsSharedMemoryBlock* m_testBlock1;
  20. SharedMemoryInterface* m_sharedMemory;
  21. GraphicsSharedMemoryStatus m_lastServerStatus;
  22. int m_sharedMemoryKey;
  23. bool m_isConnected;
  24. RemoteGUIHelperInternalData()
  25. : m_waitingForServer(false),
  26. m_testBlock1(0)
  27. {
  28. #ifdef _WIN32
  29. m_sharedMemory = new Win32SharedMemoryClient();
  30. #else
  31. m_sharedMemory = new PosixSharedMemory();
  32. #endif
  33. m_sharedMemoryKey = GRAPHICS_SHARED_MEMORY_KEY;
  34. m_isConnected = false;
  35. connect();
  36. }
  37. virtual ~RemoteGUIHelperInternalData()
  38. {
  39. disconnect();
  40. delete m_sharedMemory;
  41. }
  42. virtual bool isConnected()
  43. {
  44. return m_isConnected;
  45. }
  46. bool canSubmitCommand() const
  47. {
  48. if (m_isConnected && !m_waitingForServer)
  49. {
  50. if (m_testBlock1->m_magicId == GRAPHICS_SHARED_MEMORY_MAGIC_NUMBER)
  51. {
  52. return true;
  53. }
  54. else
  55. {
  56. return false;
  57. }
  58. }
  59. return false;
  60. }
  61. struct GraphicsSharedMemoryCommand* getAvailableSharedMemoryCommand()
  62. {
  63. static int sequence = 0;
  64. if (m_testBlock1)
  65. {
  66. m_testBlock1->m_clientCommands[0].m_sequenceNumber = sequence++;
  67. return &m_testBlock1->m_clientCommands[0];
  68. }
  69. return 0;
  70. }
  71. bool submitClientCommand(const GraphicsSharedMemoryCommand& command)
  72. {
  73. /// at the moment we allow a maximum of 1 outstanding command, so we check for this
  74. // once the server processed the command and returns a status, we clear the flag
  75. // "m_data->m_waitingForServer" and allow submitting the next command
  76. btAssert(!m_waitingForServer);
  77. if (!m_waitingForServer)
  78. {
  79. //printf("submit command of type %d\n", command.m_type);
  80. if (&m_testBlock1->m_clientCommands[0] != &command)
  81. {
  82. m_testBlock1->m_clientCommands[0] = command;
  83. }
  84. m_testBlock1->m_numClientCommands++;
  85. m_waitingForServer = true;
  86. return true;
  87. }
  88. return false;
  89. }
  90. const GraphicsSharedMemoryStatus* processServerStatus()
  91. {
  92. // SharedMemoryStatus* stat = 0;
  93. if (!m_testBlock1)
  94. {
  95. m_lastServerStatus.m_type = GFX_CMD_SHARED_MEMORY_NOT_INITIALIZED;
  96. return &m_lastServerStatus;
  97. }
  98. if (!m_waitingForServer)
  99. {
  100. return 0;
  101. }
  102. if (m_testBlock1->m_magicId != GRAPHICS_SHARED_MEMORY_MAGIC_NUMBER)
  103. {
  104. m_lastServerStatus.m_type = GFX_CMD_SHARED_MEMORY_NOT_INITIALIZED;
  105. return &m_lastServerStatus;
  106. }
  107. if (m_testBlock1->m_numServerCommands >
  108. m_testBlock1->m_numProcessedServerCommands)
  109. {
  110. B3_PROFILE("processServerCMD");
  111. b3Assert(m_testBlock1->m_numServerCommands ==
  112. m_testBlock1->m_numProcessedServerCommands + 1);
  113. const GraphicsSharedMemoryStatus& serverCmd = m_testBlock1->m_serverCommands[0];
  114. m_lastServerStatus = serverCmd;
  115. // EnumSharedMemoryServerStatus s = (EnumSharedMemoryServerStatus)serverCmd.m_type;
  116. // consume the command
  117. switch (serverCmd.m_type)
  118. {
  119. case GFX_CMD_CLIENT_COMMAND_COMPLETED:
  120. {
  121. B3_PROFILE("CMD_CLIENT_COMMAND_COMPLETED");
  122. break;
  123. }
  124. default:
  125. {
  126. }
  127. }
  128. m_testBlock1->m_numProcessedServerCommands++;
  129. // we don't have more than 1 command outstanding (in total, either server or client)
  130. b3Assert(m_testBlock1->m_numProcessedServerCommands ==
  131. m_testBlock1->m_numServerCommands);
  132. if (m_testBlock1->m_numServerCommands ==
  133. m_testBlock1->m_numProcessedServerCommands)
  134. {
  135. m_waitingForServer = false;
  136. }
  137. else
  138. {
  139. m_waitingForServer = true;
  140. }
  141. return &m_lastServerStatus;
  142. }
  143. return 0;
  144. }
  145. bool connect()
  146. {
  147. /// server always has to create and initialize shared memory
  148. bool allowCreation = false;
  149. m_testBlock1 = (GraphicsSharedMemoryBlock*)m_sharedMemory->allocateSharedMemory(
  150. m_sharedMemoryKey, GRAPHICS_SHARED_MEMORY_SIZE, allowCreation);
  151. if (m_testBlock1)
  152. {
  153. if (m_testBlock1->m_magicId != GRAPHICS_SHARED_MEMORY_MAGIC_NUMBER)
  154. {
  155. b3Error("Error connecting to shared memory: please start server before client\n");
  156. m_sharedMemory->releaseSharedMemory(m_sharedMemoryKey,
  157. GRAPHICS_SHARED_MEMORY_SIZE);
  158. m_testBlock1 = 0;
  159. return false;
  160. }
  161. else
  162. {
  163. m_isConnected = true;
  164. }
  165. }
  166. else
  167. {
  168. b3Warning("Cannot connect to shared memory");
  169. return false;
  170. }
  171. return true;
  172. }
  173. void disconnect()
  174. {
  175. if (m_isConnected && m_sharedMemory)
  176. {
  177. m_sharedMemory->releaseSharedMemory(m_sharedMemoryKey, GRAPHICS_SHARED_MEMORY_SIZE);
  178. }
  179. m_isConnected = false;
  180. }
  181. };
  182. RemoteGUIHelper::RemoteGUIHelper()
  183. {
  184. m_data = new RemoteGUIHelperInternalData;
  185. if (m_data->canSubmitCommand())
  186. {
  187. removeAllGraphicsInstances();
  188. }
  189. }
  190. RemoteGUIHelper::~RemoteGUIHelper()
  191. {
  192. delete m_data;
  193. }
  194. bool RemoteGUIHelper::isConnected() const
  195. {
  196. return m_data->isConnected();
  197. }
  198. void RemoteGUIHelper::setVisualizerFlag(int flag, int enable)
  199. {
  200. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  201. if (cmd)
  202. {
  203. cmd->m_updateFlags = 0;
  204. cmd->m_visualizerFlagCommand.m_visualizerFlag = flag;
  205. cmd->m_visualizerFlagCommand.m_enable = enable;
  206. cmd->m_type = GFX_CMD_SET_VISUALIZER_FLAG;
  207. m_data->submitClientCommand(*cmd);
  208. }
  209. const GraphicsSharedMemoryStatus* status = 0;
  210. while ((status = m_data->processServerStatus()) == 0)
  211. {
  212. }
  213. }
  214. void RemoteGUIHelper::createRigidBodyGraphicsObject(btRigidBody* body, const btVector3& color)
  215. {
  216. printf("createRigidBodyGraphicsObject\n");
  217. }
  218. bool RemoteGUIHelper::getCameraInfo(int* width, int* height, float viewMatrix[16], float projectionMatrix[16], float camUp[3], float camForward[3], float hor[3], float vert[3], float* yaw, float* pitch, float* camDist, float camTarget[3]) const
  219. {
  220. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  221. if (cmd)
  222. {
  223. cmd->m_updateFlags = 0;
  224. cmd->m_type = GFX_CMD_GET_CAMERA_INFO;
  225. m_data->submitClientCommand(*cmd);
  226. }
  227. const GraphicsSharedMemoryStatus* status = 0;
  228. while ((status = m_data->processServerStatus()) == 0)
  229. {
  230. }
  231. if (status->m_type == GFX_CMD_GET_CAMERA_INFO_COMPLETED)
  232. {
  233. *width = status->m_getCameraInfoStatus.width;
  234. *height = status->m_getCameraInfoStatus.height;
  235. for (int i = 0; i < 16; i++)
  236. {
  237. viewMatrix[i] = status->m_getCameraInfoStatus.viewMatrix[i];
  238. projectionMatrix[i] = status->m_getCameraInfoStatus.projectionMatrix[i];
  239. }
  240. for (int i = 0; i < 3; i++)
  241. {
  242. camUp[i] = status->m_getCameraInfoStatus.camUp[i];
  243. camForward[i] = status->m_getCameraInfoStatus.camForward[i];
  244. hor[i] = status->m_getCameraInfoStatus.hor[i];
  245. vert[i] = status->m_getCameraInfoStatus.vert[i];
  246. camTarget[i] = status->m_getCameraInfoStatus.camTarget[i];
  247. }
  248. *yaw = status->m_getCameraInfoStatus.yaw;
  249. *pitch = status->m_getCameraInfoStatus.pitch;
  250. *camDist = status->m_getCameraInfoStatus.camDist;
  251. return true;
  252. }
  253. return false;
  254. }
  255. void RemoteGUIHelper::createCollisionObjectGraphicsObject(btCollisionObject* body, const btVector3& color)
  256. {
  257. if (body->getUserIndex() < 0)
  258. {
  259. btCollisionShape* shape = body->getCollisionShape();
  260. btTransform startTransform = body->getWorldTransform();
  261. int graphicsShapeId = shape->getUserIndex();
  262. if (graphicsShapeId >= 0)
  263. {
  264. // btAssert(graphicsShapeId >= 0);
  265. //the graphics shape is already scaled
  266. float localScaling[4] = {1.f, 1.f, 1.f, 1.f};
  267. float colorRGBA[4] = {(float)color[0], (float)color[1], (float)color[2], (float)color[3]};
  268. float pos[4] = {(float)startTransform.getOrigin()[0], (float)startTransform.getOrigin()[1], (float)startTransform.getOrigin()[2], (float)startTransform.getOrigin()[3]};
  269. float orn[4] = {(float)startTransform.getRotation()[0], (float)startTransform.getRotation()[1], (float)startTransform.getRotation()[2], (float)startTransform.getRotation()[3]};
  270. int graphicsInstanceId = registerGraphicsInstance(graphicsShapeId, pos, orn, colorRGBA, localScaling);
  271. body->setUserIndex(graphicsInstanceId);
  272. }
  273. }
  274. }
  275. void RemoteGUIHelper::createCollisionShapeGraphicsObject(btCollisionShape* collisionShape)
  276. {
  277. printf("createCollisionShapeGraphicsObject\n");
  278. }
  279. void RemoteGUIHelper::syncPhysicsToGraphics(const btDiscreteDynamicsWorld* rbWorld)
  280. {
  281. }
  282. void RemoteGUIHelper::syncPhysicsToGraphics2(const btDiscreteDynamicsWorld* rbWorld)
  283. {
  284. b3AlignedObjectArray<GUISyncPosition> updatedPositions;
  285. int numCollisionObjects = rbWorld->getNumCollisionObjects();
  286. {
  287. B3_PROFILE("write all InstanceTransformToCPU2");
  288. for (int i = 0; i < numCollisionObjects; i++)
  289. {
  290. //B3_PROFILE("writeSingleInstanceTransformToCPU");
  291. btCollisionObject* colObj = rbWorld->getCollisionObjectArray()[i];
  292. btCollisionShape* collisionShape = colObj->getCollisionShape();
  293. btVector3 pos = colObj->getWorldTransform().getOrigin();
  294. btQuaternion orn = colObj->getWorldTransform().getRotation();
  295. int index = colObj->getUserIndex();
  296. if (index >= 0)
  297. {
  298. GUISyncPosition p;
  299. p.m_graphicsInstanceId = index;
  300. for (int q = 0; q < 4; q++)
  301. {
  302. p.m_pos[q] = pos[q];
  303. p.m_orn[q] = orn[q];
  304. }
  305. updatedPositions.push_back(p);
  306. }
  307. }
  308. }
  309. if (updatedPositions.size())
  310. {
  311. syncPhysicsToGraphics2(&updatedPositions[0], updatedPositions.size());
  312. }
  313. }
  314. void RemoteGUIHelper::syncPhysicsToGraphics2(const GUISyncPosition* positions, int numPositions)
  315. {
  316. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  317. if (cmd)
  318. {
  319. uploadData((unsigned char*)positions, numPositions * sizeof(GUISyncPosition), 0);
  320. cmd->m_updateFlags = 0;
  321. cmd->m_syncTransformsCommand.m_numPositions = numPositions;
  322. cmd->m_type = GFX_CMD_SYNCHRONIZE_TRANSFORMS;
  323. m_data->submitClientCommand(*cmd);
  324. }
  325. const GraphicsSharedMemoryStatus* status = 0;
  326. while ((status = m_data->processServerStatus()) == 0)
  327. {
  328. }
  329. }
  330. void RemoteGUIHelper::render(const btDiscreteDynamicsWorld* rbWorld)
  331. {
  332. }
  333. void RemoteGUIHelper::createPhysicsDebugDrawer(btDiscreteDynamicsWorld* rbWorld)
  334. {
  335. }
  336. int RemoteGUIHelper::uploadData(const unsigned char* data, int sizeInBytes, int slot)
  337. {
  338. int chunkSize = GRAPHICS_SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE;
  339. int remainingBytes = sizeInBytes;
  340. int offset = 0;
  341. while (remainingBytes)
  342. {
  343. btAssert(remainingBytes >= 0);
  344. int curBytes = btMin(remainingBytes, chunkSize);
  345. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  346. if (cmd)
  347. {
  348. for (int i = 0; i < curBytes; i++)
  349. {
  350. m_data->m_testBlock1->m_bulletStreamData[i] = data[i + offset];
  351. }
  352. cmd->m_updateFlags = 0;
  353. cmd->m_type = GFX_CMD_UPLOAD_DATA;
  354. cmd->m_uploadDataCommand.m_numBytes = curBytes;
  355. cmd->m_uploadDataCommand.m_dataOffset = offset;
  356. cmd->m_uploadDataCommand.m_dataSlot = slot;
  357. m_data->submitClientCommand(*cmd);
  358. const GraphicsSharedMemoryStatus* status = 0;
  359. while ((status = m_data->processServerStatus()) == 0)
  360. {
  361. }
  362. offset += curBytes;
  363. remainingBytes -= curBytes;
  364. }
  365. }
  366. return 0;
  367. }
  368. int RemoteGUIHelper::registerTexture(const unsigned char* texels, int width, int height)
  369. {
  370. int textureId = -1;
  371. //first upload all data
  372. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  373. if (cmd)
  374. {
  375. int sizeInBytes = width * height * 3; //rgb
  376. uploadData(texels, sizeInBytes, 0);
  377. cmd->m_updateFlags = 0;
  378. cmd->m_type = GFX_CMD_REGISTER_TEXTURE;
  379. cmd->m_registerTextureCommand.m_width = width;
  380. cmd->m_registerTextureCommand.m_height = height;
  381. m_data->submitClientCommand(*cmd);
  382. const GraphicsSharedMemoryStatus* status = 0;
  383. while ((status = m_data->processServerStatus()) == 0)
  384. {
  385. }
  386. if (status->m_type == GFX_CMD_REGISTER_TEXTURE_COMPLETED)
  387. {
  388. textureId = status->m_registerTextureStatus.m_textureId;
  389. }
  390. }
  391. return textureId;
  392. }
  393. int RemoteGUIHelper::registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices, int primitiveType, int textureId)
  394. {
  395. int shapeId = -1;
  396. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  397. if (cmd)
  398. {
  399. uploadData((unsigned char*)vertices, numvertices * 9 * sizeof(float), 0);
  400. uploadData((unsigned char*)indices, numIndices * sizeof(int), 1);
  401. cmd->m_type = GFX_CMD_REGISTER_GRAPHICS_SHAPE;
  402. cmd->m_updateFlags = 0;
  403. cmd->m_registerGraphicsShapeCommand.m_numVertices = numvertices;
  404. cmd->m_registerGraphicsShapeCommand.m_numIndices = numIndices;
  405. cmd->m_registerGraphicsShapeCommand.m_primitiveType = primitiveType;
  406. cmd->m_registerGraphicsShapeCommand.m_textureId = textureId;
  407. m_data->submitClientCommand(*cmd);
  408. const GraphicsSharedMemoryStatus* status = 0;
  409. while ((status = m_data->processServerStatus()) == 0)
  410. {
  411. }
  412. if (status->m_type == GFX_CMD_REGISTER_GRAPHICS_SHAPE_COMPLETED)
  413. {
  414. shapeId = status->m_registerGraphicsShapeStatus.m_shapeId;
  415. }
  416. }
  417. return shapeId;
  418. }
  419. int RemoteGUIHelper::registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling)
  420. {
  421. int graphicsInstanceId = -1;
  422. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  423. if (cmd)
  424. {
  425. cmd->m_type = GFX_CMD_REGISTER_GRAPHICS_INSTANCE;
  426. cmd->m_updateFlags = 0;
  427. cmd->m_registerGraphicsInstanceCommand.m_shapeIndex = shapeIndex;
  428. for (int i = 0; i < 4; i++)
  429. {
  430. cmd->m_registerGraphicsInstanceCommand.m_position[i] = position[i];
  431. cmd->m_registerGraphicsInstanceCommand.m_quaternion[i] = quaternion[i];
  432. cmd->m_registerGraphicsInstanceCommand.m_color[i] = color[i];
  433. cmd->m_registerGraphicsInstanceCommand.m_scaling[i] = scaling[i];
  434. }
  435. m_data->submitClientCommand(*cmd);
  436. const GraphicsSharedMemoryStatus* status = 0;
  437. while ((status = m_data->processServerStatus()) == 0)
  438. {
  439. }
  440. if (status->m_type == GFX_CMD_REGISTER_GRAPHICS_INSTANCE_COMPLETED)
  441. {
  442. graphicsInstanceId = status->m_registerGraphicsInstanceStatus.m_graphicsInstanceId;
  443. }
  444. }
  445. return graphicsInstanceId;
  446. }
  447. void RemoteGUIHelper::removeAllGraphicsInstances()
  448. {
  449. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  450. if (cmd)
  451. {
  452. cmd->m_updateFlags = 0;
  453. cmd->m_type = GFX_CMD_REMOVE_ALL_GRAPHICS_INSTANCES;
  454. m_data->submitClientCommand(*cmd);
  455. const GraphicsSharedMemoryStatus* status = 0;
  456. while ((status = m_data->processServerStatus()) == 0)
  457. {
  458. }
  459. }
  460. }
  461. void RemoteGUIHelper::removeGraphicsInstance(int graphicsUid)
  462. {
  463. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  464. if (cmd)
  465. {
  466. cmd->m_updateFlags = 0;
  467. cmd->m_type = GFX_CMD_REMOVE_SINGLE_GRAPHICS_INSTANCE;
  468. cmd->m_removeGraphicsInstanceCommand.m_graphicsUid = graphicsUid;
  469. m_data->submitClientCommand(*cmd);
  470. const GraphicsSharedMemoryStatus* status = 0;
  471. while ((status = m_data->processServerStatus()) == 0)
  472. {
  473. }
  474. }
  475. }
  476. void RemoteGUIHelper::changeScaling(int instanceUid, const double scaling[3])
  477. {
  478. }
  479. void RemoteGUIHelper::changeRGBAColor(int instanceUid, const double rgbaColor[4])
  480. {
  481. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  482. if (cmd)
  483. {
  484. cmd->m_updateFlags = 0;
  485. cmd->m_type = GFX_CMD_CHANGE_RGBA_COLOR;
  486. cmd->m_changeRGBAColorCommand.m_graphicsUid = instanceUid;
  487. for (int i = 0; i < 4; i++)
  488. {
  489. cmd->m_changeRGBAColorCommand.m_rgbaColor[i] = rgbaColor[i];
  490. }
  491. m_data->submitClientCommand(*cmd);
  492. const GraphicsSharedMemoryStatus* status = 0;
  493. while ((status = m_data->processServerStatus()) == 0)
  494. {
  495. }
  496. }
  497. }
  498. Common2dCanvasInterface* RemoteGUIHelper::get2dCanvasInterface()
  499. {
  500. return 0;
  501. }
  502. CommonParameterInterface* RemoteGUIHelper::getParameterInterface()
  503. {
  504. return 0;
  505. }
  506. CommonRenderInterface* RemoteGUIHelper::getRenderInterface()
  507. {
  508. return 0;
  509. }
  510. CommonGraphicsApp* RemoteGUIHelper::getAppInterface()
  511. {
  512. return 0;
  513. }
  514. void RemoteGUIHelper::setUpAxis(int axis)
  515. {
  516. GraphicsSharedMemoryCommand* cmd = m_data->getAvailableSharedMemoryCommand();
  517. if (cmd)
  518. {
  519. cmd->m_updateFlags = 0;
  520. cmd->m_upAxisYCommand.m_enableUpAxisY = axis == 1;
  521. cmd->m_type = GFX_CMD_0;
  522. m_data->submitClientCommand(*cmd);
  523. const GraphicsSharedMemoryStatus* status = 0;
  524. while ((status = m_data->processServerStatus()) == 0)
  525. {
  526. }
  527. }
  528. }
  529. void RemoteGUIHelper::resetCamera(float camDist, float yaw, float pitch, float camPosX, float camPosY, float camPosZ)
  530. {
  531. }
  532. void RemoteGUIHelper::copyCameraImageData(const float viewMatrix[16], const float projectionMatrix[16],
  533. unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
  534. float* depthBuffer, int depthBufferSizeInPixels,
  535. int* segmentationMaskBuffer, int segmentationMaskBufferSizeInPixels,
  536. int startPixelIndex, int width, int height, int* numPixelsCopied)
  537. {
  538. if (numPixelsCopied)
  539. *numPixelsCopied = 0;
  540. }
  541. void RemoteGUIHelper::setProjectiveTextureMatrices(const float viewMatrix[16], const float projectionMatrix[16])
  542. {
  543. }
  544. void RemoteGUIHelper::setProjectiveTexture(bool useProjectiveTexture)
  545. {
  546. }
  547. void RemoteGUIHelper::autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld)
  548. {
  549. }
  550. void RemoteGUIHelper::drawText3D(const char* txt, float posX, float posZY, float posZ, float size)
  551. {
  552. }
  553. void RemoteGUIHelper::drawText3D(const char* txt, float position[3], float orientation[4], float color[4], float size, int optionFlag)
  554. {
  555. }
  556. int RemoteGUIHelper::addUserDebugLine(const double debugLineFromXYZ[3], const double debugLineToXYZ[3], const double debugLineColorRGB[3], double lineWidth, double lifeTime, int trackingVisualShapeIndex, int replaceItemUid)
  557. {
  558. return -1;
  559. }
  560. int RemoteGUIHelper::addUserDebugPoints(const double debugPointPositionXYZ[3], const double debugPointColorRGB[3], double pointSize, double lifeTime, int trackingVisualShapeIndex, int replaceItemUid, int debugPointNum)
  561. {
  562. return -1;
  563. }
  564. void RemoteGUIHelper::removeUserDebugItem(int debugItemUniqueId)
  565. {
  566. }
  567. void RemoteGUIHelper::removeAllUserDebugItems()
  568. {
  569. }