Core/Vmaps: Optimize loading vmaps
Port From (https://github.com/TrinityCore/TrinityCore/commit/35a2d49971984bcab96ac64fc52b30a9a4e06ce3)
This commit is contained in:
@@ -78,7 +78,6 @@ namespace Game.Collision
|
||||
return !iModel.IsM2();
|
||||
}
|
||||
|
||||
|
||||
public override bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags)
|
||||
{
|
||||
if (!IsCollisionEnabled() || !owner.IsSpawned())
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace Game.Collision
|
||||
Matrix4x4 iInvRot;
|
||||
float iInvScale;
|
||||
WorldModel iModel;
|
||||
uint referencingTiles;
|
||||
|
||||
public ModelInstance()
|
||||
{
|
||||
@@ -174,5 +175,10 @@ namespace Game.Collision
|
||||
}
|
||||
|
||||
public void SetUnloaded() { iModel = null; }
|
||||
|
||||
public WorldModel GetWorldModel() { return iModel; }
|
||||
|
||||
public void AddTileReference() { ++referencingTiles; }
|
||||
public uint RemoveTileReference() { return --referencingTiles; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,6 +331,7 @@ namespace Game.Collision
|
||||
uint RootWMOID;
|
||||
List<GroupModel> groupModels = new();
|
||||
BIH groupTree = new();
|
||||
string name; // valid only while model is held in VMapManager2::iLoadedModelFiles
|
||||
|
||||
public override bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags)
|
||||
{
|
||||
@@ -422,6 +423,9 @@ namespace Game.Collision
|
||||
return groupTree.ReadFromFile(reader);
|
||||
}
|
||||
|
||||
public string GetName() { return name; }
|
||||
public void SetName(string newName) { name = newName; }
|
||||
|
||||
public bool IsM2() { return Flags.HasFlag(ModelFlags.IsM2); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user