public OSDMap Serialize()
{
OSDMap map = new OSDMap();
map["group-id"] = OSD.FromUUID(GroupID);
map["material"] = OSD.FromInteger((int)Material);
map["name"] = OSD.FromString(Name);
map["pos"] = OSD.FromVector3(Position);
map["rotation"] = OSD.FromQuaternion(Rotation);
map["scale"] = OSD.FromVector3(Scale);
// Extra params
OSDArray extraParams = new OSDArray();
if (ExtraParams != null)
{
for (int i = 0; i < ExtraParams.Length; i++)
extraParams.Add(ExtraParams[i].Serialize());
}
map["extra_parameters"] = extraParams;
// Faces
OSDArray faces = new OSDArray();
if (Faces != null)
{
for (int i = 0; i < Faces.Length; i++)
faces.Add(Faces[i].Serialize());
}
map["facelist"] = faces;
// Shape
OSDMap shape = new OSDMap();
OSDMap path = new OSDMap();
path["begin"] = OSD.FromReal(PathBegin);
path["curve"] = OSD.FromInteger(PathCurve);
path["end"] = OSD.FromReal(PathEnd);
path["radius_offset"] = OSD.FromReal(RadiusOffset);
path["revolutions"] = OSD.FromReal(Revolutions);
path["scale_x"] = OSD.FromReal(ScaleX);
path["scale_y"] = OSD.FromReal(ScaleY);
path["shear_x"] = OSD.FromReal(ShearX);
path["shear_y"] = OSD.FromReal(ShearY);
path["skew"] = OSD.FromReal(Skew);
path["taper_x"] = OSD.FromReal(TaperX);
path["taper_y"] = OSD.FromReal(TaperY);
path["twist"] = OSD.FromReal(Twist);
path["twist_begin"] = OSD.FromReal(TwistBegin);
shape["path"] = path;
OSDMap profile = new OSDMap();
profile["begin"] = OSD.FromReal(ProfileBegin);
profile["curve"] = OSD.FromInteger(ProfileCurve);
profile["end"] = OSD.FromReal(ProfileEnd);
profile["hollow"] = OSD.FromReal(ProfileHollow);
shape["profile"] = profile;
OSDMap sculpt = new OSDMap();
sculpt["id"] = OSD.FromUUID(SculptID);
sculpt["type"] = OSD.FromInteger((int)SculptType);
shape["sculpt"] = sculpt;
map["shape"] = shape;
return map;
}