From e6afb283557d01536ac4a43584840381ccb04ead Mon Sep 17 00:00:00 2001 From: Dahlia Trimble Date: Fri, 19 Sep 2008 09:13:27 +0000 Subject: re-enabled some ODE internal proxies for some simple prim types to try to save some more memory --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 4 + OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 107 ++++++++++++++------------ OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 13 ++++ 3 files changed, 74 insertions(+), 50 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index f64a92d..a2d6656 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -2022,6 +2022,10 @@ namespace OpenSim.Region.Physics.Meshing { Mesh mesh = null; +#if SPAM + reportPrimParams(primName, primShape); +#endif + if (primShape.SculptEntry && primShape.SculptType != (byte)0 && primShape.SculptData.Length > 0) { SculptMesh smesh = CreateSculptMesh(primName, primShape, size, lod); diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 79c4041..c1077f8 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1332,7 +1332,13 @@ namespace OpenSim.Region.Physics.OdePlugin if (IsPhysical) meshlod = _parent_scene.MeshSculptphysicalLOD; // Don't need to re-enable body.. it's done in SetMesh - IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); + + IMesh mesh = null; + + if(_parent_scene.needsMeshing(_pbs)) + mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); + + //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); if (mesh != null) { @@ -1691,55 +1697,56 @@ namespace OpenSim.Region.Physics.OdePlugin d.GeomSetQuaternion(prim_geom, ref myrot); } } - //else - //{ - // if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) - // { - // if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) - // { - // _parent_scene.waitForSpaceUnlock(m_targetSpace); - // SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2)); - // } - // else - // { - // _parent_scene.waitForSpaceUnlock(m_targetSpace); - // SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); - // } - // } - // //else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight) - // //{ - // //Cyllinder - // //if (_size.X == _size.Y) - // //{ - // //prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z); - // //} - // //else - // //{ - // //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); - // //} - // //} - // else - // { - // _parent_scene.waitForSpaceUnlock(m_targetSpace); - // SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); - // } - // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); - // d.Quaternion myrot = new d.Quaternion(); - // myrot.W = _orientation.w; - // myrot.X = _orientation.X; - // myrot.Y = _orientation.Y; - // myrot.Z = _orientation.Z; - // d.GeomSetQuaternion(prim_geom, ref myrot); - - // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); - // if (IsPhysical && Body == (IntPtr)0) - // { - // // Re creates body on size. - // // EnableBody also does setMass() - // enableBody(); - // d.BodyEnable(Body); - // } - //} + else + { + if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) + { + if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) + { + _parent_scene.waitForSpaceUnlock(m_targetSpace); + SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2)); + } + else + { + _parent_scene.waitForSpaceUnlock(m_targetSpace); + SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); + } + } + //else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight) + //{ + //Cyllinder + //if (_size.X == _size.Y) + //{ + //prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z); + //} + //else + //{ + //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); + //} + //} + else + { + _parent_scene.waitForSpaceUnlock(m_targetSpace); + SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); + } + d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + d.Quaternion myrot = new d.Quaternion(); + //myrot.W = _orientation.w; + myrot.W = _orientation.W; + myrot.X = _orientation.X; + myrot.Y = _orientation.Y; + myrot.Z = _orientation.Z; + d.GeomSetQuaternion(prim_geom, ref myrot); + + //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); + if (IsPhysical && Body == (IntPtr)0) + { + // Re creates body on size. + // EnableBody also does setMass() + enableBody(); + d.BodyEnable(Body); + } + } _parent_scene.geom_name_map[prim_geom] = oldname; diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 245c757..5212c29 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -1526,6 +1526,19 @@ namespace OpenSim.Region.Physics.OdePlugin return false; } + // if it's a standard box or sphere with no cuts or hollows or twist, return false since ODE can use an internal representation for the prim + if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) + || (pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight)) + { + if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0 + && pbs.ProfileHollow == 0 + && pbs.PathTwist == 0 && pbs.PathTwistBegin == 0 + && pbs.PathBegin == 0 && pbs.PathEnd == 0 + //&& pbs.PathTaperX == 0 && pbs.PathTaperY == 0 + && pbs.PathScaleX == 100 && pbs.PathScaleY == 100) + return false; + } + // if (pbs.ProfileHollow != 0) // return true; -- cgit v1.1