Merge pull request #702 from mp3butcher/fix36
add MeshReindexation flag
This commit is contained in:
commit
1504a54cd8
@ -46,11 +46,16 @@ class OSGUTIL_EXPORT IndexMeshVisitor : public GeometryCollector
|
||||
{
|
||||
public:
|
||||
IndexMeshVisitor(Optimizer* optimizer = 0)
|
||||
: GeometryCollector(optimizer, Optimizer::INDEX_MESH)
|
||||
: GeometryCollector(optimizer, Optimizer::INDEX_MESH), _generateNewIndicesOnAllGeometries(false)
|
||||
{
|
||||
}
|
||||
inline void setGenerateNewIndicesOnAllGeometries(bool b) { _generateNewIndicesOnAllGeometries = b; }
|
||||
inline bool getGenerateNewIndicesOnAllGeometries() const { return _generateNewIndicesOnAllGeometries; }
|
||||
|
||||
void makeMesh(osg::Geometry& geom);
|
||||
void makeMesh();
|
||||
protected:
|
||||
bool _generateNewIndicesOnAllGeometries;
|
||||
};
|
||||
|
||||
// Optimize the triangle order in a mesh for best use of the GPU's
|
||||
|
@ -262,7 +262,7 @@ void IndexMeshVisitor::makeMesh(Geometry& geom)
|
||||
}
|
||||
|
||||
// nothing to index
|
||||
if (!numSurfacePrimitives || !numNonIndexedPrimitives) return;
|
||||
if (!numSurfacePrimitives || (!_generateNewIndicesOnAllGeometries && !numNonIndexedPrimitives)) return;
|
||||
|
||||
// duplicate shared arrays as it isn't safe to rearrange vertices when arrays are shared.
|
||||
if (geom.containsSharedArrays()) geom.duplicateSharedArrays();
|
||||
|
Loading…
Reference in New Issue
Block a user