aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs26
1 files changed, 21 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index 41afe76..636039b 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -1762,7 +1762,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1762 1762
1763 private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); 1763 private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>();
1764 1764
1765 public void setMesh(OdeScene parent_scene, IMesh mesh) 1765 public bool setMesh(OdeScene parent_scene, IMesh mesh)
1766 { 1766 {
1767 // This sleeper is there to moderate how long it takes between 1767 // This sleeper is there to moderate how long it takes between
1768 // setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object 1768 // setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object
@@ -1791,18 +1791,30 @@ namespace OpenSim.Region.Physics.OdePlugin
1791 mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap 1791 mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap
1792 mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage 1792 mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
1793 1793
1794 if (vertexCount == 0 || indexCount == 0)
1795 {
1796 m_log.WarnFormat("[PHYSICS]: Got invalid mesh on prim {0} at <{1},{2},{3}>. It can be a sculp with alpha channel in map. Replacing it by a small box.", Name, _position.X, _position.Y, _position.Z);
1797 _size.X = 0.01f;
1798 _size.Y = 0.01f;
1799 _size.Z = 0.01f;
1800 return false;
1801 }
1802
1803
1804/*
1794 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory 1805 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
1795 if (m_MeshToTriMeshMap.ContainsKey(mesh)) 1806 if (m_MeshToTriMeshMap.ContainsKey(mesh))
1796 { 1807 {
1797 _triMeshData = m_MeshToTriMeshMap[mesh]; 1808 _triMeshData = m_MeshToTriMeshMap[mesh];
1798 } 1809 }
1799 else 1810 else
1811 */
1800 { 1812 {
1801 _triMeshData = d.GeomTriMeshDataCreate(); 1813 _triMeshData = d.GeomTriMeshDataCreate();
1802 1814
1803 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); 1815 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
1804 d.GeomTriMeshDataPreprocess(_triMeshData); 1816 d.GeomTriMeshDataPreprocess(_triMeshData);
1805 m_MeshToTriMeshMap[mesh] = _triMeshData; 1817// m_MeshToTriMeshMap[mesh] = _triMeshData;
1806 } 1818 }
1807 1819
1808 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1820 _parent_scene.waitForSpaceUnlock(m_targetSpace);
@@ -1817,7 +1829,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1817 catch (AccessViolationException) 1829 catch (AccessViolationException)
1818 { 1830 {
1819 m_log.Error("[PHYSICS]: MESH LOCKED"); 1831 m_log.Error("[PHYSICS]: MESH LOCKED");
1820 return; 1832 return false;
1821 } 1833 }
1822 1834
1823 1835
@@ -1829,6 +1841,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1829 1841
1830 // enableBody(); 1842 // enableBody();
1831 // } 1843 // }
1844 return true;
1832 } 1845 }
1833 1846
1834 public void ProcessTaints(float timestep) //============================================================================= 1847 public void ProcessTaints(float timestep) //=============================================================================
@@ -2287,11 +2300,14 @@ namespace OpenSim.Region.Physics.OdePlugin
2287 2300
2288 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) 2301 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
2289 { 2302 {
2303 bool gottrimesh = false;
2304
2290 if (_mesh != null) // Special - make mesh 2305 if (_mesh != null) // Special - make mesh
2291 { 2306 {
2292 setMesh(_parent_scene, _mesh); 2307 gottrimesh = setMesh(_parent_scene, _mesh);
2293 } 2308 }
2294 else // not a mesh 2309
2310 if(!gottrimesh) // not a mesh
2295 { 2311 {
2296 if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) // special profile?? 2312 if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) // special profile??
2297 { 2313 {