#include "shared/shared.h"
#include "common/math.h"
Go to the source code of this file.
|
const vec3_t | bytedirs [NUMVERTEXNORMALS] |
|
Value: p->normal[0] * bounds[i][0] + \
p->normal[1] * bounds[j][1] + \
p->normal[2] * bounds[k][2]
◆ BoxOnPlaneSide()
int BoxOnPlaneSide |
( |
vec3_t |
emins, |
|
|
vec3_t |
emaxs, |
|
|
cplane_t * |
p |
|
) |
| |
Definition at line 322 of file math.c.
324 vec_t *bounds[2] = { emins, emaxs };
325 int i = p->signbits & 1;
326 int j = (p->signbits >> 1) & 1;
327 int k = (p->signbits >> 2) & 1;
330 p->normal[0] * bounds[i][0] + \
331 p->normal[1] * bounds[j][1] + \
332 p->normal[2] * bounds[k][2]
334 vec_t dist1 =
P(i ^ 1, j ^ 1, k ^ 1);
335 vec_t dist2 =
P(i, j, k);
340 if (dist1 >= p->dist)
Referenced by GL_ClipNode(), and GL_CullBox().
◆ DirToByte()
int DirToByte |
( |
const vec3_t |
dir | ) |
|
◆ RotatePointAroundVector()
void RotatePointAroundVector |
( |
vec3_t |
dst, |
|
|
const vec3_t |
dir, |
|
|
const vec3_t |
point, |
|
|
float |
degrees |
|
) |
| |
Definition at line 348 of file math.c.
354 dst[0] = DotProduct(matrix[0], point);
355 dst[1] = DotProduct(matrix[1], point);
356 dst[2] = DotProduct(matrix[2], point);
Referenced by R_DrawBeam().
◆ SetPlaneSignbits()
void SetPlaneSignbits |
( |
cplane_t * |
plane | ) |
|
Definition at line 298 of file math.c.
302 if (plane->normal[0] < 0) {
305 if (plane->normal[1] < 0) {
308 if (plane->normal[2] < 0) {
312 plane->signbits = bits;
Referenced by GL_SetupFrustum(), and LOAD().
◆ SetPlaneType()
void SetPlaneType |
( |
cplane_t * |
plane | ) |
|
Definition at line 278 of file math.c.
280 vec_t *normal = plane->normal;
282 if (normal[0] == 1) {
283 plane->type = PLANE_X;
286 if (normal[1] == 1) {
287 plane->type = PLANE_Y;
290 if (normal[2] == 1) {
291 plane->type = PLANE_Z;
295 plane->type = PLANE_NON_AXIAL;
Referenced by LOAD().
◆ SetupRotationMatrix()
void SetupRotationMatrix |
( |
vec3_t |
matrix[3], |
|
|
const vec3_t |
dir, |
|
|
float |
degrees |
|
) |
| |
Definition at line 367 of file math.c.
369 vec_t angle, s,
c, one_c, xx, yy, zz, xy, yz, zx, xs, ys, zs;
371 angle = DEG2RAD(degrees);
376 xx = dir[0] * dir[0];
377 yy = dir[1] * dir[1];
378 zz = dir[2] * dir[2];
379 xy = dir[0] * dir[1];
380 yz = dir[1] * dir[2];
381 zx = dir[2] * dir[0];
386 matrix[0][0] = (one_c * xx) +
c;
387 matrix[0][1] = (one_c * xy) - zs;
388 matrix[0][2] = (one_c * zx) + ys;
390 matrix[1][0] = (one_c * xy) + zs;
391 matrix[1][1] = (one_c * yy) +
c;
392 matrix[1][2] = (one_c * yz) - xs;
394 matrix[2][0] = (one_c * zx) - ys;
395 matrix[2][1] = (one_c * yz) + xs;
396 matrix[2][2] = (one_c * zz) +
c;
Referenced by prepare_sky_matrix(), R_AddSkySurface(), and RotatePointAroundVector().
◆ bytedirs
const vec3_t bytedirs[NUMVERTEXNORMALS] |