Core/vmaps: Removed vmap lookup functions duplicating functionality of each other
Port From (https://github.com/TrinityCore/TrinityCore/commit/45ee989c70682c001d4467d97bf1ecedcf7dbcc3)
This commit is contained in:
@@ -104,33 +104,6 @@ namespace Game.Collision
|
||||
return hit;
|
||||
}
|
||||
|
||||
public override void IntersectPoint(Vector3 point, AreaInfo info, PhaseShift phaseShift)
|
||||
{
|
||||
if (!IsCollisionEnabled() || !owner.IsSpawned() || !IsMapObject())
|
||||
return;
|
||||
|
||||
if (!owner.IsInPhase(phaseShift))
|
||||
return;
|
||||
|
||||
if (!iBound.contains(point))
|
||||
return;
|
||||
|
||||
// child bounds are defined in object space:
|
||||
Vector3 pModel = iInvRot.Multiply(point - iPos) * iInvScale;
|
||||
Vector3 zDirModel = iInvRot.Multiply(new Vector3(0.0f, 0.0f, -1.0f));
|
||||
float zDist;
|
||||
if (iModel.IntersectPoint(pModel, zDirModel, out zDist, info))
|
||||
{
|
||||
Vector3 modelGround = pModel + zDist * zDirModel;
|
||||
float world_Z = (iInvRot.Multiply(modelGround) * iScale + iPos).Z;
|
||||
if (info.ground_Z < world_Z)
|
||||
{
|
||||
info.ground_Z = world_Z;
|
||||
info.adtId = owner.GetNameSetId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetLocationInfo(Vector3 point, LocationInfo info, PhaseShift phaseShift)
|
||||
{
|
||||
if (!IsCollisionEnabled() || !owner.IsSpawned() || !IsMapObject())
|
||||
|
||||
@@ -120,37 +120,6 @@ namespace Game.Collision
|
||||
return hit;
|
||||
}
|
||||
|
||||
public void IntersectPoint(Vector3 p, AreaInfo info)
|
||||
{
|
||||
if (iModel == null)
|
||||
return;
|
||||
|
||||
// M2 files don't contain area info, only WMO files
|
||||
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));
|
||||
float zDist;
|
||||
if (iModel.IntersectPoint(pModel, zDirModel, out zDist, info))
|
||||
{
|
||||
Vector3 modelGround = pModel + zDist * zDirModel;
|
||||
// Transform back to world space. Note that:
|
||||
// Mat * vec == vec * Mat.transpose()
|
||||
// and for rotation matrices: Mat.inverse() == Mat.transpose()
|
||||
float world_Z = (iInvRot.Multiply(modelGround) * iScale + iPos).Z;
|
||||
if (info.ground_Z < world_Z)
|
||||
{
|
||||
info.ground_Z = world_Z;
|
||||
info.adtId = adtId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetLiquidLevel(Vector3 p, LocationInfo info, ref float liqHeight)
|
||||
{
|
||||
// child bounds are defined in object space:
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace Game.Collision
|
||||
if ((ignoreFlags & ModelIgnoreFlags.M2) != ModelIgnoreFlags.Nothing)
|
||||
{
|
||||
// M2 models are not taken into account for LoS calculation if caller requested their ignoring.
|
||||
if (Flags.HasFlag(ModelFlags.None))
|
||||
if (IsM2())
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -315,26 +315,6 @@ namespace Game.Collision
|
||||
return isc.hit;
|
||||
}
|
||||
|
||||
public bool IntersectPoint(Vector3 p, Vector3 down, out float dist, AreaInfo info)
|
||||
{
|
||||
dist = 0f;
|
||||
if (groupModels.Empty())
|
||||
return false;
|
||||
|
||||
WModelAreaCallback callback = new(groupModels, down);
|
||||
groupTree.IntersectPoint(p, callback);
|
||||
if (callback.hit != null)
|
||||
{
|
||||
info.rootId = (int)RootWMOID;
|
||||
info.groupId = (int)callback.hit.GetWmoID();
|
||||
info.flags = callback.hit.GetMogpFlags();
|
||||
info.result = true;
|
||||
dist = callback.zDist;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GetLocationInfo(Vector3 p, Vector3 down, out float dist, GroupLocationInfo info)
|
||||
{
|
||||
dist = 0f;
|
||||
|
||||
Reference in New Issue
Block a user