aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2008-05-25 02:39:58 +0000
committerTeravus Ovares2008-05-25 02:39:58 +0000
commitd3b013be1cdbf2c89847a3e900a6eeacdad5486e (patch)
tree1796d19c3397caa5b92e168a0aa07be4b59b6172
parent* Disabling isSelected check on object persistence backup (at least temporari... (diff)
downloadopensim-SC-d3b013be1cdbf2c89847a3e900a6eeacdad5486e.zip
opensim-SC-d3b013be1cdbf2c89847a3e900a6eeacdad5486e.tar.gz
opensim-SC-d3b013be1cdbf2c89847a3e900a6eeacdad5486e.tar.bz2
opensim-SC-d3b013be1cdbf2c89847a3e900a6eeacdad5486e.tar.xz
* Releases Pinned vertex/index list in ODE on next mesh request.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Manager/IMesher.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs14
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs17
3 files changed, 28 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
index ee498c5..b5fc95c 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/Physics/Manager/IMesher.cs
@@ -46,5 +46,7 @@ namespace OpenSim.Region.Physics.Manager
46 int[] getIndexListAsInt(); 46 int[] getIndexListAsInt();
47 int[] getIndexListAsIntLocked(); 47 int[] getIndexListAsIntLocked();
48 float[] getVertexListAsFloatLocked(); 48 float[] getVertexListAsFloatLocked();
49 void releasePinned();
50
49 } 51 }
50} 52}
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index 1b0444b..652bbd7 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -37,7 +37,8 @@ namespace OpenSim.Region.Physics.Meshing
37 { 37 {
38 public List<Vertex> vertices; 38 public List<Vertex> vertices;
39 public List<Triangle> triangles; 39 public List<Triangle> triangles;
40 40 GCHandle pinnedVirtexes;
41 GCHandle pinnedIndex;
41 public float[] normals; 42 public float[] normals;
42 43
43 public Mesh() 44 public Mesh()
@@ -164,7 +165,7 @@ namespace OpenSim.Region.Physics.Meshing
164 result[3*i + 1] = v.Y; 165 result[3*i + 1] = v.Y;
165 result[3*i + 2] = v.Z; 166 result[3*i + 2] = v.Z;
166 } 167 }
167 GCHandle.Alloc(result, GCHandleType.Pinned); 168 pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned);
168 return result; 169 return result;
169 } 170 }
170 171
@@ -184,10 +185,17 @@ namespace OpenSim.Region.Physics.Meshing
184 public int[] getIndexListAsIntLocked() 185 public int[] getIndexListAsIntLocked()
185 { 186 {
186 int[] result = getIndexListAsInt(); 187 int[] result = getIndexListAsInt();
187 GCHandle.Alloc(result, GCHandleType.Pinned); 188 pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
188 return result; 189 return result;
189 } 190 }
190 191
192 public void releasePinned()
193 {
194 pinnedVirtexes.Free();
195 pinnedIndex.Free();
196
197 }
198
191 199
192 public void Append(Mesh newMesh) 200 public void Append(Mesh newMesh)
193 { 201 {
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 1ba4bb1..4c8eb20 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -69,6 +69,7 @@ namespace OpenSim.Region.Physics.OdePlugin
69 private float PID_G = 25f; 69 private float PID_G = 25f;
70 private float m_tensor = 5f; 70 private float m_tensor = 5f;
71 private int body_autodisable_frames = 20; 71 private int body_autodisable_frames = 20;
72 private IMesh primMesh = null;
72 73
73 private bool m_usePID = false; 74 private bool m_usePID = false;
74 75
@@ -674,8 +675,13 @@ namespace OpenSim.Region.Physics.OdePlugin
674 disableBody(); 675 disableBody();
675 } 676 }
676 677
677 float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory 678 IMesh oldMesh = primMesh;
678 int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage 679
680 primMesh = mesh;
681
682 float[] vertexList = primMesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
683 int[] indexList = primMesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
684
679 int VertexCount = vertexList.GetLength(0)/3; 685 int VertexCount = vertexList.GetLength(0)/3;
680 int IndexCount = indexList.GetLength(0); 686 int IndexCount = indexList.GetLength(0);
681 687
@@ -699,6 +705,13 @@ namespace OpenSim.Region.Physics.OdePlugin
699 m_log.Error("[PHYSICS]: MESH LOCKED"); 705 m_log.Error("[PHYSICS]: MESH LOCKED");
700 return; 706 return;
701 } 707 }
708
709 if (oldMesh != null)
710 {
711 oldMesh.releasePinned();
712 oldMesh = null;
713 }
714
702 if (IsPhysical && Body == (IntPtr) 0) 715 if (IsPhysical && Body == (IntPtr) 0)
703 { 716 {
704 // Recreate the body 717 // Recreate the body