Пример #1
0
        public void DrawVertices(VertexPositionColorTexture[] vertices)
        {
            if (vertices.Length % 3 != 0)
            {
                throw new ArgumentException("Wrong number of vertices supplied. Should be divisible by 3.");
            }
            Device.RenderState.CullMode      = CullMode.None;
            Device.SamplerStates[0].AddressU = TextureAddressMode.Clamp;
            Device.SamplerStates[0].AddressV = TextureAddressMode.Clamp;
            var effect = Sprite3D.GetEffect();

            Device.VertexDeclaration = Sprite3D.VertexDeclaration;
            effect.Texture           = this.Texture;
            effect.Begin();
            foreach (var pass in effect.CurrentTechnique.Passes)
            {
                pass.Begin();
                Device.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);
                pass.End();
            }
            effect.End();
        }