diff --git a/LibBSP/Source/Structs/BSP/Texture.cs b/LibBSP/Source/Structs/BSP/Texture.cs index 1d74174..82b4a6b 100644 --- a/LibBSP/Source/Structs/BSP/Texture.cs +++ b/LibBSP/Source/Structs/BSP/Texture.cs @@ -56,7 +56,7 @@ namespace LibBSP { case MapType.Quake2: case MapType.SoF: case MapType.Daikatana: { - texAxes = new TextureInfo(new Vector3(BitConverter.ToSingle(data, 0), BitConverter.ToSingle(data, 4), BitConverter.ToSingle(data, 8)), BitConverter.ToSingle(data, 12), new Vector3(BitConverter.ToSingle(data, 16), BitConverter.ToSingle(data, 20), BitConverter.ToSingle(data, 24)), BitConverter.ToSingle(data, 28), -1, -1); + texAxes = new TextureInfo(new Vector3(BitConverter.ToSingle(data, 0), BitConverter.ToSingle(data, 4), BitConverter.ToSingle(data, 8)), BitConverter.ToSingle(data, 12), 1, new Vector3(BitConverter.ToSingle(data, 16), BitConverter.ToSingle(data, 20), BitConverter.ToSingle(data, 24)), BitConverter.ToSingle(data, 28), 1, -1, -1); flags = BitConverter.ToInt32(data, 32); name = data.ToNullTerminatedString(40, 32); break; @@ -94,7 +94,7 @@ namespace LibBSP { break; } case MapType.SiN: { - texAxes = new TextureInfo(new Vector3(BitConverter.ToSingle(data, 0), BitConverter.ToSingle(data, 4), BitConverter.ToSingle(data, 8)), BitConverter.ToSingle(data, 12), new Vector3(BitConverter.ToSingle(data, 16), BitConverter.ToSingle(data, 20), BitConverter.ToSingle(data, 24)), BitConverter.ToSingle(data, 28), -1, -1); + texAxes = new TextureInfo(new Vector3(BitConverter.ToSingle(data, 0), BitConverter.ToSingle(data, 4), BitConverter.ToSingle(data, 8)), BitConverter.ToSingle(data, 12), 1, new Vector3(BitConverter.ToSingle(data, 16), BitConverter.ToSingle(data, 20), BitConverter.ToSingle(data, 24)), BitConverter.ToSingle(data, 28), 1, -1, -1); flags = BitConverter.ToInt32(data, 32); name = data.ToNullTerminatedString(36, 64); break; diff --git a/LibBSP/Source/Structs/BSP/TextureInfo.cs b/LibBSP/Source/Structs/BSP/TextureInfo.cs index e014a01..65877b5 100644 --- a/LibBSP/Source/Structs/BSP/TextureInfo.cs +++ b/LibBSP/Source/Structs/BSP/TextureInfo.cs @@ -36,6 +36,7 @@ namespace LibBSP { public Vector3[] axes { get; private set; } public float[] shifts { get; private set; } + public float[] scales { get; private set; } public int flags { get; private set; } public int texture { get; private set; } @@ -59,6 +60,8 @@ namespace LibBSP { shifts[S] = BitConverter.ToSingle(data, 12); axes[T] = new Vector3(BitConverter.ToSingle(data, 16), BitConverter.ToSingle(data, 20), BitConverter.ToSingle(data, 24)); shifts[T] = BitConverter.ToSingle(data, 28); + // Texture scaling information is compiled into the axes by changing their length. + scales = new float[] { 1, 1 }; switch (type) { // Excluded engines: Quake 2-based, Quake 3-based case MapType.Source17: @@ -99,25 +102,29 @@ namespace LibBSP { /// Creates a new object using the passed data. /// /// The S texture axis. - /// The texture shift on the S axis. + /// The texture shift on the S axis. + /// The texture scale on the S axis. /// The T texture axis. - /// The texture shift on the T axis. + /// The texture shift on the T axis. + /// The texture scale on the T axis. /// The flags for this . /// Index into the texture list for the texture this uses. - public TextureInfo(Vector3 s, float SShift, Vector3 t, float TShift, int flags, int texture) { + public TextureInfo(Vector3 s, float sShift, float sScale, Vector3 t, float tShift, float tScale, int flags, int texture) { axes = new Vector3[2]; axes[S] = s; axes[T] = t; shifts = new float[2]; - shifts[S] = SShift; - shifts[T] = TShift; + shifts[S] = sShift; + shifts[T] = tShift; + scales[S] = sScale; + scales[T] = tScale; this.flags = flags; this.texture = texture; } /// - /// Adapted from code in the Quake III Arena source code. Stolen without - /// permission because it falls under the terms of the GPL v2 license, because I'm not making + /// Adapted from code in the Quake III Arena source code. Stolen without permission + /// because it falls under the terms of the GPL v2 license, and because I'm not making /// any money, just awesome tools. /// /// of the surface.