From 2f63f0fa2118681bc173416ef02d590339dc804d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 11 Feb 2004 12:06:37 +0000 Subject: [PATCH] Added support for draw back then front faces of the osg::Sphere shape --- src/osg/ShapeDrawable.cpp | 170 +++++++++++++++++++++++++++----------- 1 file changed, 124 insertions(+), 46 deletions(-) diff --git a/src/osg/ShapeDrawable.cpp b/src/osg/ShapeDrawable.cpp index 2a10a3a8e..7245443da 100644 --- a/src/osg/ShapeDrawable.cpp +++ b/src/osg/ShapeDrawable.cpp @@ -61,10 +61,14 @@ class DrawShapeVisitor : public ConstShapeVisitor void DrawShapeVisitor::apply(const Sphere& sphere) { + glPushMatrix(); glTranslatef(sphere.getCenter().x(),sphere.getCenter().y(),sphere.getCenter().z()); + bool drawFrontFace = _hints ? _hints->getCreateFrontFace() : true; + bool drawBackFace = _hints ? _hints->getCreateBackFace() : false; + unsigned int numSegments = 40; unsigned int numRows = 20; if (_hints && _hints->getDetailRatio() != 1.0f) { @@ -83,70 +87,144 @@ void DrawShapeVisitor::apply(const Sphere& sphere) float angleDelta = osg::PI*2.0f/(float)numSegments; float texCoordHorzDelta = 1.0f/(float)numSegments; - float lBase=-osg::PI*0.5f; - float rBase=0.0f; - float zBase=-sphere.getRadius(); - float vBase=0.0f; - float nzBase=-1.0f; - float nRatioBase=0.0f; - - for(unsigned int rowi=0; rowi