Fixed an error and added an additional function.

This commit is contained in:
Walter Julius Hennecke 2013-12-09 22:05:33 +01:00
parent 07bb309d8d
commit 986596e0d4
2 changed files with 13 additions and 2 deletions

View file

@ -4,7 +4,7 @@
#define QUADRANT_LEFT 0
#define QUADRANT_RIGHT 1
#define QUADRANT_MIDDLE 2
qboolean BG_LineBoxIntersection(vec3_t mins, vec2_t maxs, vec3_t origin, vec3_t dir, vec_t* hit) {
qboolean BG_LineBoxIntersection(vec3_t mins, vec3_t maxs, vec3_t origin, vec3_t dir, vec_t* hit) {
qboolean inside;
char quadrant[3];
int i;
@ -64,3 +64,13 @@ qboolean BG_LineBoxIntersection(vec3_t mins, vec2_t maxs, vec3_t origin, vec3_t
return qtrue;
}
qboolean BG_IsInBox(vec3_t pos, vec3_t mins, vec3_t maxs) {
if( pos[0] <= maxs[0] && pos[0] >= mins[0] &&
pos[1] <= maxs[1] && pos[1] >= mins[1] &&
pos[2] <= maxs[2] && pos[2] >= mins[2]) {
return qtrue;
}
return qfalse;
}

View file

@ -3,6 +3,7 @@
#include "q_shared.h"
qboolean BG_LineBoxIntersection(vec3_t mins, vec2_t maxs, vec3_t origin, vec3_t dir, vec_t* hit);
qboolean BG_LineBoxIntersection(vec3_t mins, vec3_t maxs, vec3_t origin, vec3_t dir, vec_t* hit);
qboolean BG_IsInBox(vec3_t pos, vec3_t mins, vec3_t maxs);
#endif