aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
diff options
context:
space:
mode:
authorUbitUmarov2015-10-15 19:06:39 +0100
committerUbitUmarov2015-10-15 19:06:39 +0100
commitf39e6bc482c0f525ccc9676225cdc369dc271224 (patch)
tree76030de83fec3763bbbfdc01e98f2e3bc7c863df /OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
parentMore exception catching in ODE at shutdown. Not sure why the exception happens. (diff)
downloadopensim-SC-f39e6bc482c0f525ccc9676225cdc369dc271224.zip
opensim-SC-f39e6bc482c0f525ccc9676225cdc369dc271224.tar.gz
opensim-SC-f39e6bc482c0f525ccc9676225cdc369dc271224.tar.bz2
opensim-SC-f39e6bc482c0f525ccc9676225cdc369dc271224.tar.xz
bug fix. Some rare meshs reported as having +-infinity dimensions
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs34
1 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
index b860255..97501a4 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
@@ -125,9 +125,22 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
125 float y = scale.Y; 125 float y = scale.Y;
126 float z = scale.Z; 126 float z = scale.Z;
127 127
128 result.m_obb.X = m_obb.X * x; 128 float tmp;
129 result.m_obb.Y = m_obb.Y * y; 129 tmp = m_obb.X * x;
130 result.m_obb.Z = m_obb.Z * z; 130 if(tmp < 0.0005f)
131 tmp = 0.0005f;
132 result.m_obb.X = tmp;
133
134 tmp = m_obb.Y * y;
135 if(tmp < 0.0005f)
136 tmp = 0.0005f;
137 result.m_obb.Y = tmp;
138
139 tmp = m_obb.Z * z;
140 if(tmp < 0.0005f)
141 tmp = 0.0005f;
142 result.m_obb.Z = tmp;
143
131 result.m_obboffset.X = m_obboffset.X * x; 144 result.m_obboffset.X = m_obboffset.X * x;
132 result.m_obboffset.Y = m_obboffset.Y * y; 145 result.m_obboffset.Y = m_obboffset.Y * y;
133 result.m_obboffset.Z = m_obboffset.Z * z; 146 result.m_obboffset.Z = m_obboffset.Z * z;
@@ -190,17 +203,17 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
190 203
191 if (x > m_bdata.m_obbXmax) 204 if (x > m_bdata.m_obbXmax)
192 m_bdata.m_obbXmax = x; 205 m_bdata.m_obbXmax = x;
193 else if (x < m_bdata.m_obbXmin) 206 if (x < m_bdata.m_obbXmin)
194 m_bdata.m_obbXmin = x; 207 m_bdata.m_obbXmin = x;
195 208
196 if (y > m_bdata.m_obbYmax) 209 if (y > m_bdata.m_obbYmax)
197 m_bdata.m_obbYmax = y; 210 m_bdata.m_obbYmax = y;
198 else if (y < m_bdata.m_obbYmin) 211 if (y < m_bdata.m_obbYmin)
199 m_bdata.m_obbYmin = y; 212 m_bdata.m_obbYmin = y;
200 213
201 if (z > m_bdata.m_obbZmax) 214 if (z > m_bdata.m_obbZmax)
202 m_bdata.m_obbZmax = z; 215 m_bdata.m_obbZmax = z;
203 else if (z < m_bdata.m_obbZmin) 216 if (z < m_bdata.m_obbZmin)
204 m_bdata.m_obbZmin = z; 217 m_bdata.m_obbZmin = z;
205 218
206 } 219 }
@@ -262,6 +275,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
262 public Vector3 GetOBB() 275 public Vector3 GetOBB()
263 { 276 {
264 return m_obb; 277 return m_obb;
278/*
265 float x, y, z; 279 float x, y, z;
266 if (m_bdata.m_centroidDiv > 0) 280 if (m_bdata.m_centroidDiv > 0)
267 { 281 {
@@ -276,6 +290,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
276 z = 0.5f; 290 z = 0.5f;
277 } 291 }
278 return new Vector3(x, y, z); 292 return new Vector3(x, y, z);
293*/
279 } 294 }
280 295
281 public int numberVertices() 296 public int numberVertices()
@@ -502,8 +517,14 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
502 { 517 {
503 m_obboffset = new Vector3(m_bdata.m_centroid.X / m_bdata.m_centroidDiv, m_bdata.m_centroid.Y / m_bdata.m_centroidDiv, m_bdata.m_centroid.Z / m_bdata.m_centroidDiv); 518 m_obboffset = new Vector3(m_bdata.m_centroid.X / m_bdata.m_centroidDiv, m_bdata.m_centroid.Y / m_bdata.m_centroidDiv, m_bdata.m_centroid.Z / m_bdata.m_centroidDiv);
504 x = (m_bdata.m_obbXmax - m_bdata.m_obbXmin) * 0.5f; 519 x = (m_bdata.m_obbXmax - m_bdata.m_obbXmin) * 0.5f;
520 if(x < 0.0005f)
521 x = 0.0005f;
505 y = (m_bdata.m_obbYmax - m_bdata.m_obbYmin) * 0.5f; 522 y = (m_bdata.m_obbYmax - m_bdata.m_obbYmin) * 0.5f;
523 if(y < 0.0005f)
524 y = 0.0005f;
506 z = (m_bdata.m_obbZmax - m_bdata.m_obbZmin) * 0.5f; 525 z = (m_bdata.m_obbZmax - m_bdata.m_obbZmin) * 0.5f;
526 if(z < 0.0005f)
527 z = 0.0005f;
507 } 528 }
508 529
509 else 530 else
@@ -513,6 +534,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
513 y = 0.5f; 534 y = 0.5f;
514 z = 0.5f; 535 z = 0.5f;
515 } 536 }
537
516 m_obb = new Vector3(x, y, z); 538 m_obb = new Vector3(x, y, z);
517 539
518 releaseBuildingMeshData(); 540 releaseBuildingMeshData();