diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 85 |
1 files changed, 1 insertions, 84 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index c14abd0..010262f 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |||
@@ -73,8 +73,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
73 | private bool doConvexPrims = true; | 73 | private bool doConvexPrims = true; |
74 | private bool doConvexSculpts = true; | 74 | private bool doConvexSculpts = true; |
75 | 75 | ||
76 | private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh | ||
77 | |||
78 | private Dictionary<AMeshKey, Mesh> m_uniqueMeshes = new Dictionary<AMeshKey, Mesh>(); | 76 | private Dictionary<AMeshKey, Mesh> m_uniqueMeshes = new Dictionary<AMeshKey, Mesh>(); |
79 | private Dictionary<AMeshKey, Mesh> m_uniqueReleasedMeshes = new Dictionary<AMeshKey, Mesh>(); | 77 | private Dictionary<AMeshKey, Mesh> m_uniqueReleasedMeshes = new Dictionary<AMeshKey, Mesh>(); |
80 | 78 | ||
@@ -164,87 +162,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
164 | 162 | ||
165 | #endregion | 163 | #endregion |
166 | 164 | ||
167 | /// <summary> | ||
168 | /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may | ||
169 | /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail | ||
170 | /// for some reason | ||
171 | /// </summary> | ||
172 | /// <param name="minX"></param> | ||
173 | /// <param name="maxX"></param> | ||
174 | /// <param name="minY"></param> | ||
175 | /// <param name="maxY"></param> | ||
176 | /// <param name="minZ"></param> | ||
177 | /// <param name="maxZ"></param> | ||
178 | /// <returns></returns> | ||
179 | private static Mesh CreateSimpleBoxMesh(float minX, float maxX, float minY, float maxY, float minZ, float maxZ) | ||
180 | { | ||
181 | Mesh box = new Mesh(true); | ||
182 | List<Vertex> vertices = new List<Vertex>(); | ||
183 | // bottom | ||
184 | |||
185 | vertices.Add(new Vertex(minX, maxY, minZ)); | ||
186 | vertices.Add(new Vertex(maxX, maxY, minZ)); | ||
187 | vertices.Add(new Vertex(maxX, minY, minZ)); | ||
188 | vertices.Add(new Vertex(minX, minY, minZ)); | ||
189 | |||
190 | box.Add(new Triangle(vertices[0], vertices[1], vertices[2])); | ||
191 | box.Add(new Triangle(vertices[0], vertices[2], vertices[3])); | ||
192 | |||
193 | // top | ||
194 | |||
195 | vertices.Add(new Vertex(maxX, maxY, maxZ)); | ||
196 | vertices.Add(new Vertex(minX, maxY, maxZ)); | ||
197 | vertices.Add(new Vertex(minX, minY, maxZ)); | ||
198 | vertices.Add(new Vertex(maxX, minY, maxZ)); | ||
199 | |||
200 | box.Add(new Triangle(vertices[4], vertices[5], vertices[6])); | ||
201 | box.Add(new Triangle(vertices[4], vertices[6], vertices[7])); | ||
202 | |||
203 | // sides | ||
204 | |||
205 | box.Add(new Triangle(vertices[5], vertices[0], vertices[3])); | ||
206 | box.Add(new Triangle(vertices[5], vertices[3], vertices[6])); | ||
207 | |||
208 | box.Add(new Triangle(vertices[1], vertices[0], vertices[5])); | ||
209 | box.Add(new Triangle(vertices[1], vertices[5], vertices[4])); | ||
210 | |||
211 | box.Add(new Triangle(vertices[7], vertices[1], vertices[4])); | ||
212 | box.Add(new Triangle(vertices[7], vertices[2], vertices[1])); | ||
213 | |||
214 | box.Add(new Triangle(vertices[3], vertices[2], vertices[7])); | ||
215 | box.Add(new Triangle(vertices[3], vertices[7], vertices[6])); | ||
216 | |||
217 | return box; | ||
218 | } | ||
219 | |||
220 | /// <summary> | ||
221 | /// Creates a simple bounding box mesh for a complex input mesh | ||
222 | /// </summary> | ||
223 | /// <param name="meshIn"></param> | ||
224 | /// <returns></returns> | ||
225 | private static Mesh CreateBoundingBoxMesh(Mesh meshIn) | ||
226 | { | ||
227 | float minX = float.MaxValue; | ||
228 | float maxX = float.MinValue; | ||
229 | float minY = float.MaxValue; | ||
230 | float maxY = float.MinValue; | ||
231 | float minZ = float.MaxValue; | ||
232 | float maxZ = float.MinValue; | ||
233 | |||
234 | foreach (Vector3 v in meshIn.getVertexList()) | ||
235 | { | ||
236 | if (v.X < minX) minX = v.X; | ||
237 | if (v.Y < minY) minY = v.Y; | ||
238 | if (v.Z < minZ) minZ = v.Z; | ||
239 | |||
240 | if (v.X > maxX) maxX = v.X; | ||
241 | if (v.Y > maxY) maxY = v.Y; | ||
242 | if (v.Z > maxZ) maxZ = v.Z; | ||
243 | } | ||
244 | |||
245 | return CreateSimpleBoxMesh(minX, maxX, minY, maxY, minZ, maxZ); | ||
246 | } | ||
247 | |||
248 | private void ReportPrimError(string message, string primName, PrimMesh primMesh) | 165 | private void ReportPrimError(string message, string primName, PrimMesh primMesh) |
249 | { | 166 | { |
250 | m_log.Error(message); | 167 | m_log.Error(message); |
@@ -261,7 +178,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
261 | /// <param name="faces"></param> | 178 | /// <param name="faces"></param> |
262 | private void AddSubMesh(OSDMap subMeshData, List<Coord> coords, List<Face> faces) | 179 | private void AddSubMesh(OSDMap subMeshData, List<Coord> coords, List<Face> faces) |
263 | { | 180 | { |
264 | // Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap)); | 181 | // Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap)); |
265 | 182 | ||
266 | // As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level | 183 | // As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level |
267 | // of Detail Blocks (maps) contain just a NoGeometry key to signal there is no | 184 | // of Detail Blocks (maps) contain just a NoGeometry key to signal there is no |