Quake BSP renderer for PS1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

17 lines
650 B

#ifndef __QMATH_H__
#define __QMATH_H__
MATRIX *RotMatrixQ(SVECTOR *r, MATRIX *m);
#define m_dot12(a, b) ((((int)((a)->vx) * (b)->vx) >> 12) + (((int)((a)->vy) * (b)->vy) >> 12) + (((int)((a)->vz) * (b)->vz) >> 12))
// TODO: worth a benchmark: is it faster to copy these vectors and use them from the stack, or to do six pointer dereferences?
INLINE int m_pointPlaneDist2(const VECTOR* point2, const SVECTOR* normal12, int dist2)
{
int x = ((int)point2->vx * normal12->vx) >> 12;
int y = ((int)point2->vy * normal12->vy) >> 12;
int z = ((int)point2->vz * normal12->vz) >> 12;
return (x + y + z - dist2);
}
#endif // __QMATH_H__