29 #include "../../../idlib/precompiled.h"
110 #define FACE_CHECKED BIT(31)
111 #define GRAVSUBDIV_EPSILON 0.1f
114 int s1, s2,
i,
j, k, side1;
115 int numSplits, numSplitters;
124 int floor, gap, numFloorChecked;
166 normal = (*w1)[(i+1)%w1->
GetNumPoints()].ToVec3() - (*w1)[
i].ToVec3();
198 d = plane.
Distance( (*w2)[j].ToVec3() );
213 d = plane.
Distance( (*w2)[j].ToVec3() );
228 if ( j < w2->GetNumPoints() ) {
241 if ( numFloorChecked == floor ) {
253 if ( !( gap && floor) ) {
264 if ( planeList.
Num() == 0 ) {
269 splitterOrder = (
int *) _alloca( planeList.
Num() *
sizeof(
int ) );
270 bestNumSplits = (
int *) _alloca( planeList.
Num() *
sizeof(
int ) );
274 for ( i = 0; i < planeList.
Num(); i += 2 ) {
284 for ( j = 0; j < numSplitters; j++ ) {
285 if ( numSplits < bestNumSplits[j] ) {
286 for ( k = numSplitters; k >
j; k-- ) {
287 bestNumSplits[k] = bestNumSplits[k-1];
288 splitterOrder[k] = splitterOrder[k-1];
290 bestNumSplits[
j] = numSplits;
291 splitterOrder[
j] =
i;
296 if ( j >= numSplitters ) {
297 bestNumSplits[
j] = numSplits;
298 splitterOrder[
j] =
i;
304 for ( i = 0; i < numSplitters; i++ ) {
305 if ( node->
Split( planeList[splitterOrder[i]], -1 ) ) {
310 if ( i >= numSplitters) {
void GravSubdiv_r(idBrushBSPNode *node)
const idVec3 & Normal(void) const
int GetContents(void) const
void RemoveFlag(int flag)
float Distance(const idVec3 &v) const
bool PortalIsGap(idBrushBSPPortal *portal, int side)
const idPlane & GetPlane(void) const
void GravSubdivLeafNode(idBrushBSPNode *node)
#define AREACONTENTS_SOLID
void SetNormal(const idVec3 &normal)
idVec3 Cross(const idVec3 &a) const
idBrushBSPNode * GetRootNode(void) const
int FindPlane(const idPlane &plane, const float normalEps, const float distEps)
int PlaneSide(const idPlane &plane, const float epsilon=ON_EPSILON) const
int numGravitationalSubdivisions
int GetNumPoints(void) const
idBrushBSPNode * GetNode(int side) const
static float Fabs(float f)
#define GRAVSUBDIV_EPSILON
const idAASSettings * aasSettings
virtual void Printf(const char *fmt,...) id_attribute((format(printf
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble GLdouble w2
void GravitationalSubdivision(idBrushBSP &bsp)
idBrushBSPNode * GetChild(int index) const
idBrushBSPPortal * GetPortals(void) const
idWinding * GetWinding(void) const
idBrushBSPPortal * Next(int side) const
void DisplayRealTimeString(char *string,...)
void SetPortalFlags_r(idBrushBSPNode *node)
void FitThroughPoint(const idVec3 &p)
bool Split(const idPlane &splitPlane, int splitPlaneNum)
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble w1