* Adds Top Colliders when using ODE. Access it from the estate tools/debug tab.

0.6.0-stable
Teravus Ovares 2008-05-25 11:22:05 +00:00
parent 29092d3999
commit 042c9ed4d8
15 changed files with 243 additions and 4 deletions

View File

@ -610,6 +610,8 @@ namespace OpenSim.Framework
public delegate void ForceReleaseControls(IClientAPI remoteClient, LLUUID agentID);
public delegate void GodLandStatRequest(int parcelID, uint reportType, uint requestflags, string filter, IClientAPI remoteClient);
//Estate Requests
public delegate void DetailedEstateDataRequest(IClientAPI remoteClient, LLUUID invoice);
public delegate void SetEstateFlagsRequest(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges);
@ -626,6 +628,7 @@ namespace OpenSim.Framework
public delegate void EstateDebugRegionRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics);
public delegate void EstateTeleportOneUserHomeRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, LLUUID prey);
public interface IClientAPI
{
LLVector3 StartPos { get; set; }
@ -801,6 +804,7 @@ namespace OpenSim.Framework
event AgentSit OnUndo;
event ForceReleaseControls OnForceReleaseControls;
event GodLandStatRequest OnLandStatRequest;
event DetailedEstateDataRequest OnDetailedEstateDataRequest;
event SetEstateFlagsRequest OnSetEstateFlagsRequest;
@ -989,6 +993,8 @@ namespace OpenSim.Framework
void SendGroupNameReply(LLUUID groupLLUID, string GroupName);
void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia);
byte[] GetThrottlesPacked(float multiplier);

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
namespace OpenSim.Framework
{
public class LandStatReportItem
{
public float LocationX;
public float LocationY;
public float LocationZ;
public string OwnerName;
public float Score;
public LLUUID TaskID;
public uint TaskLocalID;
public string TaskName;
public LandStatReportItem()
{
}
}
}

View File

@ -250,6 +250,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private ForceReleaseControls handlerForceReleaseControls = null;
private GodLandStatRequest handlerLandStatRequest = null;
private UUIDNameRequest handlerUUIDGroupNameRequest = null;
private RequestObjectPropertiesFamily handlerObjectGroupRequest = null;
@ -842,6 +844,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event ForceReleaseControls OnForceReleaseControls;
public event GodLandStatRequest OnLandStatRequest;
public event RequestObjectPropertiesFamily OnObjectGroupRequest;
public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
@ -5641,11 +5645,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OnEstateTeleportOneUserHomeRequest(this,invoice,SenderID,Prey);
}
break;
case "colliders":
handlerLandStatRequest = OnLandStatRequest;
if (handlerLandStatRequest != null)
{
handlerLandStatRequest(0, 1, 0, "", this);
}
break;
default:
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString());
break;
}
break;
case PacketType.LandStatRequest:
LandStatRequestPacket lsrp = (LandStatRequestPacket)Pack;
handlerLandStatRequest = OnLandStatRequest;
if (handlerLandStatRequest != null)
{
handlerLandStatRequest(lsrp.RequestData.ParcelLocalID,lsrp.RequestData.ReportType,lsrp.RequestData.RequestFlags,Helpers.FieldToUTF8String(lsrp.RequestData.Filter),this);
}
//int parcelID, uint reportType, uint requestflags, string filter
//lsrp.RequestData.ParcelLocalID;
//lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
//lsrp.RequestData.RequestFlags;
//lsrp.RequestData.Filter;
break;
case PacketType.RequestRegionInfo:
RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
@ -5982,6 +6010,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
pack.UUIDNameBlock = uidnameblock;
OutPacket(pack, ThrottleOutPacketType.Task);
}
public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
{
LandStatReplyPacket lsrp = new LandStatReplyPacket();
LandStatReplyPacket.RequestDataBlock lsreqdpb = new LandStatReplyPacket.RequestDataBlock();
LandStatReplyPacket.ReportDataBlock[] lsrepdba = new LandStatReplyPacket.ReportDataBlock[lsrpia.Length];
//LandStatReplyPacket.ReportDataBlock lsrepdb = new LandStatReplyPacket.ReportDataBlock();
// lsrepdb.
lsrp.RequestData.ReportType = reportType;
lsrp.RequestData.RequestFlags = requestFlags;
lsrp.RequestData.TotalObjectCount = resultCount;
for (int i = 0; i < lsrpia.Length; i++)
{
LandStatReplyPacket.ReportDataBlock lsrepdb = new LandStatReplyPacket.ReportDataBlock();
lsrepdb.LocationX = lsrpia[i].LocationX;
lsrepdb.LocationY = lsrpia[i].LocationY;
lsrepdb.LocationZ = lsrpia[i].LocationZ;
lsrepdb.Score = lsrpia[i].Score;
lsrepdb.TaskID = lsrpia[i].TaskID;
lsrepdb.TaskLocalID = lsrpia[i].TaskLocalID;
lsrepdb.TaskName = Helpers.StringToField(lsrpia[i].TaskName);
lsrepdb.OwnerName = Helpers.StringToField(lsrpia[i].OwnerName);
lsrepdba[i] = lsrepdb;
}
lsrp.ReportData = lsrepdba;
OutPacket(lsrp, ThrottleOutPacketType.Task);
}
public ClientInfo GetClientInfo()
{
//MainLog.Instance.Verbose("CLIENT", "GetClientInfo BGN");

View File

@ -311,6 +311,44 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
{
remote_client.sendEstateCovenantInformation();
}
private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
{
Dictionary<uint, float> colliders = m_scene.PhysicsScene.GetTopColliders();
List<LandStatReportItem> collidera = new List<LandStatReportItem>();
lock (colliders)
{
foreach (uint obj in colliders.Keys)
{
SceneObjectPart prt = m_scene.GetSceneObjectPart(obj);
if (prt != null)
{
if (prt.ParentGroup != null)
{
SceneObjectGroup sog = prt.ParentGroup;
if (sog != null)
{
LandStatReportItem lsri = new LandStatReportItem();
lsri.LocationX = sog.AbsolutePosition.X;
lsri.LocationY = sog.AbsolutePosition.Y;
lsri.LocationZ = sog.AbsolutePosition.Z;
lsri.Score = colliders[obj];
lsri.TaskID = sog.UUID;
lsri.TaskLocalID = sog.LocalId;
lsri.TaskName = sog.GetPartName(obj);
lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID);
collidera.Add(lsri);
}
}
}
}
}
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)collidera.Count,collidera.ToArray());
}
#endregion
@ -435,6 +473,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
client.OnRegionInfoRequest += HandleRegionInfoRequest;
client.OnEstateCovenantRequest += HandleEstateCovenantRequest;
client.OnLandStatRequest += HandleLandStatRequest;
sendRegionHandshake(client);
}
}

View File

@ -271,7 +271,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event AgentSit OnUndo;
public event ForceReleaseControls OnForceReleaseControls;
public event GodLandStatRequest OnLandStatRequest;
public event RequestObjectPropertiesFamily OnObjectGroupRequest;
public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
@ -764,6 +764,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public void SendGroupNameReply(LLUUID groupLLUID, string GroupName)
{
}
public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
{
}
#endregion
}
}

View File

@ -175,6 +175,8 @@ namespace OpenSim.Region.Examples.SimpleModule
public event AgentSit OnUndo;
public event ForceReleaseControls OnForceReleaseControls;
public event GodLandStatRequest OnLandStatRequest;
public event RequestObjectPropertiesFamily OnObjectGroupRequest;
public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
@ -761,5 +763,10 @@ namespace OpenSim.Region.Examples.SimpleModule
public void SendGroupNameReply(LLUUID groupLLUID, string GroupName)
{
}
public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
{
}
}
}

View File

@ -198,6 +198,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override void DeleteTerrain()
{
}
public override Dictionary<uint, float> GetTopColliders()
{
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
return returncolliders;
}
}
public class BasicActor : PhysicsActor
@ -348,6 +353,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override Quaternion Orientation

View File

@ -549,6 +549,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
}
public override Dictionary<uint, float> GetTopColliders()
{
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
return returncolliders;
}
public override void SetWaterLevel(float baseheight)
{
@ -917,6 +923,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override PhysicsVector Size
{

View File

@ -176,7 +176,7 @@ namespace OpenSim.Region.Physics.Manager
public abstract PhysicsVector GeometricCenter { get; }
public abstract PhysicsVector CenterOfMass { get; }
public abstract PhysicsVector Velocity { get; set; }
public abstract float CollisionScore { get;}
public abstract float CollisionScore { get; set;}
public abstract PhysicsVector Acceleration { get; }
public abstract Quaternion Orientation { get; set; }
public abstract int PhysicsActorType { get; set; }
@ -208,8 +208,10 @@ namespace OpenSim.Region.Physics.Manager
public override bool Stopped
{
get{ return false; }
}
public override PhysicsVector Position
{
get { return PhysicsVector.Zero; }
@ -300,6 +302,7 @@ namespace OpenSim.Region.Physics.Manager
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override void CrossingFailure()

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Collections.Generic;
using System.Reflection;
using Axiom.Math;
using log4net;
@ -86,6 +87,8 @@ namespace OpenSim.Region.Physics.Manager
public abstract void Dispose();
public abstract Dictionary<uint, float> GetTopColliders();
public abstract bool IsThreaded { get; }
private class NullPhysicsScene : PhysicsScene
@ -170,6 +173,12 @@ namespace OpenSim.Region.Physics.Manager
public override void Dispose()
{
}
public override Dictionary<uint,float> GetTopColliders()
{
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
return returncolliders;
}
}
}
}

View File

@ -570,6 +570,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override bool Kinematic

View File

@ -124,7 +124,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool m_throttleUpdates = false;
private int throttleCounter = 0;
public int m_interpenetrationcount = 0;
public int m_collisionscore = 0;
public float m_collisionscore = 0;
public int m_roundsUnderMotionThreshold = 0;
private int m_crossingfailures = 0;
@ -243,7 +243,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// is physical or the object is modified somehow *IN THE FUTURE*
// without this, if an avatar selects prim, they can walk right
// through it while it's selected
m_collisionscore = 0;
if ((m_isphysical && !_zeroFlag) || !value)
{
m_taintselected = value;
@ -1783,6 +1783,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override float CollisionScore
{
get { return m_collisionscore; }
set { m_collisionscore = value; }
}
public override bool Kinematic

View File

@ -555,6 +555,13 @@ namespace OpenSim.Region.Physics.OdePlugin
}
float max_collision_depth = 0f;
if (p1.CollisionScore + count >= float.MaxValue)
p1.CollisionScore = 0;
p1.CollisionScore += count;
if (p2.CollisionScore + count >= float.MaxValue)
p2.CollisionScore = 0;
p2.CollisionScore += count;
for (int i = 0; i < count; i++)
{
@ -585,6 +592,7 @@ namespace OpenSim.Region.Physics.OdePlugin
p2.CollidingGround = true;
break;
}
// we don't want prim or avatar to explode
@ -2162,5 +2170,27 @@ namespace OpenSim.Region.Physics.OdePlugin
//d.CloseODE();
}
}
public override Dictionary<uint, float> GetTopColliders()
{
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
int cnt = 0;
lock (_prims)
{
foreach (OdePrim prm in _prims)
{
if (prm.CollisionScore > 0)
{
returncolliders.Add(prm.m_localID, prm.CollisionScore);
cnt++;
prm.CollisionScore = 0f;
if (cnt > 25)
{
break;
}
}
}
}
return returncolliders;
}
}
}

View File

@ -326,6 +326,12 @@ namespace OpenSim.Region.Physics.POSPlugin
public override void DeleteTerrain()
{
}
public override Dictionary<uint, float> GetTopColliders()
{
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
return returncolliders;
}
}
public class POSCharacter : PhysicsActor
@ -476,6 +482,7 @@ namespace OpenSim.Region.Physics.POSPlugin
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override Quaternion Orientation
@ -663,6 +670,7 @@ namespace OpenSim.Region.Physics.POSPlugin
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override Quaternion Orientation

View File

@ -200,6 +200,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin
{
scene.DeleteTerrain();
}
public override Dictionary<uint, float> GetTopColliders()
{
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
return returncolliders;
}
}
public class PhysXCharacter : PhysicsActor
@ -355,6 +361,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override bool Kinematic
@ -593,6 +600,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override bool Kinematic