Tools/vmap_extractor: Move information about model type from spawns in vmap tiles to model file itself

Port From (https://github.com/TrinityCore/TrinityCore/commit/a70e758ba5eef1e8aa966cbabaee020630d2c872)
This commit is contained in:
hondacrx
2024-03-12 22:12:00 -04:00
parent 6b25d4b9b6
commit 5f0608739d
6 changed files with 36 additions and 25 deletions
+10 -7
View File
@@ -9,11 +9,10 @@ using System.Numerics;
namespace Game.Collision
{
public enum ModelFlags
public enum ModelInstanceFlags
{
M2 = 1,
HasBound = 1 << 1,
ParentSpawn = 1 << 2
HasBound = 1 << 0,
ParentSpawn = 1 << 1
}
public class ModelMinimalData
@@ -56,7 +55,7 @@ namespace Game.Collision
spawn.iRot = reader.Read<Vector3>();
spawn.iScale = reader.ReadSingle();
bool has_bound = Convert.ToBoolean(spawn.flags & (uint)ModelFlags.HasBound);
bool has_bound = Convert.ToBoolean(spawn.flags & (uint)ModelInstanceFlags.HasBound);
if (has_bound) // only WMOs have bound in MPQ, only available after computation
{
Vector3 bLow = reader.Read<Vector3>();
@@ -127,10 +126,12 @@ namespace Game.Collision
return;
// M2 files don't contain area info, only WMO files
if (Convert.ToBoolean(flags & (uint)ModelFlags.M2))
if (iModel.IsM2())
return;
if (!iBound.contains(p))
return;
// child bounds are defined in object space:
Vector3 pModel = iInvRot.Multiply(p - iPos) * iInvScale;
Vector3 zDirModel = iInvRot.Multiply(new Vector3(0.0f, 0.0f, -1.0f));
@@ -172,10 +173,12 @@ namespace Game.Collision
return false;
// M2 files don't contain area info, only WMO files
if (Convert.ToBoolean(flags & (uint)ModelFlags.M2))
if (iModel.IsM2())
return false;
if (!iBound.contains(p))
return false;
// child bounds are defined in object space:
Vector3 pModel = iInvRot.Multiply(p - iPos) * iInvScale;
Vector3 zDirModel = iInvRot.Multiply(new Vector3(0.0f, 0.0f, -1.0f));