Another take related to the previous commit.

viewer-2-initial-appearance
Diva Canto 2010-10-19 15:07:15 -07:00
parent 3b2d9a9939
commit 8acac3d07f
1 changed files with 17 additions and 13 deletions

View File

@ -1435,22 +1435,26 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
static Quaternion ReadQuaternion(XmlTextReader reader, string name) static Quaternion ReadQuaternion(XmlTextReader reader, string name)
{ {
Quaternion quat; Quaternion quat = new Quaternion();
reader.ReadStartElement(name); reader.ReadStartElement(name);
if (reader.Name == "X") // assume X, Y, Z, W order while (reader.NodeType != XmlNodeType.EndElement)
{ {
quat.X = reader.ReadElementContentAsFloat("X", String.Empty); switch (reader.Name.ToLower())
quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); {
quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); case "x":
quat.W = reader.ReadElementContentAsFloat("W", String.Empty); quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
} break;
else // assume w, x, y, z case "y":
{ quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
quat.W = reader.ReadElementContentAsFloat("w", String.Empty); break;
quat.X = reader.ReadElementContentAsFloat("x", String.Empty); case "z":
quat.Y = reader.ReadElementContentAsFloat("y", String.Empty); quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
quat.Z = reader.ReadElementContentAsFloat("z", String.Empty); break;
case "w":
quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
break;
}
} }
reader.ReadEndElement(); reader.ReadEndElement();