コード例 #1
0
        object IContentProcessor.Process(object input, ContentProcessorContext context)
        {
            context.Logger.LogMessage("Processing Dynamic Model");
            try
            {
                var model        = Process(input as NodeContent, context);
                var dynamicModel = new DynamicModelContent(model);

                foreach (var mesh in dynamicModel.Meshes)
                {
                    foreach (var part in mesh.MeshParts)
                    {
                        ProcessVertexBuffer(dynamicModel, context, part);
                        ProcessIndexBuffer(dynamicModel, context, part);
                    }
                }

                return(dynamicModel);
            }
            catch (Exception ex)
            {
                context.Logger.LogMessage("Error {0}", ex);
                throw;
            }
        }
コード例 #2
0
        object IContentProcessor.Process(object input, ContentProcessorContext context)
        {
            var model       = Process((NodeContent)input, context);
            var outputModel = new DynamicModelContent(model);

            foreach (var mesh in outputModel.Meshes)
            {
                foreach (var part in mesh.MeshParts)
                {
                    ProcessVertexBuffer(outputModel, context, part);
                    ProcessIndexBuffer(outputModel, context, part);
                }
            }

            // import animation
            var animationProcessor = new AnimationsProcessor();

            animationProcessor.MaxBones = this.MaxBones;
            animationProcessor.GenerateKeyframesFrequency = this.GenerateKeyframesFrequency;
            animationProcessor.FixRealBoneRoot            = this._fixRealBoneRoot;
            var animation = animationProcessor.Process((NodeContent)input, context);

            outputModel.Tag = animation;

            //ProcessNode((NodeContent)input);

            return(outputModel);
        }
コード例 #3
0
 protected virtual void ProcessIndexBuffer(DynamicModelContent dynamicModel, ContentProcessorContext context, DynamicModelMeshPartContent part)
 {
     if (IndexBufferType != DynamicModelContent.BufferType.Default)
     {
         if (!IndexBufferCache.TryGetValue(part.IndexBuffer, out var ib))
         {
             ib             = part.IndexBuffer;
             ib.IsWriteOnly = IndexBufferType == DynamicModelContent.BufferType.DynamicWriteOnly;
             IndexBufferCache[part.IndexBuffer] = ib;
         }
         part.IndexBuffer = ib;
     }
 }
コード例 #4
0
 protected virtual void ProcessVertexBuffer(DynamicModelContent dynamicModel, ContentProcessorContext context, DynamicModelMeshPartContent part)
 {
     if (VertexBufferType != DynamicModelContent.BufferType.Default)
     {
         // Replace the default VertexBufferContent with CpuAnimatedVertexBufferContent.
         if (!VertexBufferCache.TryGetValue(part.VertexBuffer, out var vb))
         {
             vb             = part.VertexBuffer;
             vb.IsWriteOnly = VertexBufferType == DynamicModelContent.BufferType.DynamicWriteOnly;
             VertexBufferCache[part.VertexBuffer] = vb;
         }
         part.VertexBuffer = vb;
     }
 }
コード例 #5
0
 protected override void ProcessVertexBuffer(DynamicModelContent dynamicModel, ContentProcessorContext context, DynamicModelMeshPartContent part)
 {
     if (VertexBufferType != DynamicModelContent.BufferType.Default)
     {
         // Replace the default VertexBufferContent with CpuAnimatedVertexBufferContent.
         CpuAnimatedVertexBufferContent vb;
         if (!_vertexBufferCache.TryGetValue(part.VertexBuffer, out vb))
         {
             vb             = new CpuAnimatedVertexBufferContent(part.VertexBuffer);
             vb.IsWriteOnly = (VertexBufferType == DynamicModelContent.BufferType.DynamicWriteOnly);
             _vertexBufferCache[part.VertexBuffer] = vb;
         }
         part.VertexBuffer = vb;
     }
 }
コード例 #6
0
        object IContentProcessor.Process(object input, ContentProcessorContext context)
        {
            var model        = Process((NodeContent)input, context);
            var dynamicModel = new DynamicModelContent(model);

            foreach (var mesh in dynamicModel.Meshes)
            {
                foreach (var part in mesh.MeshParts)
                {
                    ProcessVertexBuffer(dynamicModel, context, part);
                    ProcessIndexBuffer(dynamicModel, context, part);
                }
            }

            return(dynamicModel);
        }