Пример #1
0
        internal CpuSkinnedModelPart(int triangleCount, CpuVertex[] vertices, IndexBuffer indexBuffer)
        {
            this.triangleCount = triangleCount;
            this.vertexCount = vertices.Length;
            this.cpuVertices = vertices;
            this.indexBuffer = indexBuffer;

            // create our GPU resources
            gpuVertices = new VertexPositionNormalTexture[cpuVertices.Length];
            vertexBuffer = new DynamicVertexBuffer(indexBuffer.GraphicsDevice, typeof(VertexPositionNormalTexture), cpuVertices.Length, BufferUsage.WriteOnly);

            // copy texture coordinates once since they don't change with skinnning
            for (int i = 0; i < cpuVertices.Length; i++)
            {
                gpuVertices[i].TextureCoordinate = cpuVertices[i].TextureCoordinate;
            }
        }
        public void AddModelPart(
            int triangleCount,
            IndexCollection indexCollection,
            CpuVertex[] vertices,
            BasicMaterialContent material)
        {
            if (material == null)
                throw new ArgumentNullException("material");

            ModelParts.Add(new CpuSkinnedModelPartContent
            {
                TriangleCount = triangleCount,
                IndexCollection = indexCollection,
                Vertices = vertices,
                Material = material,
            });
        }