aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDahlia Trimble2008-07-12 01:58:20 +0000
committerDahlia Trimble2008-07-12 01:58:20 +0000
commit13399ff4393b0fbf6e2caf79542f62e9b4ba4281 (patch)
tree546a8a6d08c1d9acdff47e06a1f9c9be364df3f7
parentPatch #9142 (No mantis) (diff)
downloadopensim-SC_OLD-13399ff4393b0fbf6e2caf79542f62e9b4ba4281.zip
opensim-SC_OLD-13399ff4393b0fbf6e2caf79542f62e9b4ba4281.tar.gz
opensim-SC_OLD-13399ff4393b0fbf6e2caf79542f62e9b4ba4281.tar.bz2
opensim-SC_OLD-13399ff4393b0fbf6e2caf79542f62e9b4ba4281.tar.xz
Passes prim physical status to mesher from physics plugins
Small prims now get a full mesh if they are physical Fixed a logic bug that was preventing many prim meshes from having excess memory cleaned up Switched to more conservative method of vertex and triangle list trimming to prevent possible crash
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs32
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs2
4 files changed, 21 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 144ad53..5ef196f 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -621,7 +621,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
621 } 621 }
622 else 622 else
623 { 623 {
624 IMesh mesh = mesher.CreateMesh(primName, pbs, size, 32f); 624 IMesh mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical);
625 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); 625 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical);
626 } 626 }
627 break; 627 break;
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 42b6a90..045a25d 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -2178,30 +2178,32 @@ namespace OpenSim.Region.Physics.Meshing
2178 //} 2178 //}
2179 2179
2180 if (mesh != null) 2180 if (mesh != null)
2181 if (size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh) 2181 {
2182 if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
2182 { 2183 {
2183#if SPAM 2184#if SPAM
2184 Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + minSizeForComplexMesh.ToString() + " - creating simple bounding box" ); 2185 Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + minSizeForComplexMesh.ToString() + " - creating simple bounding box" );
2185#endif 2186#endif
2186 mesh = CreateBoundingBoxMesh(mesh); 2187 mesh = CreateBoundingBoxMesh(mesh);
2187 mesh.DumpRaw(baseDir, primName, "Z extruded"); 2188 mesh.DumpRaw(baseDir, primName, "Z extruded");
2189 }
2188 2190
2189 // trim the vertex and triangle lists to free up memory 2191 // trim the vertex and triangle lists to free up memory
2190 //mesh.vertices.TrimExcess(); 2192 mesh.vertices.TrimExcess();
2191 //mesh.triangles.TrimExcess(); 2193 mesh.triangles.TrimExcess();
2192 2194
2193 int vertCount = 0; 2195 //int vertCount = 0;
2194 foreach (Vertex v in mesh.vertices) 2196 //foreach (Vertex v in mesh.vertices)
2195 if (v != null) 2197 // if (v != null)
2196 vertCount++; 2198 // vertCount++;
2197 mesh.vertices.Capacity = vertCount; 2199 //mesh.vertices.Capacity = vertCount;
2198 2200
2199 int triCount = 0; 2201 //int triCount = 0;
2200 foreach (Triangle t in mesh.triangles) 2202 //foreach (Triangle t in mesh.triangles)
2201 if ( t != null ) 2203 // if (t != null)
2202 triCount++; 2204 // triCount++;
2203 mesh.triangles.Capacity = triCount; 2205 //mesh.triangles.Capacity = triCount;
2204 } 2206 }
2205 2207
2206 return mesh; 2208 return mesh;
2207 } 2209 }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index d063507..f7fbaf1 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -922,7 +922,7 @@ namespace OpenSim.Region.Physics.OdePlugin
922 if (_parent_scene.needsMeshing(_pbs)) 922 if (_parent_scene.needsMeshing(_pbs))
923 { 923 {
924 // Don't need to re-enable body.. it's done in SetMesh 924 // Don't need to re-enable body.. it's done in SetMesh
925 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD); 925 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
926 // createmesh returns null when it's a shape that isn't a cube. 926 // createmesh returns null when it's a shape that isn't a cube.
927 } 927 }
928 } 928 }
@@ -1496,7 +1496,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1496 if (IsPhysical) 1496 if (IsPhysical)
1497 meshlod = _parent_scene.MeshSculptphysicalLOD; 1497 meshlod = _parent_scene.MeshSculptphysicalLOD;
1498 1498
1499 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod); 1499 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1500 // createmesh returns null when it's a shape that isn't a cube. 1500 // createmesh returns null when it's a shape that isn't a cube.
1501 if (mesh != null) 1501 if (mesh != null)
1502 { 1502 {
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 3dd80ea..cd5032c 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1177,7 +1177,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1177 /// support simple box & hollow box now; later, more shapes 1177 /// support simple box & hollow box now; later, more shapes
1178 if (needsMeshing(pbs)) 1178 if (needsMeshing(pbs))
1179 { 1179 {
1180 mesh = mesher.CreateMesh(primName, pbs, size, 32f); 1180 mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical);
1181 } 1181 }
1182 1182
1183 break; 1183 break;