The mesh simplifier. More...
| Public Member Functions | |
| MeshSimplifier () | |
| Creates a new mesh simplifier. | |
| MeshSimplifier (Mesh mesh) | |
| Creates a new mesh simplifier. | |
| int[][] | GetAllSubMeshTriangles () | 
| Returns the triangle indices for all sub-meshes. | |
| int[] | GetSubMeshTriangles (int subMeshIndex) | 
| Returns the triangle indices for a specific sub-mesh. | |
| void | ClearSubMeshes () | 
| Clears out all sub-meshes. | |
| void | AddSubMeshTriangles (int[] triangles) | 
| Adds a sub-mesh triangle indices for a specific sub-mesh. | |
| void | AddSubMeshTriangles (int[][] triangles) | 
| Adds several sub-meshes at once with their triangle indices for each sub-mesh. | |
| Vector2[] | GetUVs2D (int channel) | 
| Returns the UVs (2D) from a specific channel. | |
| Vector3[] | GetUVs3D (int channel) | 
| Returns the UVs (3D) from a specific channel. | |
| Vector4[] | GetUVs4D (int channel) | 
| Returns the UVs (4D) from a specific channel. | |
| void | GetUVs (int channel, List< Vector2 > uvs) | 
| Returns the UVs (2D) from a specific channel. | |
| void | GetUVs (int channel, List< Vector3 > uvs) | 
| Returns the UVs (3D) from a specific channel. | |
| void | GetUVs (int channel, List< Vector4 > uvs) | 
| Returns the UVs (4D) from a specific channel. | |
| void | SetUVs (int channel, Vector2[] uvs) | 
| Sets the UVs (2D) for a specific channel. | |
| void | SetUVs (int channel, Vector3[] uvs) | 
| Sets the UVs (3D) for a specific channel. | |
| void | SetUVs (int channel, Vector4[] uvs) | 
| Sets the UVs (4D) for a specific channel. | |
| void | SetUVs (int channel, List< Vector2 > uvs) | 
| Sets the UVs (2D) for a specific channel. | |
| void | SetUVs (int channel, List< Vector3 > uvs) | 
| Sets the UVs (3D) for a specific channel. | |
| void | SetUVs (int channel, List< Vector4 > uvs) | 
| Sets the UVs (4D) for a specific channel. | |
| void | SetUVsAuto (int channel, List< Vector4 > uvs) | 
| Sets the UVs for a specific channel and automatically detects the used components. | |
| BlendShape[] | GetAllBlendShapes () | 
| Returns all blend shapes. | |
| BlendShape | GetBlendShape (int blendShapeIndex) | 
| Returns a specific blend shape. | |
| void | ClearBlendShapes () | 
| Clears all blend shapes. | |
| void | AddBlendShape (BlendShape blendShape) | 
| Adds a blend shape. | |
| void | AddBlendShapes (BlendShape[] blendShapes) | 
| Adds several blend shapes. | |
| void | Initialize (Mesh mesh) | 
| Initializes the algorithm with the original mesh. | |
| void | SimplifyMesh (float quality) | 
| Simplifies the mesh to a desired quality. | |
| void | SimplifyMeshLossless () | 
| Simplifies the mesh without losing too much quality. | |
| Mesh | ToMesh () | 
| Returns the resulting mesh. | |
| Properties | |
| bool | PreserveBorders  [get, set] | 
| Gets or sets if the border edges should be preserved. | |
| bool | PreserveBorderEdges  [get, set] | 
| Gets or sets if the border edges should be preserved. | |
| bool | PreserveSeams  [get, set] | 
| Gets or sets if the UV seam edges should be preserved. | |
| bool | PreserveUVSeamEdges  [get, set] | 
| Gets or sets if the UV seam edges should be preserved. | |
| bool | PreserveFoldovers  [get, set] | 
| Gets or sets if the UV foldover edges should be preserved. | |
| bool | PreserveUVFoldoverEdges  [get, set] | 
| Gets or sets if the UV foldover edges should be preserved. | |
| bool | EnableSmartLink  [get, set] | 
| Gets or sets if a feature for smarter vertex linking should be enabled, reducing artifacts in the decimated result at the cost of a slightly more expensive initialization by treating vertices at the same position as the same vertex while separating the attributes. | |
| int | MaxIterationCount  [get, set] | 
| Gets or sets the maximum iteration count. | |
| double | Agressiveness  [get, set] | 
| Gets or sets the agressiveness of the mesh simplification. | |
| bool | Verbose  [get, set] | 
| Gets or sets if verbose information should be printed to the console. | |
| double | VertexLinkDistance  [get, set] | 
| Gets or sets the maximum distance between two vertices in order to link them. | |
| double | VertexLinkDistanceSqr  [get, set] | 
| Gets or sets the maximum squared distance between two vertices in order to link them. | |
| Vector3[] | Vertices  [get, set] | 
| Gets or sets the vertex positions. | |
| int | SubMeshCount  [get] | 
| Gets the count of sub-meshes. | |
| int | BlendShapeCount  [get] | 
| Gets the count of blend shapes. | |
| Vector3[] | Normals  [get, set] | 
| Gets or sets the vertex normals. | |
| Vector4[] | Tangents  [get, set] | 
| Gets or sets the vertex tangents. | |
| Vector2[] | UV1  [get, set] | 
| Gets or sets the vertex 2D UV set 1. | |
| Vector2[] | UV2  [get, set] | 
| Gets or sets the vertex 2D UV set 2. | |
| Vector2[] | UV3  [get, set] | 
| Gets or sets the vertex 2D UV set 3. | |
| Vector2[] | UV4  [get, set] | 
| Gets or sets the vertex 2D UV set 4. | |
| Color[] | Colors  [get, set] | 
| Gets or sets the vertex colors. | |
| BoneWeight[] | BoneWeights  [get, set] | 
| Gets or sets the vertex bone weights. | |
Detailed Description
The mesh simplifier.
Deeply based on https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification but rewritten completely in C#.
Constructor & Destructor Documentation
◆ MeshSimplifier() [1/2]
| realvirtual.MeshSimplifier.MeshSimplifier | ( | ) | 
Creates a new mesh simplifier.
◆ MeshSimplifier() [2/2]
| realvirtual.MeshSimplifier.MeshSimplifier | ( | Mesh | mesh | ) | 
Creates a new mesh simplifier.
- Parameters
- 
  mesh The original mesh to simplify. 
Member Function Documentation
◆ AddBlendShape()
| void realvirtual.MeshSimplifier.AddBlendShape | ( | BlendShape | blendShape | ) | 
Adds a blend shape.
- Parameters
- 
  blendShape The blend shape to add. 
◆ AddBlendShapes()
| void realvirtual.MeshSimplifier.AddBlendShapes | ( | BlendShape[] | blendShapes | ) | 
Adds several blend shapes.
- Parameters
- 
  blendShapes The blend shapes to add. 
◆ AddSubMeshTriangles() [1/2]
| void realvirtual.MeshSimplifier.AddSubMeshTriangles | ( | int[] | triangles | ) | 
Adds a sub-mesh triangle indices for a specific sub-mesh.
- Parameters
- 
  triangles The triangle indices. 
◆ AddSubMeshTriangles() [2/2]
| void realvirtual.MeshSimplifier.AddSubMeshTriangles | ( | int | triangles[][] | ) | 
Adds several sub-meshes at once with their triangle indices for each sub-mesh.
- Parameters
- 
  triangles The triangle indices for each sub-mesh. 
◆ ClearBlendShapes()
| void realvirtual.MeshSimplifier.ClearBlendShapes | ( | ) | 
Clears all blend shapes.
◆ ClearSubMeshes()
| void realvirtual.MeshSimplifier.ClearSubMeshes | ( | ) | 
Clears out all sub-meshes.
◆ GetAllBlendShapes()
| BlendShape[] realvirtual.MeshSimplifier.GetAllBlendShapes | ( | ) | 
Returns all blend shapes.
- Returns
- An array of all blend shapes.
◆ GetAllSubMeshTriangles()
| int[][] realvirtual.MeshSimplifier.GetAllSubMeshTriangles | ( | ) | 
Returns the triangle indices for all sub-meshes.
- Returns
- The triangle indices for all sub-meshes.
◆ GetBlendShape()
| BlendShape realvirtual.MeshSimplifier.GetBlendShape | ( | int | blendShapeIndex | ) | 
Returns a specific blend shape.
- Parameters
- 
  blendShapeIndex The blend shape index. 
- Returns
- The blend shape.
◆ GetSubMeshTriangles()
| int[] realvirtual.MeshSimplifier.GetSubMeshTriangles | ( | int | subMeshIndex | ) | 
Returns the triangle indices for a specific sub-mesh.
- Parameters
- 
  subMeshIndex The sub-mesh index. 
- Returns
- The triangle indices.
◆ GetUVs() [1/3]
| void realvirtual.MeshSimplifier.GetUVs | ( | int | channel, | 
| List< Vector2 > | uvs | ||
| ) | 
Returns the UVs (2D) from a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ GetUVs() [2/3]
| void realvirtual.MeshSimplifier.GetUVs | ( | int | channel, | 
| List< Vector3 > | uvs | ||
| ) | 
Returns the UVs (3D) from a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ GetUVs() [3/3]
| void realvirtual.MeshSimplifier.GetUVs | ( | int | channel, | 
| List< Vector4 > | uvs | ||
| ) | 
Returns the UVs (4D) from a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ GetUVs2D()
| Vector2[] realvirtual.MeshSimplifier.GetUVs2D | ( | int | channel | ) | 
Returns the UVs (2D) from a specific channel.
- Parameters
- 
  channel The channel index. 
- Returns
- The UVs.
◆ GetUVs3D()
| Vector3[] realvirtual.MeshSimplifier.GetUVs3D | ( | int | channel | ) | 
Returns the UVs (3D) from a specific channel.
- Parameters
- 
  channel The channel index. 
- Returns
- The UVs.
◆ GetUVs4D()
| Vector4[] realvirtual.MeshSimplifier.GetUVs4D | ( | int | channel | ) | 
Returns the UVs (4D) from a specific channel.
- Parameters
- 
  channel The channel index. 
- Returns
- The UVs.
◆ Initialize()
| void realvirtual.MeshSimplifier.Initialize | ( | Mesh | mesh | ) | 
Initializes the algorithm with the original mesh.
- Parameters
- 
  mesh The mesh. 
◆ SetUVs() [1/6]
| void realvirtual.MeshSimplifier.SetUVs | ( | int | channel, | 
| List< Vector2 > | uvs | ||
| ) | 
Sets the UVs (2D) for a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ SetUVs() [2/6]
| void realvirtual.MeshSimplifier.SetUVs | ( | int | channel, | 
| List< Vector3 > | uvs | ||
| ) | 
Sets the UVs (3D) for a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ SetUVs() [3/6]
| void realvirtual.MeshSimplifier.SetUVs | ( | int | channel, | 
| List< Vector4 > | uvs | ||
| ) | 
Sets the UVs (4D) for a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ SetUVs() [4/6]
| void realvirtual.MeshSimplifier.SetUVs | ( | int | channel, | 
| Vector2[] | uvs | ||
| ) | 
Sets the UVs (2D) for a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ SetUVs() [5/6]
| void realvirtual.MeshSimplifier.SetUVs | ( | int | channel, | 
| Vector3[] | uvs | ||
| ) | 
Sets the UVs (3D) for a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ SetUVs() [6/6]
| void realvirtual.MeshSimplifier.SetUVs | ( | int | channel, | 
| Vector4[] | uvs | ||
| ) | 
Sets the UVs (4D) for a specific channel.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ SetUVsAuto()
| void realvirtual.MeshSimplifier.SetUVsAuto | ( | int | channel, | 
| List< Vector4 > | uvs | ||
| ) | 
Sets the UVs for a specific channel and automatically detects the used components.
- Parameters
- 
  channel The channel index. uvs The UVs. 
◆ SimplifyMesh()
| void realvirtual.MeshSimplifier.SimplifyMesh | ( | float | quality | ) | 
Simplifies the mesh to a desired quality.
- Parameters
- 
  quality The target quality (between 0 and 1). 
◆ SimplifyMeshLossless()
| void realvirtual.MeshSimplifier.SimplifyMeshLossless | ( | ) | 
Simplifies the mesh without losing too much quality.
◆ ToMesh()
| Mesh realvirtual.MeshSimplifier.ToMesh | ( | ) | 
Returns the resulting mesh.
- Returns
- The resulting mesh.
Property Documentation
◆ Agressiveness
| 
 | getset | 
Gets or sets the agressiveness of the mesh simplification.
Higher number equals higher quality, but more expensive to run. Default value: 7.0
◆ BlendShapeCount
| 
 | get | 
Gets the count of blend shapes.
◆ BoneWeights
| 
 | getset | 
Gets or sets the vertex bone weights.
◆ Colors
| 
 | getset | 
Gets or sets the vertex colors.
◆ EnableSmartLink
| 
 | getset | 
Gets or sets if a feature for smarter vertex linking should be enabled, reducing artifacts in the decimated result at the cost of a slightly more expensive initialization by treating vertices at the same position as the same vertex while separating the attributes.
Default value: true
◆ MaxIterationCount
| 
 | getset | 
Gets or sets the maximum iteration count.
Higher number is more expensive but can bring you closer to your target quality. Sometimes a lower maximum count might be desired in order to lower the performance cost. Default value: 100
◆ Normals
| 
 | getset | 
Gets or sets the vertex normals.
◆ PreserveBorderEdges
| 
 | getset | 
Gets or sets if the border edges should be preserved.
Default value: false
◆ PreserveBorders
| 
 | getset | 
Gets or sets if the border edges should be preserved.
Default value: false
◆ PreserveFoldovers
| 
 | getset | 
Gets or sets if the UV foldover edges should be preserved.
Default value: false
◆ PreserveSeams
| 
 | getset | 
Gets or sets if the UV seam edges should be preserved.
Default value: false
◆ PreserveUVFoldoverEdges
| 
 | getset | 
Gets or sets if the UV foldover edges should be preserved.
Default value: false
◆ PreserveUVSeamEdges
| 
 | getset | 
Gets or sets if the UV seam edges should be preserved.
Default value: false
◆ SubMeshCount
| 
 | get | 
Gets the count of sub-meshes.
◆ Tangents
| 
 | getset | 
Gets or sets the vertex tangents.
◆ UV1
| 
 | getset | 
Gets or sets the vertex 2D UV set 1.
◆ UV2
| 
 | getset | 
Gets or sets the vertex 2D UV set 2.
◆ UV3
| 
 | getset | 
Gets or sets the vertex 2D UV set 3.
◆ UV4
| 
 | getset | 
Gets or sets the vertex 2D UV set 4.
◆ Verbose
| 
 | getset | 
Gets or sets if verbose information should be printed to the console.
Default value: false
◆ VertexLinkDistance
| 
 | getset | 
Gets or sets the maximum distance between two vertices in order to link them.
Note that this value is only used if EnableSmartLink is true.
◆ VertexLinkDistanceSqr
| 
 | getset | 
Gets or sets the maximum squared distance between two vertices in order to link them.
Note that this value is only used if EnableSmartLink is true. Default value: double.Epsilon
◆ Vertices
| 
 | getset | 
Gets or sets the vertex positions.