public void Deserialize(OSDMap map)
{
GroupID = map["group-id"].AsUUID();
Material = (Material)map["material"].AsInteger();
Name = map["name"].AsString();
Position = map["pos"].AsVector3();
Rotation = map["rotation"].AsQuaternion();
Scale = map["scale"].AsVector3();
// Extra params
OSDArray extraParams = map["extra_parameters"] as OSDArray;
if (extraParams != null)
{
ExtraParams = new ExtraParam[extraParams.Count];
for (int i = 0; i < extraParams.Count; i++)
{
ExtraParam extraParam = new ExtraParam();
extraParam.Deserialize(extraParams[i] as OSDMap);
ExtraParams[i] = extraParam;
}
}
else
{
ExtraParams = new ExtraParam[0];
}
// Faces
OSDArray faces = map["facelist"] as OSDArray;
if (faces != null)
{
Faces = new Face[faces.Count];
for (int i = 0; i < faces.Count; i++)
{
Face face = new Face();
face.Deserialize(faces[i] as OSDMap);
Faces[i] = face;
}
}
else
{
Faces = new Face[0];
}
// Shape
OSDMap shape = map["shape"] as OSDMap;
OSDMap path = shape["path"] as OSDMap;
PathBegin = (float)path["begin"].AsReal();
PathCurve = path["curve"].AsInteger();
PathEnd = (float)path["end"].AsReal();
RadiusOffset = (float)path["radius_offset"].AsReal();
Revolutions = (float)path["revolutions"].AsReal();
ScaleX = (float)path["scale_x"].AsReal();
ScaleY = (float)path["scale_y"].AsReal();
ShearX = (float)path["shear_x"].AsReal();
ShearY = (float)path["shear_y"].AsReal();
Skew = (float)path["skew"].AsReal();
TaperX = (float)path["taper_x"].AsReal();
TaperY = (float)path["taper_y"].AsReal();
Twist = (float)path["twist"].AsReal();
TwistBegin = (float)path["twist_begin"].AsReal();
OSDMap profile = shape["profile"] as OSDMap;
ProfileBegin = (float)profile["begin"].AsReal();
ProfileCurve = profile["curve"].AsInteger();
ProfileEnd = (float)profile["end"].AsReal();
ProfileHollow = (float)profile["hollow"].AsReal();
OSDMap sculpt = shape["sculpt"] as OSDMap;
if (sculpt != null)
{
SculptID = sculpt["id"].AsUUID();
SculptType = (SculptType)sculpt["type"].AsInteger();
}
else
{
SculptID = UUID.Zero;
SculptType = 0;
}
}
}