Changeset 13041 for OpenSceneGraph/trunk/include/osg/Geometry
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/Geometry (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/Geometry
r12064 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 */ … … 33 33 /** Copy constructor using CopyOp to manage deep vs shallow copy. */ 34 34 Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY); 35 35 36 36 virtual Object* cloneType() const { return new Geometry(); } 37 virtual Object* clone(const CopyOp& copyop) const { return new Geometry(*this,copyop); } 37 virtual Object* clone(const CopyOp& copyop) const { return new Geometry(*this,copyop); } 38 38 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Geometry*>(obj)!=NULL; } 39 39 virtual const char* libraryName() const { return "osg"; } … … 53 53 BIND_PER_VERTEX 54 54 }; 55 55 56 56 struct OSG_EXPORT ArrayData 57 57 { … … 59 59 binding(BIND_OFF), 60 60 normalize(GL_FALSE) {} 61 61 62 62 ArrayData(const ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY); 63 63 … … 82 82 return *this; 83 83 } 84 85 inline bool empty() const { return !array.valid(); } 84 85 inline bool empty() const { return !array.valid(); } 86 86 87 87 ref_ptr<Array> array; … … 90 90 GLboolean normalize; 91 91 }; 92 92 93 93 struct OSG_EXPORT Vec3ArrayData 94 94 { … … 96 96 binding(BIND_OFF), 97 97 normalize(GL_FALSE) {} 98 98 99 99 Vec3ArrayData(const Vec3ArrayData& data,const CopyOp& copyop=CopyOp::SHALLOW_COPY); 100 100 … … 120 120 } 121 121 122 inline bool empty() const { return !array.valid(); } 122 inline bool empty() const { return !array.valid(); } 123 123 124 124 ref_ptr<Vec3Array> array; … … 128 128 }; 129 129 130 /** Static ArrayData which is returned from getTexCoordData(i) const and getVertexAttribData(i) const 130 /** Static ArrayData which is returned from getTexCoordData(i) const and getVertexAttribData(i) const 131 131 * when i is out of range. 132 132 */ 133 133 static const ArrayData s_InvalidArrayData; 134 134 135 135 typedef std::vector< ArrayData > ArrayDataList; 136 136 137 137 138 138 void setVertexArray(Array* array); … … 143 143 ArrayData& getVertexData() { return _vertexData; } 144 144 const ArrayData& getVertexData() const { return _vertexData; } 145 145 146 146 147 147 void setNormalBinding(AttributeBinding ab); … … 190 190 ArrayData& getFogCoordData() { return _fogCoordData; } 191 191 const ArrayData& getFogCoordData() const { return _fogCoordData; } 192 192 193 193 194 194 void setTexCoordArray(unsigned int unit,Array*); … … 229 229 230 230 void setPrimitiveSetList(const PrimitiveSetList& primitives); 231 231 232 232 PrimitiveSetList& getPrimitiveSetList() { return _primitives; } 233 233 const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; } … … 236 236 PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); } 237 237 const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); } 238 238 239 239 /** Add a primitive set to the geometry. */ 240 240 bool addPrimitiveSet(PrimitiveSet* primitiveset); 241 241 242 242 /** Set a primitive set to the specified position in geometry's primitive set list. */ 243 243 bool setPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset); 244 244 245 245 /** Insert a primitive set to the specified position in geometry's primitive set list. */ 246 246 bool insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset); 247 247 248 248 /** Remove primitive set(s) from the specified position in geometry's primitive set list. */ 249 249 bool removePrimitiveSet(unsigned int i,unsigned int numElementsToRemove=1); … … 261 261 IndexArray* getVertexIndices() { return _vertexData.indices.get(); } 262 262 const IndexArray* getVertexIndices() const { return _vertexData.indices.get(); } 263 263 264 264 /** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/ 265 265 void setNormalIndices(IndexArray* array); … … 295 295 296 296 297 /** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation 297 /** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation 298 298 method to use OpenGL vertex buffer objects for rendering.*/ 299 299 virtual void setUseVertexBufferObjects(bool flag); … … 359 359 360 360 bool containsSharedArrays() const; 361 361 362 362 void duplicateSharedArrays(); 363 363 364 364 365 365 void computeInternalOptimizedGeometry(); … … 419 419 420 420 virtual ~Geometry(); 421 421 422 422 bool verifyBindings(const ArrayData& arrayData) const; 423 423 bool verifyBindings(const Vec3ArrayData& arrayData) const; 424 424 425 425 void computeCorrectBindingsAndArraySizes(ArrayData& arrayData,const char* arrayName); 426 426 void computeCorrectBindingsAndArraySizes(Vec3ArrayData& arrayData,const char* arrayName); 427 427 428 428 void addVertexBufferObjectIfRequired(osg::Array* array); 429 429 void addElementBufferObjectIfRequired(osg::PrimitiveSet* primitiveSet); 430 430 431 431 432 432 PrimitiveSetList _primitives;
