* ObjectAddPacket now confined to ClientView,´using PrimitiveBaseShape instead - w00t!
parent
a7e103a922
commit
33ef93f4a6
|
@ -75,6 +75,7 @@ namespace OpenSim.Framework.Interfaces
|
|||
|
||||
public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
|
||||
|
||||
public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
|
||||
|
||||
public interface IClientAPI
|
||||
{
|
||||
|
@ -94,7 +95,7 @@ namespace OpenSim.Framework.Interfaces
|
|||
event GenericCall2 OnCompleteMovementToRegion;
|
||||
event UpdateAgent OnAgentUpdate;
|
||||
event GenericCall OnRequestAvatarsData;
|
||||
event GenericCall4 OnAddPrim;
|
||||
event AddNewPrim OnAddPrim;
|
||||
event ObjectDuplicate OnObjectDuplicate;
|
||||
event UpdateVector OnGrapObject;
|
||||
event ObjectSelect OnDeGrapObject;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
|
||||
namespace OpenSim.Framework.Types
|
||||
{
|
||||
|
@ -97,6 +98,34 @@ namespace OpenSim.Framework.Types
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack
|
|||
public event ObjectSelect OnDeGrapObject;
|
||||
public event ObjectDuplicate OnObjectDuplicate;
|
||||
public event MoveObject OnGrapUpdate;
|
||||
public event GenericCall4 OnAddPrim;
|
||||
public event AddNewPrim OnAddPrim;
|
||||
public event UpdateShape OnUpdatePrimShape;
|
||||
public event ObjectSelect OnObjectSelect;
|
||||
public event GenericCall7 OnObjectDescription;
|
||||
|
|
|
@ -217,7 +217,10 @@ namespace OpenSim.Region.ClientStack
|
|||
case PacketType.ObjectAdd:
|
||||
if (OnAddPrim != null)
|
||||
{
|
||||
OnAddPrim(Pack, this);
|
||||
ObjectAddPacket packet = (ObjectAddPacket) Pack ;
|
||||
PrimitiveBaseShape primShape = PrimitiveBaseShape.FromAddPacket( packet );
|
||||
|
||||
OnAddPrim(this.AgentId, packet.ObjectData.RayEnd, primShape );
|
||||
}
|
||||
break;
|
||||
case PacketType.ObjectShape:
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="isRoot"></param>
|
||||
/// <param name="parent"></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_world = world;
|
||||
|
@ -138,7 +138,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
this.m_Parent = parent;
|
||||
this.m_isRootPrim = isRoot;
|
||||
this.m_RootParent = rootObject;
|
||||
this.CreateFromPacket(addPacket, ownerID, localID);
|
||||
|
||||
this.CreateFromPacket(ownerID, localID, pos, shape);
|
||||
this.Rotation = Axiom.Math.Quaternion.Identity;
|
||||
}
|
||||
|
||||
|
@ -209,43 +210,20 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="addPacket"></param>
|
||||
/// <param name="ownerID"></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.OwnerID = ownerID;
|
||||
this.CreatorID = this.OwnerID;
|
||||
this.LastOwnerID = LLUUID.Zero;
|
||||
this.Pos = addPacket.ObjectData.RayEnd;
|
||||
this.Pos = pos;
|
||||
this.uuid = LLUUID.Random();
|
||||
this.m_localId = (uint)(localID);
|
||||
|
||||
PrimitiveBaseShape pShape = new PrimitiveBaseShape();
|
||||
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.m_Shape = shape;
|
||||
this.updateFlag = 1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Linking / unlinking
|
||||
|
|
|
@ -413,26 +413,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
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>
|
||||
/// <param name="addPacket"></param>
|
||||
/// <param name="ownerID"></param>
|
||||
public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID)
|
||||
public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
|
||||
{
|
||||
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);
|
||||
|
||||
// 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
|
||||
|
||||
#region Add/Remove Avatar Methods
|
||||
|
|
|
@ -146,8 +146,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="child"></param>
|
||||
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>
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.Text;
|
|||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Physics.Manager;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes
|
||||
|
@ -67,12 +68,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <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_world = world;
|
||||
this.Pos = addPacket.ObjectData.RayEnd;
|
||||
this.CreateRootFromPacket(addPacket, ownerID, localID);
|
||||
this.Pos = pos;
|
||||
this.CreateRootFromPacket(ownerID, localID, shape, pos );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -90,9 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="addPacket"></param>
|
||||
/// <param name="agentID"></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.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace SimpleApp
|
|||
PrimData primData = new PrimData();
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue