Changeset 13041 for OpenSceneGraph/trunk/include/osgUtil/Tessellator
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgUtil/Tessellator (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgUtil/Tessellator
r12978 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 37 37 { 38 38 public: 39 39 40 40 Tessellator(); 41 41 ~Tessellator(); … … 72 72 /** Change the contours lists of the geometry into tessellated primitives (the 73 73 * list of primitives in the original geometry is stored in the Tessellator for 74 * possible re-use. 74 * possible re-use. 75 75 * The name remains retessellatePolygons although it now handles trifans, strips, quads etc. 76 76 * as well as Polygons so as to not break old codes relying on this function name. */ … … 80 80 * tessellate the contours; see gluTessNormal in red book or man pages. 81 81 * GWM July 2005. Can improve teselation 82 * "For example, if you know that all polygons lie in the x-y plane, 82 * "For example, if you know that all polygons lie in the x-y plane, 83 83 * call gluTessNormal(tess, 0.0, 0.0, 1.0) before rendering any polygons." 84 84 */ … … 90 90 { 91 91 Prim(GLenum mode):_mode(mode) {} 92 92 93 93 typedef std::vector<osg::Vec3*> VecList; 94 94 … … 96 96 VecList _vertices; 97 97 }; 98 98 99 99 virtual void beginTessellation(); 100 100 101 101 void beginContour(); 102 102 … … 113 113 114 114 typedef std::vector< osg::ref_ptr<Prim> > PrimList; 115 116 PrimList& getPrimList() { return _primList; } 117 115 116 PrimList& getPrimList() { return _primList; } 117 118 118 void reset(); 119 119 120 120 protected: 121 121 … … 126 126 127 127 void collectTessellation(osg::Geometry &cxgeom, unsigned int originalIndex); 128 128 129 129 typedef std::map<osg::Vec3*,unsigned int> VertexPtrToIndexMap; 130 130 void addContour(GLenum mode, unsigned int first, unsigned int last, osg::Vec3Array* vertices); … … 138 138 void error(GLenum errorCode); 139 139 140 140 141 141 static void CALLBACK beginCallback(GLenum which, void* userData); 142 142 static void CALLBACK vertexCallback(GLvoid *data, void* userData); … … 146 146 static void CALLBACK endCallback(void* userData); 147 147 static void CALLBACK errorCallback(GLenum errorCode, void* userData); 148 149 148 149 150 150 struct Vec3d 151 151 { … … 156 156 struct NewVertex 157 157 { 158 158 159 159 NewVertex(): 160 160 _vpos(0), … … 167 167 _f4(0), 168 168 _v4(0) {} 169 169 170 170 NewVertex(const NewVertex& nv): 171 171 _vpos(nv._vpos), … … 195 195 196 196 osg::Vec3 *_vpos; // added gwm Jan 2004 the vertex coords s.t. NewVertex can be used in a std::vector 197 197 198 198 float _f1; 199 199 osg::Vec3* _v1; … … 207 207 float _f4; 208 208 osg::Vec3* _v4; 209 210 }; 211 209 210 }; 211 212 212 //change NewVertexList from std::map<osg::Vec3*,NewVertex> NewVertexList; 213 // because this has undefined order of insertion for new vertices. 213 // because this has undefined order of insertion for new vertices. 214 214 // which occasionally corrupted the texture mapping. 215 215 typedef std::vector<NewVertex> NewVertexList; … … 224 224 225 225 /** winding rule, which parts will become solid */ 226 WindingType _wtype; 226 WindingType _wtype; 227 227 228 228 /** tessellation rule, which parts will become solid */
