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

Method drawUserDebugLines

examples/SharedMemory/PhysicsServerExample.cpp:2824–3054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2822extern btTransform gVRTrackingObjectTr;
2823
2824void PhysicsServerExample::drawUserDebugLines()
2825{
2826 //static char line0[1024];
2827 //static char line1[1024];
2828
2829 //draw all user-debug-lines
2830
2831 //add array of lines
2832
2833 //draw all user- 'text3d' messages
2834 if (m_multiThreadedHelper)
2835 {
2836 //if gBatchUserDebugLines is true, batch lines based on color+width, to reduce line draw calls
2837
2838 btAlignedObjectArray<btAlignedObjectArray<unsigned int> > sortedIndices;
2839 btAlignedObjectArray<btAlignedObjectArray<btVector3FloatData> > sortedLines;
2840
2841 btHashMap<ColorWidth, int> hashedLines;
2842
2843 for (int i = 0; i < m_multiThreadedHelper->m_userDebugLines.size(); i++)
2844 {
2845 btVector3 from;
2846 from.setValue(m_multiThreadedHelper->m_userDebugLines[i].m_debugLineFromXYZ[0],
2847 m_multiThreadedHelper->m_userDebugLines[i].m_debugLineFromXYZ[1],
2848 m_multiThreadedHelper->m_userDebugLines[i].m_debugLineFromXYZ[2]);
2849 btVector3 toX;
2850 toX.setValue(m_multiThreadedHelper->m_userDebugLines[i].m_debugLineToXYZ[0],
2851 m_multiThreadedHelper->m_userDebugLines[i].m_debugLineToXYZ[1],
2852 m_multiThreadedHelper->m_userDebugLines[i].m_debugLineToXYZ[2]);
2853
2854 int graphicsIndex = m_multiThreadedHelper->m_userDebugLines[i].m_trackingVisualShapeIndex;
2855 if (graphicsIndex >= 0)
2856 {
2857 CommonRenderInterface* renderer = m_guiHelper->getRenderInterface();
2858 if (renderer)
2859 {
2860 float parentPos[3];
2861 float parentOrn[4];
2862
2863 if (renderer->readSingleInstanceTransformToCPU(parentPos, parentOrn, graphicsIndex))
2864 {
2865 btTransform parentTrans;
2866 parentTrans.setOrigin(btVector3(parentPos[0], parentPos[1], parentPos[2]));
2867 parentTrans.setRotation(btQuaternion(parentOrn[0], parentOrn[1], parentOrn[2], parentOrn[3]));
2868 from = parentTrans * from;
2869 toX = parentTrans * toX;
2870 }
2871 }
2872 }
2873
2874 btVector3 color;
2875 color.setValue(m_multiThreadedHelper->m_userDebugLines[i].m_debugLineColorRGB[0],
2876 m_multiThreadedHelper->m_userDebugLines[i].m_debugLineColorRGB[1],
2877 m_multiThreadedHelper->m_userDebugLines[i].m_debugLineColorRGB[2]);
2878 ColorWidth cw;
2879 color.serializeFloat(cw.m_color);
2880 cw.width = m_multiThreadedHelper->m_userDebugLines[i].m_lineWidth;
2881 int index = -1;

Callers

nothing calls this directly

Calls 15

urdfStringSplitFunction · 0.85
getRotationMethod · 0.80
c_strMethod · 0.80
btVector3Class · 0.70
btQuaternionClass · 0.70
sizeMethod · 0.45
setValueMethod · 0.45
getRenderInterfaceMethod · 0.45
setRotationMethod · 0.45
serializeFloatMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected