@@ -110,6 +110,7 @@ public SimplificationOptions SimplificationOptions
110110 /// Gets or sets if the border edges should be preserved.
111111 /// Default value: false
112112 /// </summary>
113+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
113114 public bool PreserveBorderEdges
114115 {
115116 get { return simplificationOptions . PreserveBorderEdges ; }
@@ -120,6 +121,7 @@ public bool PreserveBorderEdges
120121 /// Gets or sets if the UV seam edges should be preserved.
121122 /// Default value: false
122123 /// </summary>
124+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
123125 public bool PreserveUVSeamEdges
124126 {
125127 get { return simplificationOptions . PreserveUVSeamEdges ; }
@@ -130,6 +132,7 @@ public bool PreserveUVSeamEdges
130132 /// Gets or sets if the UV foldover edges should be preserved.
131133 /// Default value: false
132134 /// </summary>
135+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
133136 public bool PreserveUVFoldoverEdges
134137 {
135138 get { return simplificationOptions . PreserveUVFoldoverEdges ; }
@@ -140,6 +143,7 @@ public bool PreserveUVFoldoverEdges
140143 /// Gets or sets if the discrete curvature of the mesh surface be taken into account during simplification.
141144 /// Default value: false
142145 /// </summary>
146+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
143147 public bool PreserveSurfaceCurvature
144148 {
145149 get { return simplificationOptions . PreserveSurfaceCurvature ; }
@@ -152,6 +156,7 @@ public bool PreserveSurfaceCurvature
152156 /// the same position as the same vertex while separating the attributes.
153157 /// Default value: true
154158 /// </summary>
159+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
155160 public bool EnableSmartLink
156161 {
157162 get { return simplificationOptions . EnableSmartLink ; }
@@ -163,6 +168,7 @@ public bool EnableSmartLink
163168 /// Sometimes a lower maximum count might be desired in order to lower the performance cost.
164169 /// Default value: 100
165170 /// </summary>
171+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
166172 public int MaxIterationCount
167173 {
168174 get { return simplificationOptions . MaxIterationCount ; }
@@ -173,6 +179,7 @@ public int MaxIterationCount
173179 /// Gets or sets the agressiveness of the mesh simplification. Higher number equals higher quality, but more expensive to run.
174180 /// Default value: 7.0
175181 /// </summary>
182+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
176183 public double Agressiveness
177184 {
178185 get { return simplificationOptions . Agressiveness ; }
@@ -193,6 +200,7 @@ public bool Verbose
193200 /// Gets or sets the maximum distance between two vertices in order to link them.
194201 /// Note that this value is only used if EnableSmartLink is true.
195202 /// </summary>
203+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
196204 public double VertexLinkDistance
197205 {
198206 get { return simplificationOptions . VertexLinkDistance ; }
@@ -204,6 +212,7 @@ public double VertexLinkDistance
204212 /// Note that this value is only used if EnableSmartLink is true.
205213 /// Default value: double.Epsilon
206214 /// </summary>
215+ [ Obsolete ( "Use MeshSimplifier.SimplificationOptions instead." , false ) ]
207216 public double VertexLinkDistanceSqr
208217 {
209218 get { return simplificationOptions . VertexLinkDistance * simplificationOptions . VertexLinkDistance ; }
@@ -773,9 +782,6 @@ private void RemoveVertexPass(int startTrisCount, int targetTrisCount, double th
773782
774783 Vector3d p ;
775784 Vector3 barycentricCoord ;
776- var preserveBorderEdges = PreserveBorderEdges ;
777- var preserveUVSeamEdges = PreserveUVSeamEdges ;
778- var preserveUVFoldoverEdges = PreserveUVFoldoverEdges ;
779785 for ( int tid = 0 ; tid < triangleCount ; tid ++ )
780786 {
781787 if ( triangles [ tid ] . dirty || triangles [ tid ] . deleted || triangles [ tid ] . err3 > threshold )
@@ -802,13 +808,13 @@ private void RemoveVertexPass(int startTrisCount, int targetTrisCount, double th
802808 else if ( vertices [ i0 ] . uvFoldoverEdge != vertices [ i1 ] . uvFoldoverEdge )
803809 continue ;
804810 // If borders should be preserved
805- else if ( preserveBorderEdges && vertices [ i0 ] . borderEdge )
811+ else if ( simplificationOptions . PreserveBorderEdges && vertices [ i0 ] . borderEdge )
806812 continue ;
807813 // If seams should be preserved
808- else if ( preserveUVSeamEdges && vertices [ i0 ] . uvSeamEdge )
814+ else if ( simplificationOptions . PreserveUVSeamEdges && vertices [ i0 ] . uvSeamEdge )
809815 continue ;
810816 // If foldovers should be preserved
811- else if ( preserveUVFoldoverEdges && vertices [ i0 ] . uvFoldoverEdge )
817+ else if ( simplificationOptions . PreserveUVFoldoverEdges && vertices [ i0 ] . uvFoldoverEdge )
812818 continue ;
813819
814820 // Compute vertex to collapse to
@@ -927,8 +933,7 @@ private void UpdateMesh(int iteration)
927933 int borderVertexCount = 0 ;
928934 double borderMinX = double . MaxValue ;
929935 double borderMaxX = double . MinValue ;
930- var enableSmartLink = EnableSmartLink ;
931- var vertexLinkDistanceSqr = VertexLinkDistanceSqr ;
936+ var vertexLinkDistanceSqr = simplificationOptions . VertexLinkDistance * simplificationOptions . VertexLinkDistance ;
932937 for ( int i = 0 ; i < vertexCount ; i ++ )
933938 {
934939 int tstart = vertices [ i ] . tstart ;
@@ -973,7 +978,7 @@ private void UpdateMesh(int iteration)
973978 vertices [ id ] . borderEdge = true ;
974979 ++ borderVertexCount ;
975980
976- if ( enableSmartLink )
981+ if ( simplificationOptions . EnableSmartLink )
977982 {
978983 if ( vertices [ id ] . p . x < borderMinX )
979984 {
@@ -988,7 +993,7 @@ private void UpdateMesh(int iteration)
988993 }
989994 }
990995
991- if ( enableSmartLink )
996+ if ( simplificationOptions . EnableSmartLink )
992997 {
993998 // First find all border vertices
994999 var borderVertices = new BorderVertex [ borderVertexCount ] ;
@@ -2084,9 +2089,7 @@ public void SimplifyMesh(float quality)
20842089 var vertices = this . vertices . Data ;
20852090 int targetTrisCount = Mathf . RoundToInt ( triangleCount * quality ) ;
20862091
2087- var maxIterationCount = MaxIterationCount ;
2088- var agressiveness = Agressiveness ;
2089- for ( int iteration = 0 ; iteration < maxIterationCount ; iteration ++ )
2092+ for ( int iteration = 0 ; iteration < simplificationOptions . MaxIterationCount ; iteration ++ )
20902093 {
20912094 if ( ( startTrisCount - deletedTris ) <= targetTrisCount )
20922095 break ;
@@ -2110,7 +2113,7 @@ public void SimplifyMesh(float quality)
21102113 //
21112114 // The following numbers works well for most models.
21122115 // If it does not, try to adjust the 3 parameters
2113- double threshold = 0.000000001 * Math . Pow ( iteration + 3 , agressiveness ) ;
2116+ double threshold = 0.000000001 * Math . Pow ( iteration + 3 , simplificationOptions . Agressiveness ) ;
21142117
21152118 if ( verbose )
21162119 {
0 commit comments