Change vec2 to vec3 in neighborhood decoration deserialization.

Whoops, this was causing an error with deserialization. Also
finished up the TODO and added a neighborhood that actually
use this type of decoration.
This commit is contained in:
Ammar Askar 2023-07-26 18:29:51 -04:00
parent 9116713f60
commit b1702db774
3 changed files with 15 additions and 15 deletions

View file

@ -138,7 +138,7 @@ namespace OpenTS2.Files.Formats.DBPF
var road = ReadRoad(reader);
var objectVersion = reader.ReadByte();
var positionOffset = Vector2Serializer.Deserialize(reader);
var positionOffset = Vector3Serializer.Deserialize(reader);
var modelOrientation = QuaterionSerialzier.Deserialize(reader);
// unknown
var unknown = Vector3Serializer.Deserialize(reader);

View file

@ -19,29 +19,29 @@ public class NeighborhoodDecorationsCodecTest
var decorationsAsset = ContentProvider.Get()
.GetAssetsOfType<NeighborhoodDecorationsAsset>(TypeIDs.NHOOD_DECORATIONS).Single();
Assert.That(decorationsAsset.FloraDecorations.Length, Is.EqualTo(44));
Assert.That(decorationsAsset.FloraDecorations.Length, Is.EqualTo(1208));
var firstTree = decorationsAsset.FloraDecorations[0];
Assert.That(firstTree.ObjectId, Is.EqualTo(0x18));
Assert.That(firstTree.ObjectId, Is.EqualTo(0x53));
Assert.That(firstTree.Position.Position.x, Is.EqualTo(395.625).Within(0.05));
Assert.That(firstTree.Position.Position.z, Is.EqualTo(535.725).Within(0.05));
Assert.That(firstTree.Position.Position.y, Is.EqualTo(357.551).Within(0.05));
Assert.That(firstTree.Position.Position.x, Is.EqualTo(1025.75).Within(0.05));
Assert.That(firstTree.Position.Position.z, Is.EqualTo(1106.39).Within(0.05));
Assert.That(firstTree.Position.Position.y, Is.EqualTo(313.78).Within(0.05));
Assert.That(firstTree.Rotation, Is.EqualTo(0));
Assert.That(firstTree.Position.BoundingBoxMin.x, Is.EqualTo(392.56).Within(0.05));
Assert.That(firstTree.Position.BoundingBoxMin.y, Is.EqualTo(535.052).Within(0.05));
Assert.That(firstTree.Position.BoundingBoxMin.x, Is.EqualTo(1023.35).Within(0.05));
Assert.That(firstTree.Position.BoundingBoxMin.y, Is.EqualTo(1103.99).Within(0.05));
Assert.That(firstTree.Position.BoundingBoxMax.x, Is.EqualTo(399.706).Within(0.05));
Assert.That(firstTree.Position.BoundingBoxMax.y, Is.EqualTo(538.4807).Within(0.05));
Assert.That(firstTree.Position.BoundingBoxMax.x, Is.EqualTo(1028.15).Within(0.05));
Assert.That(firstTree.Position.BoundingBoxMax.y, Is.EqualTo(1108.78).Within(0.05));
Assert.That(decorationsAsset.RoadDecorations.Length, Is.EqualTo(306));
// TODO: add a test case for these.
Assert.That(decorationsAsset.RoadWithModelDecorations.Length, Is.EqualTo(0));
Assert.That(decorationsAsset.RoadDecorations.Length, Is.EqualTo(367));
Assert.That(decorationsAsset.PropDecorations.Length, Is.EqualTo(47));
Assert.That(decorationsAsset.RoadWithModelDecorations.Length, Is.EqualTo(10));
Assert.That(decorationsAsset.PropDecorations.Length, Is.EqualTo(102));
}
}