* Part two of the major object restructuring

* Fixed a bug with the LogoutTimer not dying
* Major surgery on how objects are decoded off the wire, handles more cases now
* Added support for lots more object and primitive parameters
* Added several new Helpers functions for converting bytes to values

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@923 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2007-01-30 12:47:47 +00:00
parent 75b50e87b7
commit 2a29dc70ee
10 changed files with 684 additions and 419 deletions

View File

@@ -124,7 +124,8 @@ namespace libsecondlife.TestClient
rezzingRootPrim = true;
currentPrim = linkset.RootPrim;
Client.Objects.AddPrim(Client.Network.CurrentSim, linkset.RootPrim, linkset.RootPrim.Position);
Client.Objects.AddPrim(Client.Network.CurrentSim, linkset.RootPrim.Data, LLUUID.Zero,
linkset.RootPrim.Position, linkset.RootPrim.Scale, linkset.RootPrim.Rotation);
if (!primDone.WaitOne(10000, false))
return "Rez failed, timed out while creating a prim.";
@@ -138,7 +139,8 @@ namespace libsecondlife.TestClient
currentPrim = prim;
currentPosition = prim.Position + linkset.RootPrim.Position;
Client.Objects.AddPrim(Client.Network.CurrentSim, prim, currentPosition);
Client.Objects.AddPrim(Client.Network.CurrentSim, prim.Data, LLUUID.Zero,
currentPosition, prim.Scale, prim.Rotation);
if (!primDone.WaitOne(10000, false))
return "Rez failed, timed out while creating a prim.";

View File

@@ -53,10 +53,9 @@ namespace libsecondlife.TestClient
Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));
Objects.OnNewPrim += new ObjectManager.NewPrimCallback(Objects_OnNewPrim);
Objects.OnPrimMoved += new ObjectManager.PrimMovedCallback(Objects_OnPrimMoved);
Objects.OnObjectUpdated += new ObjectManager.ObjectUpdatedCallback(Objects_OnObjectUpdated);
Objects.OnObjectKilled += new ObjectManager.KillObjectCallback(Objects_OnObjectKilled);
Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(Objects_OnNewAvatar);
Objects.OnAvatarMoved += new ObjectManager.AvatarMovedCallback(Objects_OnAvatarMoved);
Self.OnInstantMessage += new MainAvatar.InstantMessageCallback(Self_OnInstantMessage);
this.OnLogMessage += new LogCallback(TestClient_OnLogMessage);
@@ -203,14 +202,41 @@ namespace libsecondlife.TestClient
}
}
private void Objects_OnPrimMoved(Simulator simulator, PrimUpdate prim, ulong regionHandle, ushort timeDilation)
private void Objects_OnObjectUpdated(Simulator simulator, ObjectUpdate update, ulong regionHandle, ushort timeDilation)
{
lock (SimPrims)
regionX = (int)(regionHandle >> 32);
regionY = (int)(regionHandle & 0xFFFFFFFF);
if (update.Avatar)
{
if (SimPrims.ContainsKey(simulator) && SimPrims[simulator].ContainsKey(prim.LocalID))
lock (AvatarList)
{
SimPrims[simulator][prim.LocalID].Position = prim.Position;
SimPrims[simulator][prim.LocalID].Rotation = prim.Rotation;
// TODO: We really need a solid avatar and object tracker in Utilities to use here
if (AvatarList.ContainsKey(update.LocalID))
{
AvatarList[update.LocalID].CollisionPlane = update.CollisionPlane;
AvatarList[update.LocalID].Position = update.Position;
AvatarList[update.LocalID].Velocity = update.Velocity;
AvatarList[update.LocalID].Acceleration = update.Acceleration;
AvatarList[update.LocalID].Rotation = update.Rotation;
AvatarList[update.LocalID].AngularVelocity = update.AngularVelocity;
AvatarList[update.LocalID].Textures = update.Textures;
}
}
}
else
{
lock (SimPrims)
{
if (SimPrims.ContainsKey(simulator) && SimPrims[simulator].ContainsKey(update.LocalID))
{
SimPrims[simulator][update.LocalID].Position = update.Position;
SimPrims[simulator][update.LocalID].Velocity = update.Velocity;
SimPrims[simulator][update.LocalID].Acceleration = update.Acceleration;
SimPrims[simulator][update.LocalID].Rotation = update.Rotation;
SimPrims[simulator][update.LocalID].AngularVelocity = update.AngularVelocity;
SimPrims[simulator][update.LocalID].Textures = update.Textures;
}
}
}
}
@@ -241,20 +267,6 @@ namespace libsecondlife.TestClient
}
}
private void Objects_OnAvatarMoved(Simulator simulator, AvatarUpdate avatar, ulong regionHandle, ushort timeDilation)
{
regionX = (int)(regionHandle >> 32);
regionY = (int)(regionHandle & 0xFFFFFFFF);
lock (AvatarList)
{
if (AvatarList.ContainsKey(avatar.LocalID))
{
AvatarList[avatar.LocalID].Position = avatar.Position;
AvatarList[avatar.LocalID].Rotation = avatar.Rotation;
}
}
}
private void AvatarAppearanceHandler(Packet packet, Simulator simulator)
{
AvatarAppearancePacket appearance = (AvatarAppearancePacket)packet;

View File

@@ -443,7 +443,9 @@ namespace primexport
output += "<properties>" + Environment.NewLine +
"<levelofdetail val=\"9\" />" + Environment.NewLine;
switch (prim.ProfileCurve + prim.PathCurve)
LLObject.ObjectData data = prim.Data;
switch (data.ProfileCurve + data.PathCurve)
{
case 17:
// PRIM_TYPE_BOX
@@ -475,7 +477,7 @@ namespace primexport
break;
default:
Log("Not exporting an unhandled prim, ProfileCurve=" +
prim.ProfileCurve + ", PathCurve=" + prim.PathCurve + Environment.NewLine);
data.ProfileCurve + ", PathCurve=" + data.PathCurve + Environment.NewLine);
continue;
}
@@ -493,27 +495,27 @@ namespace primexport
if (type == 1)
{
output += "<cut x=\"" + prim.ProfileBegin + "\" y=\"" + prim.ProfileEnd + "\" />" + Environment.NewLine;
output += "<dimple x=\"" + prim.PathBegin + "\" y=\"" + prim.PathEnd + "\" />" + Environment.NewLine;
output += "<cut x=\"" + data.ProfileBegin + "\" y=\"" + data.ProfileEnd + "\" />" + Environment.NewLine;
output += "<dimple x=\"" + data.PathBegin + "\" y=\"" + data.PathEnd + "\" />" + Environment.NewLine;
}
else
{
output += "<cut x=\"" + prim.PathBegin + "\" y=\"" + prim.PathEnd + "\" />" + Environment.NewLine;
output += "<dimple x=\"" + prim.ProfileBegin + "\" y=\"" + prim.ProfileEnd + "\" />" + Environment.NewLine;
output += "<cut x=\"" + data.PathBegin + "\" y=\"" + data.PathEnd + "\" />" + Environment.NewLine;
output += "<dimple x=\"" + data.ProfileBegin + "\" y=\"" + data.ProfileEnd + "\" />" + Environment.NewLine;
}
output += "<advancedcut x=\"" + prim.ProfileBegin + "\" y=\"" + prim.ProfileEnd + "\" />" + Environment.NewLine;
output += "<hollow val=\"" + prim.ProfileHollow + "\" />" + Environment.NewLine;
output += "<twist x=\"" + prim.PathTwistBegin + "\" y=\"" + prim.PathTwist + "\" />" + Environment.NewLine;
output += "<topsize x=\"" + Math.Abs(prim.PathScaleX - 1.0f) + "\" y=\"" +
Math.Abs(prim.PathScaleY - 1.0f) + "\" />" + Environment.NewLine;
output += "<holesize x=\"" + (1.0f - prim.PathScaleX) + "\" y=\"" + (1.0f - prim.PathScaleY) + "\" />" + Environment.NewLine;
output += "<topshear x=\"" + prim.PathShearX + "\" y=\"" + prim.PathShearY + "\" />" + Environment.NewLine;
output += "<taper x=\"" + prim.PathTaperX + "\" y=\"" + prim.PathTaperY + "\" />" + Environment.NewLine;
output += "<revolutions val=\"" + prim.PathRevolutions + "\" />" + Environment.NewLine;
output += "<radiusoffset val=\"" + prim.PathRadiusOffset + "\" />" + Environment.NewLine;
output += "<skew val=\"" + prim.PathSkew + "\" />" + Environment.NewLine;
output += "<material val=\"" + prim.Material + "\" />" + Environment.NewLine;
output += "<advancedcut x=\"" + data.ProfileBegin + "\" y=\"" + data.ProfileEnd + "\" />" + Environment.NewLine;
output += "<hollow val=\"" + data.ProfileHollow + "\" />" + Environment.NewLine;
output += "<twist x=\"" + data.PathTwistBegin + "\" y=\"" + data.PathTwist + "\" />" + Environment.NewLine;
output += "<topsize x=\"" + Math.Abs(data.PathScaleX - 1.0f) + "\" y=\"" +
Math.Abs(data.PathScaleY - 1.0f) + "\" />" + Environment.NewLine;
output += "<holesize x=\"" + (1.0f - data.PathScaleX) + "\" y=\"" + (1.0f - data.PathScaleY) + "\" />" + Environment.NewLine;
output += "<topshear x=\"" + data.PathShearX + "\" y=\"" + data.PathShearY + "\" />" + Environment.NewLine;
output += "<taper x=\"" + data.PathTaperX + "\" y=\"" + data.PathTaperY + "\" />" + Environment.NewLine;
output += "<revolutions val=\"" + data.PathRevolutions + "\" />" + Environment.NewLine;
output += "<radiusoffset val=\"" + data.PathRadiusOffset + "\" />" + Environment.NewLine;
output += "<skew val=\"" + data.PathSkew + "\" />" + Environment.NewLine;
output += "<material val=\"" + data.Material + "\" />" + Environment.NewLine;
// FIXME: Hollowshape. 16-21 = circle, 32-37 = square, 48-53 = triangle
output += "<hollowshape val=\"0\" />" + Environment.NewLine;