Project/01 - MonoGame/MonoGame.Framework/Graphics/GraphicsDevice.cs
/// <summary>
/// Draw primitives of the specified type by indexing into the given array of vertices with 32-bit indices.
/// </summary>
/// <typeparam name="T">The type of the vertices.</typeparam>
/// <param name="primitiveType">The type of primitives to draw with the vertices.</param>
/// <param name="vertexData">An array of vertices to draw.</param>
/// <param name="vertexOffset">The index in the array of the first vertex to draw.</param>
/// <param name="indexOffset">The index in the array of indices of the first index to use</param>
/// <param name="primitiveCount">The number of primitives to draw.</param>
/// <param name="numVertices">The number of vertices to draw.</param>
/// <param name="indexData">The index data.</param>
/// <param name="vertexDeclaration">The layout of the vertices.</param>
/// <remarks>All indices in the vertex buffer are interpreted relative to the specified <paramref name="vertexOffset"/>.
/// For example value of zero in the array of indices points to the vertex at index <paramref name="vertexOffset"/>
/// in the array of vertices.</remarks>
Draw primitives of the specified type by indexing into the given array of vertices with 32-bit indices.
Draw primitives of the specified type by indexing into the given array of vertices with 32 - bit indices .
public void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices, int[] indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct
        {
            if (vertexData == null || vertexData.Length == 0)
                throw new ArgumentNullException("vertexData");
            if (vertexOffset < 0 || vertexOffset >= vertexData.Length)
                throw new ArgumentOutOfRangeException("vertexOffset");
            if (numVertices <= 0 || numVertices > vertexData.Length)
                throw new ArgumentOutOfRangeException("numVertices");
            if (vertexOffset + numVertices > vertexData.Length)
                throw new ArgumentOutOfRangeException("numVertices");
            if (indexData == null || indexData.Length == 0)
                throw new ArgumentNullException("indexData");
            if (indexOffset < 0 || indexOffset >= indexData.Length)
                throw new ArgumentOutOfRangeException("indexOffset");
            if (primitiveCount <= 0)
                throw new ArgumentOutOfRangeException("primitiveCount");
            if (indexOffset + GetElementCountArray(primitiveType, primitiveCount) > indexData.Length)
                throw new ArgumentOutOfRangeException("primitiveCount");
            if (vertexDeclaration == null)
                throw new ArgumentNullException("vertexDeclaration");
            if (vertexDeclaration.VertexStride < ReflectionHelpers.SizeOf<T>.Get())
                throw new ArgumentOutOfRangeException("vertexDeclaration", "Vertex stride of vertexDeclaration should be at least as big as the stride of the actual vertices.");
            PlatformDrawUserIndexedPrimitives<T>(primitiveType, vertexData, vertexOffset, numVertices, indexData, indexOffset, primitiveCount, vertexDeclaration);
            unchecked
            {
                _graphicsMetrics._drawCount++;
                _graphicsMetrics._primitiveCount +=  primitiveCount;
            }
        }
public void DrawUserIndexedPrimitives < T > ( PrimitiveType primitiveType , T [ ] vertexData , int vertexOffset , int numVertices , int [ ] indexData , int indexOffset , int primitiveCount , VertexDeclaration vertexDeclaration ) where T : struct { if ( vertexData == null || vertexData . Length == 0 ) throw new ArgumentNullException ( " " ) ; if ( vertexOffset < 0 || vertexOffset >= vertexData . Length ) throw new ArgumentOutOfRangeException ( " " ) ; if ( numVertices <= 0 || numVertices > vertexData . Length ) throw new ArgumentOutOfRangeException ( " " ) ; if ( vertexOffset + numVertices > vertexData . Length ) throw new ArgumentOutOfRangeException ( " " ) ; if ( indexData == null || indexData . Length == 0 ) throw new ArgumentNullException ( " " ) ; if ( indexOffset < 0 || indexOffset >= indexData . Length ) throw new ArgumentOutOfRangeException ( " " ) ; if ( primitiveCount <= 0 ) throw new ArgumentOutOfRangeException ( " " ) ; if ( indexOffset + GetElementCountArray ( primitiveType , primitiveCount ) > indexData . Length ) throw new ArgumentOutOfRangeException ( " " ) ; if ( vertexDeclaration == null ) throw new ArgumentNullException ( " " ) ; if ( vertexDeclaration . VertexStride < ReflectionHelpers . SizeOf < T > . Get ( ) ) throw new ArgumentOutOfRangeException ( " " , " " ) ; PlatformDrawUserIndexedPrimitives < T > ( primitiveType , vertexData , vertexOffset , numVertices , indexData , indexOffset , primitiveCount , vertexDeclaration ) ; unchecked { _graphicsMetrics . _drawCount ++ ; _graphicsMetrics . _primitiveCount += primitiveCount ; } }
Draw primitives of the specified type by indexing into the given array of vertices with 32-bit indices.
Draw primitives of the specified type by indexing into the given array of vertices with 32 - bit indices .
// These parameter checks are a duplicate of the checks in the short[] overload of DrawUserIndexedPrimitives. // Inlined here for efficiency.
primitiveType
PrimitiveType
The type of primitives to draw with the vertices.
The type of primitives to draw with the vertices .
vertexData
T[]
An array of vertices to draw.
An array of vertices to draw .
vertexOffset
int
The index in the array of the first vertex to draw.
The index in the array of the first vertex to draw .
numVertices
int
The number of vertices to draw.
The number of vertices to draw .
indexData
int[]
The index data.
The index data .
indexOffset
int
The index in the array of indices of the first index to use
The index in the array of indices of the first index to use
primitiveCount
int
The number of primitives to draw.
The number of primitives to draw .
vertexDeclaration
VertexDeclaration
The layout of the vertices.
The layout of the vertices .
typeparam
The type of the vertices.
The type of the vertices .
remarks
All indices in the vertex buffer are interpreted relative to the specified .
For example value of zero in the array of indices points to the vertex at index
in the array of vertices.
All indices in the vertex buffer are interpreted relative to the specified . For example value of zero in the array of indices points to the vertex at index in the array of vertices .