// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 using Unity.Mathematics; namespace GLTFast.Schema { /// [System.Serializable] public class TextureTransform { /// /// The offset of the UV coordinate origin as a factor of the texture dimensions. /// public float[] offset = { 0, 0 }; /// /// Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise. /// public float rotation; /// /// The scale factor applied to the components of the UV coordinates. /// public float[] scale = { 1, 1 }; /// /// Overrides the textureInfo texCoord value if supplied, and if this extension is supported. /// public int texCoord = -1; internal void GltfSerialize(JsonWriter writer) { writer.AddObject(); if (offset != null) { writer.AddArrayProperty("offset", offset); } if (scale != null) { writer.AddArrayProperty("scale", scale); } if (math.abs(rotation) >= float.Epsilon) { writer.AddProperty("rotation", rotation); } if (texCoord >= 0) { writer.AddProperty("texCoord", texCoord); } writer.Close(); } } }