Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-10-07 09:54:48 +02:00
commit 398d92dc40
4 changed files with 86 additions and 42 deletions

View File

@ -1583,7 +1583,9 @@ namespace OpenSim.Region.Framework.Scenes
float cost = 0.1f;
if (PhysActor != null)
// cost += PhysActor.Cost;
cost = PhysActor.PhysicsCost;
else
cost = 0.1f;
if ((Flags & PrimFlags.Physics) != 0)
cost *= (1.0f + 0.01333f * Scale.LengthSquared()); // 0.01333 == 0.04/3
@ -1596,9 +1598,12 @@ namespace OpenSim.Region.Framework.Scenes
{
get
{
return 0.1f;
float cost;
if (PhysActor != null)
cost = PhysActor.StreamCost;
else
cost = 1.0f;
return 1.0f;
}
}

View File

@ -315,6 +315,23 @@ namespace OpenSim.Region.Physics.Manager
}
}
public virtual float PhysicsCost
{
get
{
return 0.1f;
}
}
public virtual float StreamCost
{
get
{
return 1.0f;
}
}
/// <summary>
/// Velocity of this actor.
/// </summary>

View File

@ -40,8 +40,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public float volume;
public float physCost;
public float streamCost;
public byte shapetype;
public bool hasOBB;
public bool hasMeshVolume;
@ -121,8 +119,14 @@ namespace OpenSim.Region.Physics.OdePlugin
public void Stop()
{
m_running = false;
try
{
m_thread.Abort();
createqueue.Clear();
}
catch
{
}
}
public void ChangeActorPhysRep(PhysicsActor actor, PrimitiveBaseShape pbs,
@ -172,11 +176,16 @@ namespace OpenSim.Region.Physics.OdePlugin
if (repData.assetState != AssetState.needAsset)
return;
if (repData.assetID == null || repData.assetID == UUID.Zero)
return;
repData.mesh = null;
if (repData.assetID == null || repData.assetID == UUID.Zero)
{
repData.assetState = AssetState.noNeedAsset;
repData.comand = meshWorkerCmnds.changefull;
createqueue.Enqueue(repData);
return;
}
repData.assetState = AssetState.loadingAsset;
repData.comand = meshWorkerCmnds.getmesh;
@ -211,9 +220,6 @@ namespace OpenSim.Region.Physics.OdePlugin
repData.OBBOffset = mesh.GetCentroid();
repData.OBB = mesh.GetOBB();
repData.hasOBB = true;
repData.physCost = 0.0013f * (float)indexCount;
// todo
repData.streamCost = 1.0f;
mesh.releaseSourceMeshData();
}
}
@ -432,6 +438,9 @@ namespace OpenSim.Region.Physics.OdePlugin
else
repData.assetState = AssetState.AssetFailed;
}
else
repData.assetState = AssetState.needAsset;
return false;
}
@ -828,14 +837,6 @@ namespace OpenSim.Region.Physics.OdePlugin
if (repData.hasOBB)
{
Vector3 OBB = repData.OBB;
float pc = repData.physCost;
float psf = OBB.X * (OBB.Y + OBB.Z) + OBB.Y * OBB.Z;
psf *= 1.33f * .2f;
pc *= psf;
if (pc < 0.1f)
pc = 0.1f;
repData.physCost = pc;
}
else
{
@ -846,9 +847,6 @@ namespace OpenSim.Region.Physics.OdePlugin
repData.OBB = OBB;
repData.OBBOffset = Vector3.Zero;
repData.physCost = 0.1f;
repData.streamCost = 1.0f;
}
CalculateBasicPrimVolume(repData);

View File

@ -279,6 +279,22 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
public override float PhysicsCost
{
get
{
return m_physCost;
}
}
public override float StreamCost
{
get
{
return m_streamCost;
}
}
public override int PhysicsActorType
{
get { return (int)ActorTypes.Prim; }
@ -1373,6 +1389,11 @@ namespace OpenSim.Region.Physics.OdePlugin
m_mesh = null;
return false;
}
m_physCost = 0.0013f * (float)indexCount;
// todo
m_streamCost = 1.0f;
return true;
}
@ -1386,7 +1407,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (m_assetState == AssetState.AssetFailed)
m_NoColide = true;
else if (m_mesh != null)
else if(m_mesh != null)
{
if (GetMeshGeom())
hasMesh = true;
@ -2058,7 +2079,23 @@ namespace OpenSim.Region.Physics.OdePlugin
m_OBBOffset.Y,
m_OBBOffset.Z);
primOOBradiusSQ = m_OBBOffset.LengthSquared();
primOOBradiusSQ = m_OBB.LengthSquared();
if (_triMeshData != IntPtr.Zero)
{
float pc = m_physCost;
float psf = primOOBradiusSQ;
psf *= 1.33f * .2f;
pc *= psf;
if (pc < 0.1f)
pc = 0.1f;
m_physCost = pc;
}
else
m_physCost = 0.1f;
m_streamCost = 1.0f;
}
#endregion
@ -2717,10 +2754,6 @@ namespace OpenSim.Region.Physics.OdePlugin
m_OBBOffset = repData.OBBOffset;
m_OBB = repData.OBB;
// m_NoColide = repData.NoColide;
m_physCost = repData.physCost;
m_streamCost = repData.streamCost;
primVolume = repData.volume;
CreateGeom();
@ -2793,9 +2826,6 @@ namespace OpenSim.Region.Physics.OdePlugin
m_OBBOffset = repData.OBBOffset;
m_OBB = repData.OBB;
m_physCost = repData.physCost;
m_streamCost = repData.streamCost;
primVolume = repData.volume;
CreateGeom();
@ -2806,14 +2836,8 @@ namespace OpenSim.Region.Physics.OdePlugin
UpdatePrimBodyData();
try
{
_parent_scene.actor_name_map[prim_geom] = this;
}
catch
{
}
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();