some more work on costs

This commit is contained in:
UbitUmarov
2012-03-16 15:33:49 +00:00
parent b4adf652e7
commit ae8e089b9c
3 changed files with 192 additions and 22 deletions

View File

@@ -1415,6 +1415,14 @@ namespace OpenSim.Region.Framework.Scenes
}
}
// not a propriety to move to methods place later
private bool HasMesh()
{
if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh))
return true;
return false;
}
// not a propriety to move to methods place later
public byte DefaultPhysicsShapeType()
{
@@ -1428,6 +1436,60 @@ namespace OpenSim.Region.Framework.Scenes
return type;
}
[XmlIgnore]
public bool UsesComplexCost
{
get
{
byte pst = PhysicsShapeType;
if(pst == (byte) PhysShapeType.none || pst == (byte) PhysShapeType.convex || HasMesh())
return true;
return false;
}
}
[XmlIgnore]
public float PhysicsCost
{
get
{
if(PhysicsShapeType == (byte)PhysShapeType.none)
return 0;
float cost = 0.1f;
if (PhysActor != null)
// cost += PhysActor.Cost;
if ((Flags & PrimFlags.Physics) != 0)
cost *= (1.0f + 0.01333f * Scale.LengthSquared()); // 0.01333 == 0.04/3
return cost;
}
}
[XmlIgnore]
public float StreamingCost
{
get
{
return 0.1f;
}
}
[XmlIgnore]
public float SimulationCost
{
get
{
// ignoring scripts. Don't like considering them for this
if((Flags & PrimFlags.Physics) != 0)
return 1.0f;
return 0.5f;
}
}
public byte PhysicsShapeType
{
get { return m_physicsShapeType; }