From Geoff Michel, added normal definition for tesselation
This commit is contained in:
@@ -77,6 +77,14 @@ class OSGUTIL_EXPORT Tesselator : public osg::Referenced
|
||||
* as well as Polygons so as to not break old codes relying on this function name. */
|
||||
void retesselatePolygons(osg::Geometry &cxgeom);
|
||||
|
||||
/** Define the normal to the tesselated polygon - this provides a hint how to
|
||||
* tesselate the contours; see gluTessNormal in red book or man pages.
|
||||
* GWM July 2005. Can improve teselation
|
||||
* "For example, if you know that all polygons lie in the x-y plane,
|
||||
* call gluTessNormal(tess, 0.0, 0.0, 1.0) before rendering any polygons."
|
||||
*/
|
||||
void setTesselationNormal(const osg::Vec3 norm) { tessNormal=norm;}
|
||||
|
||||
osg::Geometry::PrimitiveSetList getContours() { return _Contours;}
|
||||
|
||||
typedef std::vector<osg::Vec3*> VertexPointList;
|
||||
@@ -225,6 +233,9 @@ class OSGUTIL_EXPORT Tesselator : public osg::Referenced
|
||||
|
||||
/** count number of primitives in a geometry to get right no. of norms/colurs etc for per_primitive attributes. */
|
||||
unsigned int _index;
|
||||
|
||||
/** the gluTessNormal for tesselation hint */
|
||||
osg::Vec3 tessNormal;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -35,8 +35,6 @@ Tesselator::~Tesselator()
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Tesselator::beginTesselation()
|
||||
{
|
||||
reset();
|
||||
@@ -48,6 +46,7 @@ void Tesselator::beginTesselation()
|
||||
gluTessCallback(_tobj, GLU_TESS_END_DATA, (GLU_TESS_CALLBACK) endCallback);
|
||||
gluTessCallback(_tobj, GLU_TESS_COMBINE_DATA,(GLU_TESS_CALLBACK) combineCallback);
|
||||
gluTessCallback(_tobj, GLU_TESS_ERROR_DATA, (GLU_TESS_CALLBACK) errorCallback);
|
||||
if (tessNormal.length()>0.0) gluTessNormal(_tobj, tessNormal.x(), tessNormal.y(), tessNormal.z());
|
||||
|
||||
gluTessBeginPolygon(_tobj,this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user