Пример #1
0
        internal void ValidateIndices(Validation.ValidationContext result, uint vertexCount, PrimitiveType drawingType)
        {
            result = result.GetContext(this);

            SourceBufferView.ValidateBufferUsageGPU(result, BufferMode.ELEMENT_ARRAY_BUFFER);
            result.CheckLinkMustBeAnyOf(nameof(Normalized), Normalized, false);
            result.CheckLinkMustBeAnyOf(nameof(Encoding), Encoding, EncodingType.UNSIGNED_BYTE, EncodingType.UNSIGNED_SHORT, EncodingType.UNSIGNED_INT);
            result.CheckLinkMustBeAnyOf(nameof(Dimensions), Dimensions, DimensionType.SCALAR);

            uint restart_value = 0xff;

            if (this.Encoding == EncodingType.UNSIGNED_SHORT)
            {
                restart_value = 0xffff;
            }
            if (this.Encoding == EncodingType.UNSIGNED_INT)
            {
                restart_value = 0xffffffff;
            }

            var indices = this.AsIndicesArray();

            for (int i = 0; i < indices.Count; ++i)
            {
                result.CheckVertexIndex(i, indices[i], vertexCount, restart_value);
            }
        }