protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (modelData != null)
                {
                    modelData.model = null;
                    modelData = null;
                }
            }

            base.Dispose(disposing);
        }
Exemple #2
0
        public virtual void BindModel(ModelData modelData)
        {
            this.ModelData = modelData;
            this.rootBone = modelData.model.Root;

            //  Set to bone transform matrix
            this.boneTransforms = new Matrix[this.ModelData.model.Bones.Count];
            this.ModelData.model.CopyAbsoluteBoneTransformsTo(this.boneTransforms);

            // Compute the bounding sphere of the ModelData.
            cullingSphere = new BoundingSphere();

            for (int i = 0; i < this.ModelData.model.Meshes.Count; i++)
            {
                ModelMesh mesh = this.ModelData.model.Meshes[i];

                cullingSphere = BoundingSphere.CreateMerged(cullingSphere, 
                                                            mesh.BoundingSphere);
            }

            cullingSphereLocalCenter = cullingSphere.Center;
        }
Exemple #3
0
        /// <summary>
        /// processes the necessary steps for binding a model.
        /// It creates AnimationBlender to the number of the model's bone.
        /// </summary>
        public override void BindModel(ModelData modelData)
        {
            base.BindModel(modelData);

            if (animationBlenderList.Count == 0)
            {
                //  Insert all bones in the AnimationBinder
                for (int i = 0; i < modelData.model.Bones.Count; i++)
                {
                    AnimationBlender animationBlender = new AnimationBlender();
                    animationBlender.Name = modelData.model.Bones[i].Name;

                    animationBlenderList.Add(animationBlender);
                }
            }
        }