From 12dd40ea8e05d58ca9ddd862c620a6cdd2c77d8d Mon Sep 17 00:00:00 2001 From: dexy Date: Sun, 2 May 2021 23:30:45 +1000 Subject: [PATCH] Light hash calculation using correct bounding boxes --- CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs index 716fd4f..c6fd44c 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs @@ -1682,6 +1682,7 @@ namespace CodeWalker.GameFiles public LightInstance[] Lights { get; set; } + //public uint[] LightHashTest { get; set; } public string Name @@ -2096,12 +2097,12 @@ namespace CodeWalker.GameFiles } if (lightAttrs == null) return; - var abmin = Vector3.Min(Archetype.BBMin, db.BoundingBoxMin); - var abmax = Vector3.Max(Archetype.BBMax, db.BoundingBoxMax); + var abmin = db.BoundingBoxMin; + var abmax = db.BoundingBoxMax; if (b != null) { - abmin = Vector3.Min(abmin, b.BoxMin); - abmax = Vector3.Max(abmax, b.BoxMax); + abmin = b.BoxMin; + abmax = b.BoxMax; } var bb = new BoundingBox(abmin, abmax).Transform(Position, Orientation, Scale); var ints = new uint[7]; @@ -2126,6 +2127,13 @@ namespace CodeWalker.GameFiles } Lights = lightInsts; + //LightHashTest = new uint[25]; + //for (int i = 0; i < 25; i++) + //{ + // ints[6] = (uint)(i); + // LightHashTest[i] = ComputeLightHash(ints); + //} + }