本文整理汇总了C++中PhysicsClientSharedMemory::getDebugLinesColor方法的典型用法代码示例。如果您正苦于以下问题:C++ PhysicsClientSharedMemory::getDebugLinesColor方法的具体用法?C++ PhysicsClientSharedMemory::getDebugLinesColor怎么用?C++ PhysicsClientSharedMemory::getDebugLinesColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhysicsClientSharedMemory
的用法示例。
在下文中一共展示了PhysicsClientSharedMemory::getDebugLinesColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
virtual void renderScene()
{
int numLines = m_physicsClient.getNumDebugLines();
const btVector3* fromLines = m_physicsClient.getDebugLinesFrom();
const btVector3* toLines = m_physicsClient.getDebugLinesTo();
const btVector3* colorLines = m_physicsClient.getDebugLinesColor();
int lineWidth = 1;
if (1)
{
btAlignedObjectArray<btVector3FloatData> points;
points.resize(numLines*2);
btAlignedObjectArray<unsigned int> indices;
indices.resize(numLines*2);
for (int i=0;i<numLines;i++)
{
points[i*2].m_floats[0] = fromLines[i].x();
points[i*2].m_floats[1] = fromLines[i].y();
points[i*2].m_floats[2] = fromLines[i].z();
points[i*2+1].m_floats[0] = toLines[i].x();
points[i*2+1].m_floats[1] = toLines[i].y();
points[i*2+1].m_floats[2] = toLines[i].z();
indices[i*2] = i*2;
indices[i*2+1] = i*2+1;
}
float color[4] = {1,1,0,1};
if (points.size() && indices.size())
{
m_guiHelper->getRenderInterface()->drawLines(&points[0].m_floats[0],color,points.size(),sizeof(btVector3FloatData),&indices[0],indices.size(),lineWidth);
}
} else
{
for (int i=0;i<numLines;i++)
{
m_guiHelper->getRenderInterface()->drawLine(fromLines[i],toLines[i],colorLines[i],lineWidth);
}
}
}