* Fixing incorrect quaternion multiplication code

* Changing the foreach loops in ObjectManager.InterpolationTimer to use the ForEach() functions
* Avoid running packet.ToString() twice for every packet in SLProxy analyst

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1616 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2008-01-11 23:49:28 +00:00
parent 7436157475
commit a44ff50e76
3 changed files with 20 additions and 18 deletions

View File

@@ -717,7 +717,9 @@ public class Analyst : ProxyPlugin
// LogPacket: dump a packet to the console
private void LogPacket(Packet packet, IPEndPoint endPoint, Direction direction)
{
if (logGrep == null || (logGrep != null && Regex.IsMatch(packet.ToString(), logGrep)))
string packetText = packet.ToString();
if (logGrep == null || (logGrep != null && Regex.IsMatch(packetText, logGrep)))
{
Console.WriteLine("{0} {1,21} {2,5} {3}{4}{5}"
, direction == Direction.Incoming ? "<--" : "-->"
@@ -725,7 +727,7 @@ public class Analyst : ProxyPlugin
, packet.Header.Sequence
, InterpretOptions(packet.Header.Flags)
, Environment.NewLine
, packet
, packetText
);
}
}

View File

@@ -2393,9 +2393,8 @@ namespace libsecondlife
float adjSeconds = seconds * Client.Network.Simulators[i].Stats.Dilation;
// Iterate through all of this sims avatars
lock (Client.Network.Simulators[i].ObjectsAvatars.Dictionary)
{
foreach (Avatar avatar in Client.Network.Simulators[i].ObjectsAvatars.Dictionary.Values)
Client.Network.Simulators[i].ObjectsAvatars.ForEach(
delegate(Avatar avatar)
{
#region Linear Motion
// Only do movement interpolation (extrapolation) when there is a non-zero velocity but
@@ -2404,16 +2403,15 @@ namespace libsecondlife
{
avatar.Position += (avatar.Velocity + (0.5f * (adjSeconds - HAVOK_TIMESTEP)) *
avatar.Acceleration) * adjSeconds;
avatar.Velocity = avatar.Velocity + avatar.Acceleration * adjSeconds;
avatar.Velocity += avatar.Acceleration * adjSeconds;
}
#endregion Linear Motion
}
}
);
// Iterate through all of this sims primitives
lock (Client.Network.Simulators[i].ObjectsPrimitives.Dictionary)
{
foreach (Primitive prim in Client.Network.Simulators[i].ObjectsPrimitives.Dictionary.Values)
Client.Network.Simulators[i].ObjectsPrimitives.ForEach(
delegate(Primitive prim)
{
if (prim.Joint == Primitive.JointType.Invalid)
{
@@ -2438,8 +2436,8 @@ namespace libsecondlife
if (prim.Acceleration != LLVector3.Zero && prim.Velocity == LLVector3.Zero)
{
prim.Position += (prim.Velocity + (0.5f * (adjSeconds - HAVOK_TIMESTEP)) *
prim.Acceleration) * adjSeconds;
prim.Velocity = prim.Velocity + prim.Acceleration * adjSeconds;
prim.Acceleration) * adjSeconds;
prim.Velocity += prim.Acceleration * adjSeconds;
}
#endregion Linear Motion
}
@@ -2456,7 +2454,7 @@ namespace libsecondlife
Client.Log("Unhandled joint type " + prim.Joint, Helpers.LogLevel.Warning);
}
}
}
);
}
}

View File

@@ -2034,11 +2034,13 @@ namespace libsecondlife
/// <returns></returns>
public static LLQuaternion operator *(LLQuaternion lhs, LLQuaternion rhs)
{
LLQuaternion ret = new LLQuaternion();
ret.W = lhs.W * rhs.W - lhs.X * rhs.X - lhs.Y * rhs.Y - lhs.Z * rhs.Z;
ret.X = lhs.W * rhs.X + lhs.X * rhs.W + lhs.Y * rhs.Z - lhs.Z * rhs.Y;
ret.Y = lhs.W * rhs.Y + lhs.Y * rhs.W + lhs.Z * rhs.X - lhs.X * rhs.Z;
ret.Z = lhs.W * rhs.Z + lhs.Z * rhs.W + lhs.X * rhs.Y - lhs.Y * rhs.X;
LLQuaternion ret = new LLQuaternion(
rhs.W * lhs.X + rhs.X * lhs.W + rhs.Y * lhs.Z - rhs.Z * lhs.Y,
rhs.W * lhs.Y + rhs.Y * lhs.W + rhs.Z * lhs.X - rhs.X * lhs.Z,
rhs.W * lhs.Z + rhs.Z * lhs.W + rhs.X * lhs.Y - rhs.Y * lhs.X,
rhs.W * lhs.W - rhs.X * lhs.X - rhs.Y * lhs.Y - rhs.Z * lhs.Z
);
return ret;
}