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

Method initPhysics

examples/SharedMemory/PhysicsClientExample.cpp:712–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710}
711
712void PhysicsClientExample::initPhysics()
713{
714 if (m_guiHelper && m_guiHelper->getParameterInterface())
715 {
716 int upAxis = 2;
717 m_guiHelper->setUpAxis(upAxis);
718
719 createButtons();
720 }
721 else
722 {
723 MyCallback(CMD_LOAD_URDF, true, this);
724 MyCallback(CMD_STEP_FORWARD_SIMULATION, true, this);
725
726 MyCallback(CMD_RESET_SIMULATION, true, this);
727 }
728
729 m_selectedBody = -1;
730 m_prevSelectedBody = -1;
731
732 m_lightPos[0] = 1.0;
733 m_lightPos[1] = 1.0;
734 m_lightPos[2] = 1.0;
735
736 {
737 m_canvas = m_guiHelper->get2dCanvasInterface();
738 if (m_canvas)
739 {
740 m_canvasRGBIndex = m_canvas->createCanvas("Synthetic Camera RGB data", camVisualizerWidth, camVisualizerHeight, 8, 55);
741 m_canvasDepthIndex = m_canvas->createCanvas("Synthetic Camera Depth data", camVisualizerWidth, camVisualizerHeight, 8, 75 + camVisualizerHeight);
742 m_canvasSegMaskIndex = m_canvas->createCanvas("Synthetic Camera Segmentation Mask", camVisualizerWidth, camVisualizerHeight, 8, 95 + camVisualizerHeight * 2);
743
744 for (int i = 0; i < camVisualizerWidth; i++)
745 {
746 for (int j = 0; j < camVisualizerHeight; j++)
747 {
748 unsigned char red = 255;
749 unsigned char green = 255;
750 unsigned char blue = 255;
751 unsigned char alpha = 255;
752 if (i == j)
753 {
754 red = 0;
755 green = 0;
756 blue = 0;
757 }
758 m_canvas->setPixel(m_canvasRGBIndex, i, j, red, green, blue, alpha);
759 m_canvas->setPixel(m_canvasDepthIndex, i, j, red, green, blue, alpha);
760 m_canvas->setPixel(m_canvasSegMaskIndex, i, j, red, green, blue, alpha);
761 }
762 }
763 m_canvas->refreshImageData(m_canvasRGBIndex);
764 m_canvas->refreshImageData(m_canvasDepthIndex);
765 m_canvas->refreshImageData(m_canvasSegMaskIndex);
766 }
767 }
768
769 if (m_options == eCLIENTEXAMPLE_SERVER)

Callers

nothing calls this directly

Calls 9

b3CanSubmitCommandFunction · 0.85
connectSharedMemoryMethod · 0.80
MyCallbackFunction · 0.70
getParameterInterfaceMethod · 0.45
setUpAxisMethod · 0.45
get2dCanvasInterfaceMethod · 0.45
createCanvasMethod · 0.45
setPixelMethod · 0.45
refreshImageDataMethod · 0.45

Tested by

no test coverage detected