Ejemplo n.º 1
0
        public static Type GetValueType(this GltfAccessor accessor)
        {
            if (accessor.type == GltfAccessorType.SCALAR)
            {
                switch (accessor.componentType)
                {
                case GltfComponentType.BYTE: return(typeof(sbyte));

                case GltfComponentType.UNSIGNED_BYTE: return(typeof(byte));

                case GltfComponentType.SHORT: return(typeof(short));

                case GltfComponentType.UNSIGNED_SHORT: return(typeof(ushort));

                case GltfComponentType.UNSIGNED_INT: return(typeof(uint));

                case GltfComponentType.FLOAT: return(typeof(float));
                }
            }
            else if (accessor.type == GltfAccessorType.VEC2)
            {
                switch (accessor.componentType)
                {
                case GltfComponentType.FLOAT: return(typeof(Vector2));
                }
            }
            else if (accessor.type == GltfAccessorType.VEC3)
            {
                switch (accessor.componentType)
                {
                case GltfComponentType.FLOAT: return(typeof(Vector3));
                }
            }
            else if (accessor.type == GltfAccessorType.VEC4)
            {
                switch (accessor.componentType)
                {
                case GltfComponentType.UNSIGNED_SHORT: return(typeof(SkinJoints));

                case GltfComponentType.FLOAT: return(typeof(Vector4));
                }
            }
            else if (accessor.type == GltfAccessorType.MAT4)
            {
                switch (accessor.componentType)
                {
                case GltfComponentType.FLOAT: return(typeof(Matrix4x4));
                }
            }

            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
 public static int GetStride(this GltfAccessor accessor)
 {
     return(accessor.type.TypeCount() * accessor.componentType.ByteSize());
 }