示例#1
0
        public override ModelContent Process(NodeContent input, ContentProcessorContext context)
        {
            // DEBUG
            printNodeTree(input, context, "");

            // Hack (THERES IS A BUG IN THE XNA 2 BETA VERSION. THIS LINE SHOULD BE REMOVED IN THE FINAL VERSION)
            Scale *= 0.1f;

            // Process model
            ModelContent model = base.Process(input, context);

            // Transform all mesh in a absolute coordinate system
            //FlattenMesh(skeleton, input, context);

            // Now extract the model skeleton and all animations
            AnimatedModelData animatedModelData = ExtractSkeletonAndAnimations(input, context);

            // Extract all points from the mesh
            List <Vector3> vertexList = new List <Vector3>();

            GetModelVertices(input, vertexList);

            // Generate bounding volumes
            BoundingBox    modelBoundBox    = BoundingBox.CreateFromPoints(vertexList);
            BoundingSphere modelBoundSphere = BoundingSphere.CreateFromPoints(vertexList);

            Dictionary <string, object> tagDictionary = new Dictionary <string, object>();

            tagDictionary.Add("AnimatedModelData", animatedModelData);
            tagDictionary.Add("ModelBoudingBox", modelBoundBox);
            tagDictionary.Add("ModelBoudingSphere", modelBoundSphere);
            model.Tag = tagDictionary;

            return(model);
        }
示例#2
0
        public override ModelContent Process(NodeContent input, ContentProcessorContext context)
        {
            AnimatedModelData animatedModelData = ExtractSkeletonAndAnimations(input, context);

            Dictionary <string, object> dictionary = new Dictionary <string, object> {
                { "AnimatedModelData", animatedModelData }
            };

            ModelContent modelContent = base.Process(input, context);

            modelContent.Tag = dictionary;

            return(modelContent);
        }