예제 #1
0
        /// <summary>
        /// Applies the initial Joint Transformation to the passed Vertex
        /// </summary>
        /// <param name="index">Index of the current Joint withi itÄs parent</param>
        /// <param name="v">The Vertex you want to Transform</param>
        /// <returns>Transformed Vertex</returns>
        protected Vector3f Transform(int index, Vector3f v)
        {
            //no Parent -> no Transform
            if (parent == null)
            {
                return(v);
            }

            //Hashtable map = parent.LoadJointRelationMap();
            //TransformNode tn = AssignedTransformNode(index);

            //Get the Transformation Hirarchy
            VectorTransformations t = new VectorTransformations();

            t.Add(parent.Model.Transformations[index]);

            /*
             * while (index>=0)
             * {
             *      t.Add(parent.Model.Transformations[index]);
             *      if (map.ContainsKey(index)) index = (int)map[index];
             *      else index = -1;
             * }*/

            //Apply Transformations
            for (int i = t.Count - 1; i >= 0; i--)
            {
                v = t[i].Transform(v);
            }

            return(v);
        }
예제 #2
0
        /// <summary>
        /// Unserializes a BinaryStream into the Attributes of this Instance
        /// </summary>
        /// <param name="reader">The Stream that contains the FileData</param>
        public void Unserialize(System.IO.BinaryReader reader)
        {
            int count = reader.ReadInt32();

            transforms.Clear();
            for (int i = 0; i < count; i++)
            {
                VectorTransformation t = new VectorTransformation(VectorTransformation.TransformOrder.RotateTranslate);
                t.Unserialize(reader);
                transforms.Add(t);
            }

            count = reader.ReadInt32();
            names.Clear();
            for (int i = 0; i < count; i++)
            {
                GmdcNamePair p = new GmdcNamePair();
                p.Unserialize(reader);
                names.Add(p);
            }

            subset.Unserialize(reader);
        }