aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs20
1 files changed, 14 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 412f84d..09c8582 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -801,6 +801,8 @@ namespace OpenSim.Region.Physics.OdePlugin
801 m_collisionscore = 0; 801 m_collisionscore = 0;
802 } 802 }
803 803
804 private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>();
805
804 public void setMesh(OdeScene parent_scene, IMesh mesh) 806 public void setMesh(OdeScene parent_scene, IMesh mesh)
805 { 807 {
806 // This sleeper is there to moderate how long it takes between 808 // This sleeper is there to moderate how long it takes between
@@ -832,19 +834,24 @@ namespace OpenSim.Region.Physics.OdePlugin
832 mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage 834 mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
833 835
834 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory 836 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
837 if (m_MeshToTriMeshMap.ContainsKey(mesh))
838 {
839 _triMeshData = m_MeshToTriMeshMap[mesh];
840 }
841 else
842 {
843 _triMeshData = d.GeomTriMeshDataCreate();
835 844
836 _triMeshData = d.GeomTriMeshDataCreate(); 845 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
837 846 d.GeomTriMeshDataPreprocess(_triMeshData);
838 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); 847 m_MeshToTriMeshMap[mesh] = _triMeshData;
839 d.GeomTriMeshDataPreprocess(_triMeshData); 848 }
840 849
841 _parent_scene.waitForSpaceUnlock(m_targetSpace); 850 _parent_scene.waitForSpaceUnlock(m_targetSpace);
842
843 try 851 try
844 { 852 {
845 if (prim_geom == IntPtr.Zero) 853 if (prim_geom == IntPtr.Zero)
846 { 854 {
847//Console.WriteLine(" setMesh 1");
848 SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); 855 SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null));
849 } 856 }
850 } 857 }
@@ -854,6 +861,7 @@ namespace OpenSim.Region.Physics.OdePlugin
854 return; 861 return;
855 } 862 }
856 863
864
857 // if (IsPhysical && Body == (IntPtr) 0) 865 // if (IsPhysical && Body == (IntPtr) 0)
858 // { 866 // {
859 // Recreate the body 867 // Recreate the body