Class MeshDecimate
Progressive mesh decimation implementation using edge collapse algorithm. Reduces mesh complexity while preserving overall shape and texture coordinates.
Namespace: NWH.DWP2.MeshDecimation
Assembly: NWH.DWP2.dll
Syntax
public class MeshDecimate
Fields
| Edit this page View SourcebRecalculateNormals
Whether to recalculate smooth normals after decimation.
Declaration
public bool bRecalculateNormals
Field Value
| Type | Description |
|---|---|
| bool |
finalNormals
Final vertex normals after decimation.
Declaration
public Vector3[] finalNormals
Field Value
| Type | Description |
|---|---|
| Vector3[] |
finalTriangles
Final triangle indices after decimation.
Declaration
public int[] finalTriangles
Field Value
| Type | Description |
|---|---|
| int[] |
finalUVs
Final texture coordinates after decimation.
Declaration
public Vector2[] finalUVs
Field Value
| Type | Description |
|---|---|
| Vector2[] |
finalVertices
Final vertex positions after decimation.
Declaration
public Vector3[] finalVertices
Field Value
| Type | Description |
|---|---|
| Vector3[] |
lastTarget
Last target vertex count from progressive mesh operation.
Declaration
public int lastTarget
Field Value
| Type | Description |
|---|---|
| int |
lockSelPoint
Whether to lock selected vertices from being collapsed.
Declaration
public bool lockSelPoint
Field Value
| Type | Description |
|---|---|
| bool |
lodDataSize
Size in bytes of LOD history data for progressive mesh.
Declaration
public float lodDataSize
Field Value
| Type | Description |
|---|---|
| float |
preCalculateDone
Whether pre-calculation of decimation data has been completed.
Declaration
public bool preCalculateDone
Field Value
| Type | Description |
|---|---|
| bool |
ratio
Target ratio of vertices to keep (0.0 to 1.0).
Declaration
public float ratio
Field Value
| Type | Description |
|---|---|
| float |
selectedVertices
List of vertices marked as selected (protected from collapse if locked).
Declaration
public List<Vector3> selectedVertices
Field Value
| Type | Description |
|---|---|
| List<Vector3> |
smoothAngle
Smoothing angle threshold in degrees for normal calculation.
Declaration
public float smoothAngle
Field Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceCalculate(Mesh)
Calculates the decimated mesh at the current ratio. Applies progressive mesh simplification and outputs final geometry arrays. PreCalculate must be called first.
Declaration
public void Calculate(Mesh tmpMesh)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | tmpMesh | Mesh reference (used for validation). |
PreCalculate(Mesh)
Pre-calculates all edge collapse operations and builds the progressive mesh history. Must be called once before Calculate can be used.
Declaration
public void PreCalculate(Mesh tmpMesh)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | tmpMesh | Input mesh to decimate. |