示例#1
0
        IEnumerable <int> _GetIndices(glTFAccessor accessor, out int count)
        {
            count = accessor.count;
            var view = bufferViews[accessor.bufferView];

            switch ((glComponentType)accessor.componentType)
            {
            case glComponentType.UNSIGNED_BYTE:
            {
                return(GetAttrib <Byte>(accessor, view).Select(x => (int)(x)));
            }

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

            case glComponentType.UNSIGNED_INT:
            {
                return(GetAttrib <UInt32>(accessor, view).Select(x => (int)(x)));
            }
            }
            throw new NotImplementedException("GetIndices: unknown componenttype: " + accessor.componentType);
        }
示例#2
0
 T[] GetAttrib <T>(glTFAccessor accessor, glTFBufferView view) where T : struct
 {
     return(GetAttrib <T>(accessor.count, accessor.byteOffset, view));
 }