Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Physics/Manager/IMesher.cs
avinationmerge
Melanie 2012-11-30 01:54:13 +00:00
commit 56b2bc7101
8 changed files with 44 additions and 29 deletions

View File

@ -742,22 +742,22 @@ namespace OpenSim.Region.Physics.BulletSPlugin
else else
{ {
float verticalError = pos.Z - m_VhoverTargetHeight; float verticalError = pos.Z - m_VhoverTargetHeight;
// RA: where does the 50 come from? float verticalCorrectionVelocity = pTimestep * (verticalError / m_VhoverTimescale);
float verticalCorrectionVelocity = pTimestep * ((verticalError * 50.0f) / m_VhoverTimescale);
// Replace Vertical speed with correction figure if significant // TODO: implement m_VhoverEfficiency
if (verticalError > 0.01f) if (verticalError > 0.01f)
{ {
ret = new Vector3(0f, 0f, verticalCorrectionVelocity); // If error is positive (we're above the target height), push down
//KF: m_VhoverEfficiency is not yet implemented ret = new Vector3(0f, 0f, -verticalCorrectionVelocity);
} }
else if (verticalError < -0.01) else if (verticalError < -0.01)
{ {
ret = new Vector3(0f, 0f, -verticalCorrectionVelocity); ret = new Vector3(0f, 0f, verticalCorrectionVelocity);
} }
} }
VDetailLog("{0},MoveLinear,hover,pos={1},dir={2},height={3},target={4}", VDetailLog("{0},MoveLinear,hover,pos={1},ret={2},hoverTS={3},height={4},target={5}",
Prim.LocalID, pos, ret, m_VhoverHeight, m_VhoverTargetHeight); Prim.LocalID, pos, ret, m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight);
} }
return ret; return ret;

View File

@ -620,8 +620,7 @@ public sealed class BSShapeCollection : IDisposable
} }
else else
{ {
// Pass false for physicalness as this creates some sort of bounding box which we don't need meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, true, false, false, false);
meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, false);
if (meshData != null) if (meshData != null)
{ {
@ -694,8 +693,8 @@ public sealed class BSShapeCollection : IDisposable
else else
{ {
// Build a new hull in the physical world // Build a new hull in the physical world
// Pass false for physicalness as this creates some sort of bounding box which we don't need // Pass true for physicalness as this creates some sort of bounding box which we don't need
IMesh meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, false); IMesh meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, true, false, false, false);
if (meshData != null) if (meshData != null)
{ {

View File

@ -2190,7 +2190,7 @@ namespace OpenSim.Region.Physics.OdePlugin
convex = false; convex = false;
try try
{ {
_mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, (int)LevelOfDetail.High, true,convex,false); _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, (int)LevelOfDetail.High, true,false,convex,false);
} }
catch catch
{ {
@ -2557,7 +2557,7 @@ namespace OpenSim.Region.Physics.OdePlugin
try try
{ {
mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true, convex,false); mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true, false,convex,false);
} }
catch catch
{ {

View File

@ -37,7 +37,7 @@ namespace OpenSim.Region.Physics.Manager
{ {
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod);
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical);
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde); IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, bool convex, bool forOde);
IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex); IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex);
void ReleaseMesh(IMesh mesh); void ReleaseMesh(IMesh mesh);
void ExpireReleaseMeshs(); void ExpireReleaseMeshs();

View File

@ -64,15 +64,20 @@ namespace OpenSim.Region.Physics.Manager
{ {
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
{ {
return CreateMesh(primName, primShape, size, lod, false); return CreateMesh(primName, primShape, size, lod, false, false);
} }
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex,bool forOde) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, bool convex,bool forOde)
{ {
return CreateMesh(primName, primShape, size, lod, false); return CreateMesh(primName, primShape, size, lod, false);
} }
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
{
return CreateMesh(primName, primShape, size, lod, false, false);
}
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache)
{ {
// Remove the reference to the encoded JPEG2000 data so it can be GCed // Remove the reference to the encoded JPEG2000 data so it can be GCed
primShape.SculptData = OpenMetaverse.Utils.EmptyBytes; primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;

View File

@ -702,16 +702,21 @@ namespace OpenSim.Region.Physics.Meshing
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
{ {
return CreateMesh(primName, primShape, size, lod, false); return CreateMesh(primName, primShape, size, lod, false, true);
} }
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, bool convex, bool forOde)
{ {
return CreateMesh(primName, primShape, size, lod, false); return CreateMesh(primName, primShape, size, lod, false);
} }
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
{ {
return CreateMesh(primName, primShape, size, lod, isPhysical, true);
}
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache)
{
#if SPAM #if SPAM
m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName);
#endif #endif
@ -721,9 +726,12 @@ namespace OpenSim.Region.Physics.Meshing
// If this mesh has been created already, return it instead of creating another copy // If this mesh has been created already, return it instead of creating another copy
// For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
key = primShape.GetMeshKey(size, lod); if (shouldCache)
if (m_uniqueMeshes.TryGetValue(key, out mesh)) {
return mesh; key = primShape.GetMeshKey(size, lod);
if (m_uniqueMeshes.TryGetValue(key, out mesh))
return mesh;
}
if (size.X < 0.01f) size.X = 0.01f; if (size.X < 0.01f) size.X = 0.01f;
if (size.Y < 0.01f) size.Y = 0.01f; if (size.Y < 0.01f) size.Y = 0.01f;
@ -746,7 +754,10 @@ namespace OpenSim.Region.Physics.Meshing
// trim the vertex and triangle lists to free up memory // trim the vertex and triangle lists to free up memory
mesh.TrimExcess(); mesh.TrimExcess();
m_uniqueMeshes.Add(key, mesh); if (shouldCache)
{
m_uniqueMeshes.Add(key, mesh);
}
} }
return mesh; return mesh;

View File

@ -1031,12 +1031,12 @@ namespace OpenSim.Region.Physics.Meshing
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
{ {
return CreateMesh(primName, primShape, size, lod, false,false,false); return CreateMesh(primName, primShape, size, lod, false,false,false,false);
} }
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
{ {
return CreateMesh(primName, primShape, size, lod, false,false,false); return CreateMesh(primName, primShape, size, lod, false,false,false,false);
} }
public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex)
@ -1080,7 +1080,7 @@ namespace OpenSim.Region.Physics.Meshing
private static Vector3 m_MeshUnitSize = new Vector3(1.0f, 1.0f, 1.0f); private static Vector3 m_MeshUnitSize = new Vector3(1.0f, 1.0f, 1.0f);
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde) public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, bool convex, bool forOde)
{ {
#if SPAM #if SPAM
m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName);

View File

@ -448,7 +448,7 @@ namespace OpenSim.Region.Physics.OdePlugin
else else
{ {
repData.meshState = MeshState.needMesh; repData.meshState = MeshState.needMesh;
mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, convex, true); mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, false, convex, true);
if (mesh == null) if (mesh == null)
{ {
repData.meshState = MeshState.MeshFailed; repData.meshState = MeshState.MeshFailed;
@ -513,7 +513,7 @@ namespace OpenSim.Region.Physics.OdePlugin
clod = (int)LevelOfDetail.Low; clod = (int)LevelOfDetail.Low;
} }
mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, convex, true); mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, false, convex, true);
if (mesh == null) if (mesh == null)
{ {
@ -929,4 +929,4 @@ namespace OpenSim.Region.Physics.OdePlugin
repData.actor.Name); repData.actor.Name);
} }
} }
} }