Beispiel #1
0
            /// <summary>
            /// Quaternion serialization to XML
            /// </summary>
            /// <param name="doc">(REF) Document where object is serialized</param>
            /// <param name="elementNode">(REF) rootNode where to include the object inside the document</param>
            /// <param name="value">Quaternion to serialize</param>
            public static void SerializeQuaternionToXML(ref XmlDocument doc, ref XmlNode elementNode, BSEngine.Math.Quaternion value)
            {
                string x = value.x.ToString();
                if (x.Length == 1)
                {
                    x += ".0";
                }

                string y = value.y.ToString();
                if (y.Length == 1)
                {
                    y += ".0";
                }

                string z = value.z.ToString();
                if (z.Length == 1)
                {
                    z += ".0";
                }

                string w = value.w.ToString();
                if (z.Length == 1)
                {
                    z += ".0";
                }
                elementNode.InnerText = "(" + x + ", " + y + ", " + z + ", " + w + ")";
            }
Beispiel #2
0
            /// <summary>
            /// Vector2 serialization to XML
            /// </summary>
            /// <param name="doc">(REF) Document where object is serialized</param>
            /// <param name="elementNode">(REF) rootNode where to include the object inside the document</param>
            /// <param name="value">vector2 to serialize</param>
            public static void SerializeVector2ToXML(ref XmlDocument doc, ref XmlNode elementNode, BSEngine.Math.Vector2 value)
            {
                string x = value.x.ToString();
                if (x.Length == 1)
                {
                    x += ".0";
                }

                string y = value.y.ToString();
                if (y.Length == 1)
                {
                    y += ".0";
                }
                elementNode.InnerText = "(" + x + ", " + y + ")";
            }