Before ODA SDKs version 21.3, creating a progressive mesh from shell data was required for working with OdGiProgressiveMeshGenerator, and it included checking the status of the generator after initial data was transferred. If the status was not OK, the progressive mesh could not be built or it may have lost data. So, you had to decide whether to generate the progressive mesh or keep the original shell data somewhere.
Starting with version 21.3, a new OdGiProgressiveMeshEx class wraps OdGiProgressiveMeshGenerator and OdGiProgressiveMesh. This class also keeps initial shell data if progressive mesh generation is canceled or the mesh is not generated due to data non-manifoldness.
The OdGiProgressiveMeshEx class provides access to the progressive mesh data and to the initial data through the same API.
Create a progressive mesh
To create a progressive mesh, create an instance of OdGiProgressiveMeshEx, fill it with the initial data, and call the buildProgressiveMesh method:
OdGiProgressiveMeshExPtr pPM = OdGiProgressiveMeshEx::createObject(); pPM->setupInitialShell( pts.size(), pts.asArrayPtr(), faces.size(), faces.asArrayPtr() ); pPM->options().setMinVertices( nMinPoints ); pPM->options().setMinFaces( nMinFaces ); pPM->buildProgressiveMesh();
You can access OdGiProgressiveMeshGeneratorOptions using the OdGiProgressiveMeshEx::options() method.
Specify the vertex, face, and edge data using the OdGiProgressiveMeshEx::buildProgressiveMesh() method.
The OdGiProgressiveMeshEx::setGenerationAbortFlags() method allows you to specify a set of OdGiProgressiveMeshGenerator::Status flags that abort progressive mesh generation if they appear.
The OdGiProgressiveMeshEx::isProgressiveMeshGenerated() method returns true if a progressive mesh is successfully generated. If this method returns false, OdGiProgressiveMeshEx works with the initial data and all progressive mesh-specific calls (setLOD(), etc.) are ignored.
If a mesh is generated, it can be obtained by the OdGiProgressiveMeshEx::progressiveMesh() call.
Starting with Visualize SDK version 21.3, the OdTvProgressiveMeshData class wraps OdGiProgressiveMeshEx instead of OdGiProgressiveMesh. So, even if a mesh is not generated, it still keeps the initial data and it can be rendered.
The OdTvProgressiveMeshData class has a new isProgressiveMeshGenerated() method that returns true if a mesh is successfully generated.