// SPDX-FileCopyrightText: 2025 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 using System; using System.Runtime.CompilerServices; using Unity.Mathematics; using static Unity.Mathematics.math; namespace GLTFast { /// A 4 component vector of signed 16-bit integers. struct short4 { /// x component of the vector. public short x; /// y component of the vector. public short y; /// z component of the vector. public short z; /// w component of the vector. public short w; /// /// Converts glTF rotation signed short quaternion values in to a /// quaternion rotation in Unity space. /// /// Rotation in Unity space. [MethodImpl(MethodImplOptions.AggressiveInlining)] public quaternion GltfToUnityRotation() { return new quaternion( max(x / (float)short.MaxValue, -1f), -max(y / (float)short.MaxValue, -1f), -max(z / (float)short.MaxValue, -1f), max(w / (float)short.MaxValue, -1f) ); } } }