aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/ChOdePlugin
diff options
context:
space:
mode:
authorMelanie2012-02-26 21:17:31 +0100
committerMelanie2012-02-26 21:17:31 +0100
commitd46235f5a34838dad76378f0e999d84bf70b500d (patch)
treed8d85e06b4351d8b175e6353c5f824f8580d7fda /OpenSim/Region/Physics/ChOdePlugin
parentMake llSetKeyframedMotion prims waut at the borders of down sims and try again (diff)
parentadded in chODE GeomTriMeshDataDestroy to explicity release internal trimesh d... (diff)
downloadopensim-SC-d46235f5a34838dad76378f0e999d84bf70b500d.zip
opensim-SC-d46235f5a34838dad76378f0e999d84bf70b500d.tar.gz
opensim-SC-d46235f5a34838dad76378f0e999d84bf70b500d.tar.bz2
opensim-SC-d46235f5a34838dad76378f0e999d84bf70b500d.tar.xz
Merge branch 'ubitwork'
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs33
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs11
2 files changed, 41 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index 636039b..86ab58d 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -704,6 +704,8 @@ namespace OpenSim.Region.Physics.OdePlugin
704 if (m_isphysical) 704 if (m_isphysical)
705 m_targetSpace = _parent_scene.space; 705 m_targetSpace = _parent_scene.space;
706 706
707 _triMeshData = IntPtr.Zero;
708
707 m_primName = primName; 709 m_primName = primName;
708 m_taintserial = null; 710 m_taintserial = null;
709 m_taintadd = true; 711 m_taintadd = true;
@@ -773,6 +775,8 @@ namespace OpenSim.Region.Physics.OdePlugin
773 m_targetSpace = _parent_scene.space; 775 m_targetSpace = _parent_scene.space;
774 } 776 }
775 777
778 _triMeshData = IntPtr.Zero;
779
776 m_taintserial = null; 780 m_taintserial = null;
777 m_primName = primName; 781 m_primName = primName;
778 m_taintadd = true; 782 m_taintadd = true;
@@ -1785,6 +1789,15 @@ namespace OpenSim.Region.Physics.OdePlugin
1785 disableBody(); 1789 disableBody();
1786 } 1790 }
1787 } 1791 }
1792
1793// do it on caller instead
1794/*
1795 if (_triMeshData != IntPtr.Zero)
1796 {
1797 d.GeomTriMeshDataDestroy(_triMeshData);
1798 _triMeshData = IntPtr.Zero;
1799 }
1800*/
1788 IntPtr vertices, indices; 1801 IntPtr vertices, indices;
1789 int vertexCount, indexCount; 1802 int vertexCount, indexCount;
1790 int vertexStride, triStride; 1803 int vertexStride, triStride;
@@ -1801,14 +1814,17 @@ namespace OpenSim.Region.Physics.OdePlugin
1801 } 1814 }
1802 1815
1803 1816
1804/* 1817 // warning this destroys the mesh for eventual future use. Only pinned float arrays stay valid
1805 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory 1818 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
1819/*
1806 if (m_MeshToTriMeshMap.ContainsKey(mesh)) 1820 if (m_MeshToTriMeshMap.ContainsKey(mesh))
1807 { 1821 {
1808 _triMeshData = m_MeshToTriMeshMap[mesh]; 1822 _triMeshData = m_MeshToTriMeshMap[mesh];
1809 } 1823 }
1810 else 1824 else
1811 */ 1825*/
1826
1827
1812 { 1828 {
1813 _triMeshData = d.GeomTriMeshDataCreate(); 1829 _triMeshData = d.GeomTriMeshDataCreate();
1814 1830
@@ -1829,6 +1845,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1829 catch (AccessViolationException) 1845 catch (AccessViolationException)
1830 { 1846 {
1831 m_log.Error("[PHYSICS]: MESH LOCKED"); 1847 m_log.Error("[PHYSICS]: MESH LOCKED");
1848
1849 if (_triMeshData != IntPtr.Zero)
1850 {
1851 d.GeomTriMeshDataDestroy(_triMeshData);
1852 _triMeshData = IntPtr.Zero;
1853 }
1854
1832 return false; 1855 return false;
1833 } 1856 }
1834 1857
@@ -2302,6 +2325,12 @@ namespace OpenSim.Region.Physics.OdePlugin
2302 { 2325 {
2303 bool gottrimesh = false; 2326 bool gottrimesh = false;
2304 2327
2328 if (_triMeshData != IntPtr.Zero)
2329 {
2330 d.GeomTriMeshDataDestroy(_triMeshData);
2331 _triMeshData = IntPtr.Zero;
2332 }
2333
2305 if (_mesh != null) // Special - make mesh 2334 if (_mesh != null) // Special - make mesh
2306 { 2335 {
2307 gottrimesh = setMesh(_parent_scene, _mesh); 2336 gottrimesh = setMesh(_parent_scene, _mesh);
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
index 61fb2d0..f84918c 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
@@ -2174,6 +2174,16 @@ namespace OpenSim.Region.Physics.OdePlugin
2174 { 2174 {
2175 prim.ResetTaints(); 2175 prim.ResetTaints();
2176 2176
2177 try
2178 {
2179 if (prim._triMeshData != IntPtr.Zero)
2180 {
2181 d.GeomTriMeshDataDestroy(prim._triMeshData);
2182 prim._triMeshData = IntPtr.Zero;
2183 }
2184 }
2185 catch { };
2186
2177 if (prim.IsPhysical) 2187 if (prim.IsPhysical)
2178 { 2188 {
2179 prim.disableBody(); 2189 prim.disableBody();
@@ -2185,7 +2195,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2185 prim.IsPhysical = false; 2195 prim.IsPhysical = false;
2186 } 2196 }
2187 2197
2188
2189 } 2198 }
2190 // we don't want to remove the main space 2199 // we don't want to remove the main space
2191 2200