Some more work on new Sceneobject.

afrisby
MW 2007-08-07 18:31:20 +00:00
parent d0156b491b
commit 266b272673
3 changed files with 91 additions and 22 deletions

View File

@ -38,6 +38,33 @@ namespace OpenSim.Region.Environment.Scenes
get { return new LLVector3(0, 0, 0); } get { return new LLVector3(0, 0, 0); }
} }
public override LLVector3 Pos
{
get { return m_rootPart.GroupPosition; }
set
{
lock (this.m_parts)
{
foreach (AllNewSceneObjectPart2 part in this.m_parts.Values)
{
part.GroupPosition = value;
}
}
}
}
public override uint LocalId
{
get { return m_rootPart.LocalID; }
set { m_rootPart.LocalID = value; }
}
public override LLUUID UUID
{
get { return m_rootPart.UUID; }
set { m_rootPart.UUID = value; }
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -370,7 +397,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="pos"></param> /// <param name="pos"></param>
public void UpdateGroupPosition(LLVector3 pos) public void UpdateGroupPosition(LLVector3 pos)
{ {
this.m_pos = pos; this.Pos = pos;
} }
/// <summary> /// <summary>
@ -442,7 +469,7 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot)
{ {
this.m_rootPart.UpdateRotation(rot); this.m_rootPart.UpdateRotation(rot);
this.m_pos = pos; this.Pos = pos;
} }
/// <summary> /// <summary>
@ -500,8 +527,8 @@ namespace OpenSim.Region.Environment.Scenes
private void SetPartAsRoot(AllNewSceneObjectPart2 part) private void SetPartAsRoot(AllNewSceneObjectPart2 part)
{ {
this.m_rootPart = part; this.m_rootPart = part;
this.m_uuid = part.UUID; //this.m_uuid= part.UUID;
this.m_localId = part.LocalID; // this.m_localId = part.LocalID;
} }
/// <summary> /// <summary>
@ -522,6 +549,11 @@ namespace OpenSim.Region.Environment.Scenes
return m_scene.RequestAvatarList(); return m_scene.RequestAvatarList();
} }
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="part"></param>
internal void SendPartFullUpdate(IClientAPI remoteClient, AllNewSceneObjectPart2 part) internal void SendPartFullUpdate(IClientAPI remoteClient, AllNewSceneObjectPart2 part)
{ {
if( m_rootPart == part ) if( m_rootPart == part )
@ -533,5 +565,22 @@ namespace OpenSim.Region.Environment.Scenes
part.SendFullUpdateToClient( remoteClient ); part.SendFullUpdateToClient( remoteClient );
} }
} }
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="part"></param>
internal void SendPartTerseUpdate(IClientAPI remoteClient, AllNewSceneObjectPart2 part)
{
if (m_rootPart == part)
{
part.SendTerseUpdateToClient(remoteClient, Pos);
}
else
{
part.SendTerseUpdateToClient(remoteClient);
}
}
} }
} }

View File

@ -172,14 +172,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
#endregion #endregion
//might not end up being used
protected bool m_isRoot;
public bool IsRoot
{
set { m_isRoot = value; }
get { return this.m_isRoot; }
}
#region Constructors #region Constructors
/// <summary> /// <summary>
/// ///
@ -209,9 +201,9 @@ namespace OpenSim.Region.Environment.Scenes
this.LastOwnerID = LLUUID.Zero; this.LastOwnerID = LLUUID.Zero;
this.UUID = LLUUID.Random(); this.UUID = LLUUID.Random();
this.LocalID = (uint)(localID); this.LocalID = (uint)(localID);
this.m_shape = shape; this.Shape = shape;
this.m_groupPosition = groupPosition; this.GroupPosition = groupPosition;
this.OffsetPosition = offsetPosition; this.OffsetPosition = offsetPosition;
this.RotationOffset = LLQuaternion.Identity; this.RotationOffset = LLQuaternion.Identity;
this.Velocity = new LLVector3(0, 0, 0); this.Velocity = new LLVector3(0, 0, 0);
@ -245,7 +237,7 @@ namespace OpenSim.Region.Environment.Scenes
this.LastOwnerID = lastOwnerID; this.LastOwnerID = lastOwnerID;
this.UUID = LLUUID.Random(); this.UUID = LLUUID.Random();
this.LocalID = (uint)(localID); this.LocalID = (uint)(localID);
this.m_shape = shape; this.Shape = shape;
this.OffsetPosition = position; this.OffsetPosition = position;
this.RotationOffset = rotation; this.RotationOffset = rotation;
@ -265,12 +257,14 @@ namespace OpenSim.Region.Environment.Scenes
dupe.m_regionHandle = m_regionHandle; dupe.m_regionHandle = m_regionHandle;
dupe.UUID = LLUUID.Random(); dupe.UUID = LLUUID.Random();
dupe.LocalID = localID; dupe.LocalID = localID;
dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z);
dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z);
dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W);
dupe.Velocity = new LLVector3(0, 0, 0); dupe.Velocity = new LLVector3(0, 0, 0);
dupe.Acceleration = new LLVector3(0, 0, 0); dupe.Acceleration = new LLVector3(0, 0, 0);
dupe.AngularVelocity = new LLVector3(0, 0, 0); dupe.AngularVelocity = new LLVector3(0, 0, 0);
dupe.ObjectFlags = this.ObjectFlags; dupe.ObjectFlags = this.ObjectFlags;
//TODO copy extraparams data and anything else not currently copied
return dupe; return dupe;
} }
#endregion #endregion
@ -439,13 +433,15 @@ namespace OpenSim.Region.Environment.Scenes
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
SendFullUpdateToClient(avatars[i].ControllingClient); m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this);
} }
} }
/// <summary>
///
public void FullUpdate(IClientAPI remoteClient) /// </summary>
/// <param name="remoteClient"></param>
public void SendFullUpdate(IClientAPI remoteClient)
{ {
m_parentGroup.SendPartFullUpdate( remoteClient, this ); m_parentGroup.SendPartFullUpdate( remoteClient, this );
} }
@ -461,6 +457,11 @@ namespace OpenSim.Region.Environment.Scenes
SendFullUpdateToClient(remoteClient, lPos); SendFullUpdateToClient(remoteClient, lPos);
} }
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="lPos"></param>
public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
{ {
LLQuaternion lRot; LLQuaternion lRot;
@ -478,10 +479,19 @@ namespace OpenSim.Region.Environment.Scenes
List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
SendTerseUpdateToClient(avatars[i].ControllingClient); m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this);
} }
} }
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
public void SendTerseUpdate(IClientAPI remoteClient)
{
m_parentGroup.SendPartTerseUpdate(remoteClient, this);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -491,7 +501,17 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 lPos; LLVector3 lPos;
lPos = this.OffsetPosition; lPos = this.OffsetPosition;
LLQuaternion mRot = this.RotationOffset; LLQuaternion mRot = this.RotationOffset;
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
}
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="lPos"></param>
public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
{
LLQuaternion mRot = this.RotationOffset;
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
} }
#endregion #endregion

View File

@ -11,7 +11,7 @@ namespace OpenSim.Region.Environment.Scenes
protected Scene m_scene; protected Scene m_scene;
public LLUUID m_uuid; public LLUUID m_uuid;
public LLUUID UUID public virtual LLUUID UUID
{ {
get get
{ {
@ -61,7 +61,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
protected uint m_localId; protected uint m_localId;
public uint LocalId public virtual uint LocalId
{ {
get { return m_localId; } get { return m_localId; }
set { m_localId = value; } set { m_localId = value; }