コード例 #1
0
ファイル: glTF.cs プロジェクト: ousttrue/RectUI
        static bool CheckType(Type t, glComponentType ct)
        {
            switch (ct)
            {
            case glComponentType.BYTE: return(t == typeof(sbyte));

            case glComponentType.SHORT: return(t == typeof(short));

            case glComponentType.UNSIGNED_BYTE: return(t == typeof(byte));

            case glComponentType.UNSIGNED_SHORT: return(t == typeof(ushort));

            case glComponentType.UNSIGNED_INT: return(t == typeof(uint));

            case glComponentType.FLOAT: return(t == typeof(float));
            }
            throw new NotImplementedException();
        }
コード例 #2
0
        public static int GetByteSize(this glComponentType self)
        {
            switch (self)
            {
            case glComponentType.BYTE: return(1);

            case glComponentType.UNSIGNED_BYTE: return(1);

            case glComponentType.SHORT: return(2);

            case glComponentType.UNSIGNED_SHORT: return(2);

            case glComponentType.UNSIGNED_INT: return(4);

            case glComponentType.FLOAT: return(4);

            default: throw new System.NotImplementedException();
            }
        }
コード例 #3
0
        IEnumerable <int> _GetIndices(glTFBufferView view, int count, int byteOffset, glComponentType componentType)
        {
            switch (componentType)
            {
            case glComponentType.UNSIGNED_BYTE:
            {
                return(GetAttrib <Byte>(count, byteOffset, view).Select(x => (int)(x)));
            }

            case glComponentType.UNSIGNED_SHORT:
            {
                return(GetAttrib <UInt16>(count, byteOffset, view).Select(x => (int)(x)));
            }

            case glComponentType.UNSIGNED_INT:
            {
                return(GetAttrib <UInt32>(count, byteOffset, view).Select(x => (int)(x)));
            }
            }
            throw new NotImplementedException("GetIndices: unknown componenttype: " + componentType);
        }
コード例 #4
0
 public ComponentVec(glComponentType componentType, int elementCount)
 {
     ComponentType = componentType;
     ElementCount  = elementCount;
 }