inlined packet deserialization

afrisby
lbsa71 2007-07-13 12:44:50 +00:00
parent 33ef93f4a6
commit 581ea0d92e
2 changed files with 30 additions and 35 deletions

View File

@ -98,34 +98,5 @@ 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

@ -217,19 +217,43 @@ namespace OpenSim.Region.ClientStack
case PacketType.ObjectAdd: case PacketType.ObjectAdd:
if (OnAddPrim != null) if (OnAddPrim != null)
{ {
ObjectAddPacket packet = (ObjectAddPacket) Pack ; ObjectAddPacket addPacket = (ObjectAddPacket) Pack ;
PrimitiveBaseShape primShape = PrimitiveBaseShape.FromAddPacket( packet );
OnAddPrim(this.AgentId, packet.ObjectData.RayEnd, primShape ); PrimitiveBaseShape shape = new PrimitiveBaseShape();
shape.PCode = addPacket.ObjectData.PCode;
shape.PathBegin = addPacket.ObjectData.PathBegin;
shape.PathEnd = addPacket.ObjectData.PathEnd;
shape.PathScaleX = addPacket.ObjectData.PathScaleX;
shape.PathScaleY = addPacket.ObjectData.PathScaleY;
shape.PathShearX = addPacket.ObjectData.PathShearX;
shape.PathShearY = addPacket.ObjectData.PathShearY;
shape.PathSkew = addPacket.ObjectData.PathSkew;
shape.ProfileBegin = addPacket.ObjectData.ProfileBegin;
shape.ProfileEnd = addPacket.ObjectData.ProfileEnd;
shape.Scale = addPacket.ObjectData.Scale;
shape.PathCurve = addPacket.ObjectData.PathCurve;
shape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
shape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
shape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
shape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
shape.PathTaperX = addPacket.ObjectData.PathTaperX;
shape.PathTaperY = addPacket.ObjectData.PathTaperY;
shape.PathTwist = addPacket.ObjectData.PathTwist;
shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
shape.TextureEntry = ntex.ToBytes();
OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape);
} }
break; break;
case PacketType.ObjectShape: case PacketType.ObjectShape:
ObjectShapePacket shape = (ObjectShapePacket)Pack; ObjectShapePacket shapePacket = (ObjectShapePacket)Pack;
for (int i = 0; i < shape.ObjectData.Length; i++) for (int i = 0; i < shapePacket.ObjectData.Length; i++)
{ {
if (OnUpdatePrimShape != null) if (OnUpdatePrimShape != null)
{ {
OnUpdatePrimShape(shape.ObjectData[i].ObjectLocalID, shape.ObjectData[i]); OnUpdatePrimShape(shapePacket.ObjectData[i].ObjectLocalID, shapePacket.ObjectData[i]);
} }
} }
break; break;