示例#1
0
        public override void setData <T>(T[] bufferInSystemMemory, int destinationOffsetInBytes, int lengthInBytes)
        {
            if (typeof(T) == typeof(byte))
            {
                myDataType = IndexBufferDatatype.UnsignedByte;
                count      = lengthInBytes / 1;
            }
            else if (typeof(T) == typeof(ushort))
            {
                myDataType = IndexBufferDatatype.UnsignedShort;
                count      = lengthInBytes / 2;
            }
            else if (typeof(T) == typeof(uint))
            {
                myDataType = IndexBufferDatatype.UnsignedInt;
                count      = lengthInBytes / 4;
            }
            else
            {
                throw new ArgumentException("bufferInSystemMemory must be an array of byte, ushort or uint.", "bufferInSystemMemory");
            }


            base.setData(bufferInSystemMemory, destinationOffsetInBytes, lengthInBytes);
        }
示例#2
0
        public static int SizeOf(IndexBufferDatatype type)
        {
            switch (type)
            {
                case IndexBufferDatatype.UnsignedShort:
                    return sizeof(ushort);
                case IndexBufferDatatype.UnsignedInt:
                    return sizeof(uint);
            }

            throw new ArgumentException("type");
        }
示例#3
0
        public static int SizeOf(IndexBufferDatatype type)
        {
            switch (type)
            {
            case IndexBufferDatatype.UnsignedShort:
                return(sizeof(ushort));

            case IndexBufferDatatype.UnsignedInt:
                return(sizeof(uint));
            }

            throw new ArgumentException("type");
        }
示例#4
0
        public static DrawElementsType To(IndexBufferDatatype type)
        {
            switch (type)
            {
            case IndexBufferDatatype.UnsignedShort:
                return(DrawElementsType.UnsignedShort);

            case IndexBufferDatatype.UnsignedInt:
                return(DrawElementsType.UnsignedInt);
            }

            throw new ArgumentException("type");
        }
        public static DrawElementsType To(IndexBufferDatatype type)
        {
            switch (type)
            {
                case IndexBufferDatatype.UnsignedShort:
                    return DrawElementsType.UnsignedShort;
                case IndexBufferDatatype.UnsignedInt:
                    return DrawElementsType.UnsignedInt;
            }

            throw new ArgumentException("type");
        }