Files
2026-02-10 11:12:12 +07:00

69 lines
2.7 KiB
C#

using CSNetwork.GPDataType;
namespace BrewMonster.Scripts
{
//////////////////////////////////////////////////////////////////////////
// define a new compact Convex Hull data type which is used in ElementClient!
//////////////////////////////////////////////////////////////////////////
public class BrushTraceInfo
{
//////////////////////////////////////////////////////////////////////////
// In
//////////////////////////////////////////////////////////////////////////
// aabb's info
public A3DVECTOR3 vStart; // Start point
public A3DVECTOR3 vDelta; // Move delta
public A3DVECTOR3 vExtents;
public A3DAABB BoundAABB;
// Dist Epsilon
public float fDistEpsilon; // Dist Epsilon
public bool bIsPoint; //raytrace
//////////////////////////////////////////////////////////////////////////
// Out
//////////////////////////////////////////////////////////////////////////
public bool bStartSolid; // Collide something at start point
public bool bAllSolid; // All in something
public CHalfSpace ClipPlane; // Clip plane
public int iClipPlane; // Clip plane's index
public float fFraction; // Fraction
public uint dwUser1; // User defined data 1
public uint dwUser2; // User defined data 2
// For test
public A3DVECTOR3 normal;
public void Init(A3DVECTOR3 start, A3DVECTOR3 delta, A3DVECTOR3 ext, bool bRay = false, float epsilon = 0.03125f)
{
BoundAABB = new A3DAABB();
vStart = start;
vDelta = delta;
vExtents = ext;
fDistEpsilon = epsilon;
fFraction = 100.0f;
bIsPoint = bRay;
bStartSolid = false;
bAllSolid = false;
dwUser1 = 0;
dwUser2 = 0;
if (!bIsPoint)
{
BoundAABB.Clear();
BoundAABB.AddVertex(vStart);
BoundAABB.AddVertex(vStart + vExtents);
BoundAABB.AddVertex(vStart - vExtents);
BoundAABB.AddVertex(vStart + vDelta);
BoundAABB.AddVertex(vStart + vDelta + vExtents);
BoundAABB.AddVertex(vStart + vDelta - vExtents);
BoundAABB.CompleteCenterExts();
}
else
{
//@note : it cheats the caller. By Kuiwu[25/8/2005]
//@todo : refine me. By Kuiwu[25/8/2005]
fDistEpsilon = 1E-5f;
}
}
};
}