BFA Update (still lots of testing to do tho)

This commit is contained in:
hondacrx
2018-12-10 12:46:25 -05:00
parent 468b053946
commit 8e20114e10
256 changed files with 35613 additions and 10459 deletions
@@ -88,7 +88,7 @@ namespace Game.Collision
return mdl;
}
public override bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift)
public override bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags)
{
if (!isCollisionEnabled() || !owner.IsSpawned())
return false;
@@ -104,7 +104,7 @@ namespace Game.Collision
Vector3 p = iInvRot * (ray.Origin - iPos) * iInvScale;
Ray modRay = new Ray(p, iInvRot * ray.Direction);
float distance = maxDist * iInvScale;
bool hit = iModel.IntersectRay(modRay, ref distance, stopAtFirstHit);
bool hit = iModel.IntersectRay(modRay, ref distance, stopAtFirstHit, ignoreFlags);
if (hit)
{
distance *= iScale;
+3 -1
View File
@@ -17,6 +17,7 @@
using Framework.GameMath;
using System.Collections.Generic;
using Framework.Constants;
namespace Game.Collision
{
@@ -25,7 +26,8 @@ namespace Game.Collision
public virtual Vector3 getPosition() { return default(Vector3); }
public virtual AxisAlignedBox getBounds() { return default(AxisAlignedBox); }
public virtual bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift) { return false; }
public virtual bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags) { return false; }
public virtual bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) { return false; }
public virtual bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit) { return false; }
public virtual void IntersectPoint(Vector3 point, AreaInfo info, PhaseShift phaseShift) { }
}
@@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.GameMath;
using System;
using System.IO;
@@ -93,7 +94,7 @@ namespace Game.Collision
iInvScale = 1.0f / iScale;
}
public bool intersectRay(Ray pRay, ref float pMaxDist, bool pStopAtFirstHit)
public bool intersectRay(Ray pRay, ref float pMaxDist, bool pStopAtFirstHit, ModelIgnoreFlags ignoreFlags)
{
if (iModel == null)
return false;
@@ -106,7 +107,7 @@ namespace Game.Collision
Vector3 p = iInvRot * (pRay.Origin - iPos) * iInvScale;
Ray modRay = new Ray(p, iInvRot * pRay.Direction);
float distance = pMaxDist * iInvScale;
bool hit = iModel.IntersectRay(modRay, ref distance, pStopAtFirstHit);
bool hit = iModel.IntersectRay(modRay, ref distance, pStopAtFirstHit, ignoreFlags);
if (hit)
{
distance *= iScale;
+10 -1
View File
@@ -312,8 +312,16 @@ namespace Game.Collision
RootWMOID = 0;
}
public override bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit)
public override bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags)
{
// If the caller asked us to ignore certain objects we should check flags
if ((ignoreFlags & ModelIgnoreFlags.M2) != ModelIgnoreFlags.Nothing)
{
// M2 models are not taken into account for LoS calculation if caller requested their ignoring.
if ((Flags & (uint)ModelFlags.M2) != 0)
return false;
}
// small M2 workaround, maybe better make separate class with virtual intersection funcs
// in any case, there's no need to use a bound tree if we only have one submodel
if (groupModels.Count == 1)
@@ -404,5 +412,6 @@ namespace Game.Collision
List<GroupModel> groupModels = new List<GroupModel>();
BIH groupTree = new BIH();
uint RootWMOID;
public uint Flags;
}
}