Example #1
0
        private void ReadBones(ContentReader input)
        {
            ModelBone[] bones = new ModelBone[input.ReadInt32()];

            for (int i = 0; i < bones.Length; i++)
            {
                string name      = input.ReadObject <string>();
                Matrix transform = input.ReadMatrix();
                bones[i] = new ModelBone(i, name, transform);
            }

            this.bones = new ModelBoneCollection(bones);

            foreach (ModelBone bone in bones)
            {
                ModelBone   newParent   = this.ReadBoneReference(input);
                int         size        = input.ReadInt32();
                ModelBone[] newChildren = new ModelBone[size];
                for (int j = 0; j < size; j++)
                {
                    newChildren[j] = this.ReadBoneReference(input);
                }
                bone.SetParentChildren(newParent, newChildren);
            }
        }
Example #2
0
        public Model(GraphicsDevice graphicsDevice, List <ModelBone> bones, List <ModelMesh> meshes)
        {
            // TODO: Complete member initialization
            this.graphicsDevice = graphicsDevice;

            Bones  = new ModelBoneCollection(bones);
            Meshes = new ModelMeshCollection(meshes);
        }
Example #3
0
        /// <summary>
        /// Constructs a model.
        /// </summary>
        /// <param name="graphicsDevice">A valid reference to <see cref="GraphicsDevice"/>.</param>
        /// <param name="bones">The collection of bones.</param>
        /// <param name="meshes">The collection of meshes.</param>
        public Model(GraphicsDevice graphicsDevice, List <ModelBone> bones, List <ModelMesh> meshes)
        {
            if (graphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice");
            }

            // TODO: Complete member initialization
            this.graphicsDevice = graphicsDevice;

            Bones  = new ModelBoneCollection(bones);
            Meshes = new ModelMeshCollection(meshes);
        }
Example #4
0
 internal Enumerator(ModelBoneCollection collection)
 {
     this.collection = collection;
     position        = -1;
 }
Example #5
0
 /// <summary>
 /// Constructs a model.
 /// </summary>
 /// <param name="graphicsDevice">A valid reference to <see cref="GraphicsDevice"/>.</param>
 /// <param name="bones">The collection of bones.</param>
 /// <param name="meshes">The collection of meshes.</param>
 internal Model(GraphicsDevice graphicsDevice, List <ModelBone> bones, List <ModelMesh> meshes)
 {
     Bones  = new ModelBoneCollection(bones);
     Meshes = new ModelMeshCollection(meshes);
 }
Example #6
0
 public ModelBone()
 {
     Children = new ModelBoneCollection(new List <ModelBone>());
     meshes   = new List <ModelMesh>();
 }
Example #7
0
 internal void AddChild(ModelBone modelBone)
 {
     children.Add(modelBone);
     Children = new ModelBoneCollection(children);
 }
Example #8
0
 internal void SetParentChildren(ModelBone Parent, ModelBone[] Children)
 {
     this.parent   = Parent;
     this.children = new ModelBoneCollection(Children);
 }
 internal Enumerator(ModelBoneCollection collection)
 {
     _collection = collection;
     _position   = -1;
 }