private Vector3 readPlaneNormal(XmlReader textReader) { Vector3 nml = new Vector3(); String[] n = textReader.GetAttribute(NORMAL).Split(SEPS); if (n.Length == 3) { nml.x = NumberParser.ParseFloat(n[0]); nml.y = NumberParser.ParseFloat(n[1]); nml.z = NumberParser.ParseFloat(n[2]); } else { Log.Default.sendMessage("Error loading normal on line " + /*textReader.LineNumber*/ "cannot get line number" + " does not contain 3 numbers value: " + textReader.Value, LogLevel.Error, "ShapeLoading"); } return(nml); }
private Vector3 readExtents(XmlReader textReader) { Vector3 extents = new Vector3(); String[] exts = textReader.GetAttribute(EXTENTS).Split(SEPS); if (exts.Length == 3) { extents.x = NumberParser.ParseFloat(exts[0]); extents.y = NumberParser.ParseFloat(exts[1]); extents.z = NumberParser.ParseFloat(exts[2]); } else { Log.Default.sendMessage("Error loading extents on line " + /*textReader.LineNumber*/ "cannot get line number" + " does not contain 3 numbers value: " + textReader.Value, LogLevel.Error, "ShapeLoading"); } return(extents); }
/// <summary> /// Read a rotation from the XML stream. /// </summary> /// <param name="xmlReader"></param> /// <returns></returns> private Quaternion readRotation(XmlReader xmlReader) { Quaternion rotation = new Quaternion(); xmlReader.Read(); String[] rots = xmlReader.Value.Split(SEPS); //Euler angles if (rots.Length == 3) { rotation.setEuler(NumberParser.ParseFloat(rots[0]) * DEG_TO_RAD, NumberParser.ParseFloat(rots[1]) * DEG_TO_RAD, NumberParser.ParseFloat(rots[2]) * DEG_TO_RAD); } else { Log.Default.sendMessage("Error loading rotation does not contain 3 numbers value: {0}.", LogLevel.Warning, "ShapeLoading", xmlReader.Value); rotation = Quaternion.Identity; } return(rotation); }
private Quaternion readRotation(XmlReader textReader) { Quaternion rotation = new Quaternion(); textReader.Read(); String[] rots = textReader.Value.Split(SEPS); //Euler angles if (rots.Length == 3) { rotation.setEuler(NumberParser.ParseFloat(rots[0]) * DEG_TO_RAD, NumberParser.ParseFloat(rots[1]) * DEG_TO_RAD, NumberParser.ParseFloat(rots[2]) * DEG_TO_RAD); } else { Log.Default.sendMessage("Error loading rotation on line " + /*textReader.LineNumber*/ "cannot get line number" + " does not contain 3 or 4 numbers value: " + textReader.Value, LogLevel.Warning, "ShapeLoading"); rotation = Quaternion.Identity; } return(rotation); }
/// <summary> /// Read a translation from the XML stream. /// </summary> /// <param name="textReader"></param> /// <returns></returns> private Vector3 readTranslation(XmlReader xmlReader) { Vector3 translation = new Vector3(); xmlReader.Read(); String[] locs = xmlReader.Value.Split(SEPS); if (locs.Length == 3) { translation.x = NumberParser.ParseFloat(locs[0]); translation.y = NumberParser.ParseFloat(locs[1]); translation.z = NumberParser.ParseFloat(locs[2]); } else { Log.Default.sendMessage("Error loading translation does not contain 3 numbers value: {0}.", LogLevel.Error, "ShapeLoading", xmlReader.Value); translation = Vector3.Zero; } return(translation); }
private Vector3 readTranslation(XmlReader textReader) { Vector3 translation = new Vector3(); textReader.Read(); String[] locs = textReader.Value.Split(SEPS); if (locs.Length == 3) { translation.x = NumberParser.ParseFloat(locs[0]); translation.y = NumberParser.ParseFloat(locs[1]); translation.z = NumberParser.ParseFloat(locs[2]); } else { Log.Default.sendMessage("Error loading translation on line " + /*textReader.LineNumber*/ "cannot get line number" + " does not contain 3 numbers value: " + textReader.Value, LogLevel.Error, "ShapeLoading"); translation = Vector3.Zero; } return(translation); }
float[] readVertices(XmlReader textReader) { textReader.Read(); String[] strVerts = textReader.Value.Split(SEPS); float[] vertices; float junk; if (NumberParser.TryParse(strVerts[strVerts.Length - 1], out junk)) { vertices = new float[strVerts.Length]; } else { vertices = new float[strVerts.Length - 1]; } for (uint i = 0; i < vertices.Length; ++i) { vertices[i] = NumberParser.ParseFloat(strVerts[i]); } return(vertices); }
private float readPlaneDistance(XmlReader textReader) { return(NumberParser.ParseFloat(textReader.GetAttribute(DISTANCE))); }
private float readHeight(XmlReader textReader) { return(NumberParser.ParseFloat(textReader.GetAttribute(HEIGHT))); }
private float readRadius(XmlReader textReader) { return(NumberParser.ParseFloat(textReader.GetAttribute(RADIUS))); }