|
|
|
@ -85,6 +85,8 @@ namespace SceneUtil
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Geometry> gridGeometry = new osg::Geometry();
|
|
|
|
|
|
|
|
|
|
if (PointIndexCount || EdgeIndexCount)
|
|
|
|
|
{
|
|
|
|
|
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array(VertexCount);
|
|
|
|
|
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array(ColorCount);
|
|
|
|
|
osg::ref_ptr<osg::DrawElementsUShort> pointIndices =
|
|
|
|
@ -166,10 +168,12 @@ namespace SceneUtil
|
|
|
|
|
|
|
|
|
|
gridGeometry->setVertexArray(vertices);
|
|
|
|
|
gridGeometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
|
|
|
|
|
if (PointIndexCount)
|
|
|
|
|
gridGeometry->addPrimitiveSet(pointIndices);
|
|
|
|
|
if (EdgeIndexCount)
|
|
|
|
|
gridGeometry->addPrimitiveSet(lineIndices);
|
|
|
|
|
gridGeometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return gridGeometry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -184,6 +188,8 @@ namespace SceneUtil
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Geometry> wireframeGeometry = new osg::Geometry();
|
|
|
|
|
|
|
|
|
|
if (IndexCount)
|
|
|
|
|
{
|
|
|
|
|
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array(VertexCount);
|
|
|
|
|
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array(ColorCount);
|
|
|
|
|
osg::ref_ptr<osg::DrawElementsUShort> indices =
|
|
|
|
@ -221,7 +227,7 @@ namespace SceneUtil
|
|
|
|
|
wireframeGeometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
|
|
|
|
|
wireframeGeometry->addPrimitiveSet(indices);
|
|
|
|
|
wireframeGeometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return wireframeGeometry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|