* ObjectAddPacket now confined to ClientView,´using PrimitiveBaseShape instead - w00t!

afrisby
lbsa71 2007-07-13 12:32:34 +00:00
parent a7e103a922
commit 33ef93f4a6
9 changed files with 53 additions and 60 deletions

View File

@ -75,6 +75,7 @@ namespace OpenSim.Framework.Interfaces
public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
public interface IClientAPI public interface IClientAPI
{ {
@ -94,7 +95,7 @@ namespace OpenSim.Framework.Interfaces
event GenericCall2 OnCompleteMovementToRegion; event GenericCall2 OnCompleteMovementToRegion;
event UpdateAgent OnAgentUpdate; event UpdateAgent OnAgentUpdate;
event GenericCall OnRequestAvatarsData; event GenericCall OnRequestAvatarsData;
event GenericCall4 OnAddPrim; event AddNewPrim OnAddPrim;
event ObjectDuplicate OnObjectDuplicate; event ObjectDuplicate OnObjectDuplicate;
event UpdateVector OnGrapObject; event UpdateVector OnGrapObject;
event ObjectSelect OnDeGrapObject; event ObjectSelect OnDeGrapObject;

View File

@ -1,4 +1,5 @@
using libsecondlife; using libsecondlife;
using libsecondlife.Packets;
namespace OpenSim.Framework.Types namespace OpenSim.Framework.Types
{ {
@ -97,6 +98,34 @@ namespace OpenSim.Framework.Types
return primShape; return primShape;
} }
}
public static PrimitiveBaseShape FromAddPacket(ObjectAddPacket addPacket)
{
PrimitiveBaseShape pShape = new PrimitiveBaseShape();
pShape.PCode = addPacket.ObjectData.PCode;
pShape.PathBegin = addPacket.ObjectData.PathBegin;
pShape.PathEnd = addPacket.ObjectData.PathEnd;
pShape.PathScaleX = addPacket.ObjectData.PathScaleX;
pShape.PathScaleY = addPacket.ObjectData.PathScaleY;
pShape.PathShearX = addPacket.ObjectData.PathShearX;
pShape.PathShearY = addPacket.ObjectData.PathShearY;
pShape.PathSkew = addPacket.ObjectData.PathSkew;
pShape.ProfileBegin = addPacket.ObjectData.ProfileBegin;
pShape.ProfileEnd = addPacket.ObjectData.ProfileEnd;
pShape.Scale = addPacket.ObjectData.Scale;
pShape.PathCurve = addPacket.ObjectData.PathCurve;
pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
pShape.PathTaperX = addPacket.ObjectData.PathTaperX;
pShape.PathTaperY = addPacket.ObjectData.PathTaperY;
pShape.PathTwist = addPacket.ObjectData.PathTwist;
pShape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
pShape.TextureEntry = ntex.ToBytes();
return pShape;
}
}
} }

View File

@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack
public event ObjectSelect OnDeGrapObject; public event ObjectSelect OnDeGrapObject;
public event ObjectDuplicate OnObjectDuplicate; public event ObjectDuplicate OnObjectDuplicate;
public event MoveObject OnGrapUpdate; public event MoveObject OnGrapUpdate;
public event GenericCall4 OnAddPrim; public event AddNewPrim OnAddPrim;
public event UpdateShape OnUpdatePrimShape; public event UpdateShape OnUpdatePrimShape;
public event ObjectSelect OnObjectSelect; public event ObjectSelect OnObjectSelect;
public event GenericCall7 OnObjectDescription; public event GenericCall7 OnObjectDescription;

View File

@ -217,7 +217,10 @@ namespace OpenSim.Region.ClientStack
case PacketType.ObjectAdd: case PacketType.ObjectAdd:
if (OnAddPrim != null) if (OnAddPrim != null)
{ {
OnAddPrim(Pack, this); ObjectAddPacket packet = (ObjectAddPacket) Pack ;
PrimitiveBaseShape primShape = PrimitiveBaseShape.FromAddPacket( packet );
OnAddPrim(this.AgentId, packet.ObjectData.RayEnd, primShape );
} }
break; break;
case PacketType.ObjectShape: case PacketType.ObjectShape:

View File

@ -130,7 +130,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="isRoot"></param> /// <param name="isRoot"></param>
/// <param name="parent"></param> /// <param name="parent"></param>
/// <param name="rootObject"></param> /// <param name="rootObject"></param>
public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject) public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
{ {
m_regionHandle = regionHandle; m_regionHandle = regionHandle;
m_world = world; m_world = world;
@ -138,7 +138,8 @@ namespace OpenSim.Region.Environment.Scenes
this.m_Parent = parent; this.m_Parent = parent;
this.m_isRootPrim = isRoot; this.m_isRootPrim = isRoot;
this.m_RootParent = rootObject; this.m_RootParent = rootObject;
this.CreateFromPacket(addPacket, ownerID, localID);
this.CreateFromPacket(ownerID, localID, pos, shape);
this.Rotation = Axiom.Math.Quaternion.Identity; this.Rotation = Axiom.Math.Quaternion.Identity;
} }
@ -209,43 +210,20 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="addPacket"></param> /// <param name="addPacket"></param>
/// <param name="ownerID"></param> /// <param name="ownerID"></param>
/// <param name="localID"></param> /// <param name="localID"></param>
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) public void CreateFromPacket(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
{ {
this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
this.OwnerID = ownerID; this.OwnerID = ownerID;
this.CreatorID = this.OwnerID; this.CreatorID = this.OwnerID;
this.LastOwnerID = LLUUID.Zero; this.LastOwnerID = LLUUID.Zero;
this.Pos = addPacket.ObjectData.RayEnd; this.Pos = pos;
this.uuid = LLUUID.Random(); this.uuid = LLUUID.Random();
this.m_localId = (uint)(localID); this.m_localId = (uint)(localID);
PrimitiveBaseShape pShape = new PrimitiveBaseShape(); this.m_Shape = shape;
this.m_Shape = pShape;
pShape.PCode = addPacket.ObjectData.PCode;
pShape.PathBegin = addPacket.ObjectData.PathBegin;
pShape.PathEnd = addPacket.ObjectData.PathEnd;
pShape.PathScaleX = addPacket.ObjectData.PathScaleX;
pShape.PathScaleY = addPacket.ObjectData.PathScaleY;
pShape.PathShearX = addPacket.ObjectData.PathShearX;
pShape.PathShearY = addPacket.ObjectData.PathShearY;
pShape.PathSkew = addPacket.ObjectData.PathSkew;
pShape.ProfileBegin = addPacket.ObjectData.ProfileBegin;
pShape.ProfileEnd = addPacket.ObjectData.ProfileEnd;
pShape.Scale = addPacket.ObjectData.Scale;
pShape.PathCurve = addPacket.ObjectData.PathCurve;
pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
pShape.PathTaperX = addPacket.ObjectData.PathTaperX;
pShape.PathTaperY = addPacket.ObjectData.PathTaperY;
pShape.PathTwist = addPacket.ObjectData.PathTwist;
pShape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
pShape.TextureEntry = ntex.ToBytes();
this.updateFlag = 1; this.updateFlag = 1;
} }
#endregion #endregion
#region Linking / unlinking #region Linking / unlinking

View File

@ -413,26 +413,16 @@ namespace OpenSim.Region.Environment.Scenes
return myID; return myID;
} }
/// <summary>
///
/// </summary>
/// <param name="addPacket"></param>
/// <param name="agentClient"></param>
public void AddNewPrim(Packet addPacket, IClientAPI agentClient)
{
AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="addPacket"></param> /// <param name="addPacket"></param>
/// <param name="ownerID"></param> /// <param name="ownerID"></param>
public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
{ {
try try
{ {
SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this.PrimIDAllocate()); SceneObject sceneOb = new SceneObject(m_regionHandle, this, ownerID, this.PrimIDAllocate(), pos, shape);
this.Entities.Add(sceneOb.rootUUID, sceneOb); this.Entities.Add(sceneOb.rootUUID, sceneOb);
// Trigger event for listeners // Trigger event for listeners
@ -444,13 +434,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public override uint AddNewPrim(LLUUID ownerId, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID texture, int flags)
{
uint id = NextLocalId;
throw new NotImplementedException("Not implemented yet.");
}
#endregion #endregion
#region Add/Remove Avatar Methods #region Add/Remove Avatar Methods

View File

@ -146,8 +146,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="child"></param> /// <param name="child"></param>
public abstract void AddNewClient(IClientAPI client, bool child); public abstract void AddNewClient(IClientAPI client, bool child);
public abstract uint AddNewPrim(LLUUID ownerId, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID texture, int flags);
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -30,6 +30,7 @@ using System.Text;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Physics.Manager; using OpenSim.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
@ -67,12 +68,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public SceneObject(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID) public SceneObject(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
{ {
m_regionHandle = regionHandle; m_regionHandle = regionHandle;
m_world = world; m_world = world;
this.Pos = addPacket.ObjectData.RayEnd; this.Pos = pos;
this.CreateRootFromPacket(addPacket, ownerID, localID); this.CreateRootFromPacket(ownerID, localID, shape, pos );
} }
/// <summary> /// <summary>
@ -90,9 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="addPacket"></param> /// <param name="addPacket"></param>
/// <param name="agentID"></param> /// <param name="agentID"></param>
/// <param name="localID"></param> /// <param name="localID"></param>
public void CreateRootFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) public void CreateRootFromPacket(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
{ {
this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, addPacket, agentID, localID, true, this, this); this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos);
this.children.Add(rootPrimitive); this.children.Add(rootPrimitive);
this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
} }

View File

@ -68,7 +68,7 @@ namespace SimpleApp
PrimData primData = new PrimData(); PrimData primData = new PrimData();
primData.Scale = new LLVector3(1, 1, 1); primData.Scale = new LLVector3(1, 1, 1);
m_localId = world.AddNewPrim( LLUUID.Zero, primData, LLVector3.Zero, new LLQuaternion(0, 0, 0, 0), LLUUID.Zero, 0); //m_localId = world.AddNewPrim( LLUUID.Zero, primData, LLVector3.Zero, new LLQuaternion(0, 0, 0, 0), LLUUID.Zero, 0);
} }