diff options
author | UbitUmarov | 2012-02-26 17:51:43 +0000 |
---|---|---|
committer | UbitUmarov | 2012-02-26 17:51:43 +0000 |
commit | 118986f15078a1df5561a64355e6f4777ae74fe1 (patch) | |
tree | 63becf0eda2470b2dcfebc230ce11dae38184575 /OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs | |
parent | Implement KeyframedMotion selection behavior (diff) | |
download | opensim-SC-118986f15078a1df5561a64355e6f4777ae74fe1.zip opensim-SC-118986f15078a1df5561a64355e6f4777ae74fe1.tar.gz opensim-SC-118986f15078a1df5561a64355e6f4777ae74fe1.tar.bz2 opensim-SC-118986f15078a1df5561a64355e6f4777ae74fe1.tar.xz |
added in chODE GeomTriMeshDataDestroy to explicity release internal trimesh data.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs | 33 |
1 files changed, 31 insertions, 2 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); |