示例#1
0
        public void DrawUserIndexedPrimitives <T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices, int[] indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct
        {
            // These parameter checks are a duplicate of the checks in the short[] overload of DrawUserIndexedPrimitives.
            // Inlined here for efficiency.

            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");
            }

            PlatformDrawUserIndexedPrimitives <T> (primitiveType, vertexData, vertexOffset, numVertices, indexData, indexOffset, primitiveCount, vertexDeclaration);

            unchecked
            {
                _graphicsMetrics._drawCount++;
                _graphicsMetrics._primitiveCount += (ulong)primitiveCount;
            }
        }
示例#2
0
        public void DrawUserPrimitives <T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct
        {
            if (vertexData == null)
            {
                throw new ArgumentNullException("vertexData");
            }

            if (vertexData.Length == 0)
            {
                throw new ArgumentOutOfRangeException("vertexData");
            }

            if (vertexOffset < 0 || vertexOffset >= vertexData.Length)
            {
                throw new ArgumentOutOfRangeException("vertexOffset");
            }

            if (primitiveCount <= 0)
            {
                throw new ArgumentOutOfRangeException("primitiveCount");
            }

            var vertexCount = GetElementCountArray(primitiveType, primitiveCount);

            if (vertexOffset + vertexCount > vertexData.Length)
            {
                throw new ArgumentOutOfRangeException("primitiveCount");
            }

            if (vertexDeclaration == null)
            {
                throw new ArgumentNullException("vertexDeclaration");
            }

            PlatformDrawUserPrimitives <T> (primitiveType, vertexData, vertexOffset, vertexDeclaration, vertexCount);

            unchecked
            {
                _graphicsMetrics._drawCount++;
                _graphicsMetrics._primitiveCount += (ulong)primitiveCount;
            }
        }