Microsoft.Xna.Framework.Graphics.SpriteBatcher.FlushVertexArray C# (CSharp) Метод

FlushVertexArray() приватный Метод

Sends the triangle list to the graphics device. Here is where the actual drawing starts.
private FlushVertexArray ( int start, int end, Effect effect, Texture texture ) : void
start int Start index of vertices to draw. Not used except to compute the count of vertices to draw.
end int End index of vertices to draw. Not used except to compute the count of vertices to draw.
effect Effect The custom effect to apply to the geometry
texture Texture The texture to draw.
Результат void
        private void FlushVertexArray(int start, int end, Effect effect, Texture texture)
        {
            if (start == end)
                return;

            var vertexCount = end - start;

            // If the effect is not null, then apply each pass and render the geometry
            if (effect != null)
            {
                var passes = effect.CurrentTechnique.Passes;
                foreach (var pass in passes)
                {
                    pass.Apply();

                    // Whatever happens in pass.Apply, make sure the texture being drawn
                    // ends up in Textures[0].
                    _device.Textures[0] = texture;

                    _device.DrawUserIndexedPrimitives(
                        PrimitiveType.TriangleList,
                        _vertexArray,
                        0,
                        vertexCount,
                        _index,
                        0,
                        (vertexCount / 4) * 2,
                        VertexPositionColorTexture.VertexDeclaration);
                }
            }
            else
            {
                // If no custom effect is defined, then simply render.
                _device.DrawUserIndexedPrimitives(
                    PrimitiveType.TriangleList,
                    _vertexArray,
                    0,
                    vertexCount,
                    _index,
                    0,
                    (vertexCount / 4) * 2,
                    VertexPositionColorTexture.VertexDeclaration);
            }
        }
	}