Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Model"/> class.
        /// </summary>
        /// <param name="availableAnimations">
        /// The available animations.
        /// </param>
        /// <param name="rootBone">
        /// The root bone, or null if there's no skeletal information.
        /// </param>
        /// <param name="vertexes">
        /// The vertexes associated with this model.
        /// </param>
        /// <param name="indices">
        /// The indices associated with the model.
        /// </param>
        public Model(
            IModelRenderConfiguration[] modelRenderConfigurations,
            IRenderBatcher renderBatcher,
            string name,
            IAnimationCollection availableAnimations,
            IMaterial material,
            IModelBone rootBone,
            ModelVertex[] vertexes,
            int[] indices)
        {
            Name = name;
            AvailableAnimations = availableAnimations;
            Root = rootBone;
            Vertexes = vertexes;
            Indices = indices;
            Material = material;

            _cachedVertexBuffers = new Dictionary<object, VertexBuffer>();
            _modelRenderConfigurations = modelRenderConfigurations;
            _renderBatcher = renderBatcher;

            if (Root != null)
            {
                _flattenedBones = Root.Flatten();
                Bones = _flattenedBones.ToDictionary(k => k.Name, v => v);
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Model"/> class.
        /// </summary>
        /// <param name="availableAnimations">
        /// The available animations.
        /// </param>
        /// <param name="rootBone">
        /// The root bone, or null if there's no skeletal information.
        /// </param>
        /// <param name="vertexes">
        /// The vertexes associated with this model.
        /// </param>
        /// <param name="indices">
        /// The indices associated with the model.
        /// </param>
        public Model(
            IAnimationCollection availableAnimations,
            IModelBone rootBone,
            VertexPositionNormalTextureBlendable[] vertexes,
            int[] indices)
        {
            this.AvailableAnimations = availableAnimations;
            this.Root = rootBone;
            this.Vertexes = vertexes;
            this.Indices = indices;

            if (this.Root != null)
            {
                this.m_FlattenedBones = this.Root.Flatten();
                this.Bones = this.m_FlattenedBones.ToDictionary(k => k.Name, v => v);
            }
        }