Initial Prey Game integration support.

This commit is contained in:
Justin Marshall
2026-05-05 15:01:01 -07:00
parent a6c6f1ed26
commit 8d5f678b25
552 changed files with 265551 additions and 209 deletions
+36
View File
@@ -213,6 +213,42 @@ idMat3 idVec3::ToMat3( void ) const {
return mat;
}
#ifdef PREY
// HUMANHEAD nla
/*
=============
idVec3::hhToMat3
=============
*/
idMat3 idVec3::hhToMat3(void) const {
idVec3 left;
idVec3 down;
// NormalVectors actually returns left and down
NormalVectors(left, down);
return idMat3(*this, left, -down);
}
// HUMANHEAD PDM: Vector conversion to/from axis aligned direction masks (6-bit vector compression)
int idVec3::DirectionMask() const {
int mask = 0;
for (int term = 0; term < 3; term++) {
mask += (*this)[term] < 0 ? 1 << (term << 1) : (*this)[term]>0 ? 1 << ((term << 1) + 1) : 0;
}
return mask;
}
idVec3::idVec3(int directionMask) {
int negativeMask, positiveMask;
for (int term = 0; term < 3; term++) {
negativeMask = 1 << (term << 1);
positiveMask = 1 << ((term << 1) + 1);
(*this)[term] = (directionMask & negativeMask) ? -1 : (directionMask & positiveMask) ? 1 : 0;
}
}
// HUMANHEAD END
#endif
/*
=============
idVec3::ToString
+30
View File
@@ -313,6 +313,18 @@ ID_INLINE float *idVec2::ToFloatPtr( void ) {
//
//===============================================================
#ifdef PREY
// HUMANHEAD pdm: support for 6 bit vector compression, direction masks
#define INDEX_IN_MASK(mask, index) ( ((mask) & (1<<(index)) ) != 0 )
#define MASK_NEGX 0x0001
#define MASK_POSX 0x0002
#define MASK_NEGY 0x0004
#define MASK_POSY 0x0008
#define MASK_NEGZ 0x0010
#define MASK_POSZ 0x0020
// HUMANHEAD END
#endif
class idVec3 {
public:
float x;
@@ -384,11 +396,29 @@ public:
void Lerp( const idVec3 &v1, const idVec3 &v2, const float l );
void SLerp( const idVec3 &v1, const idVec3 &v2, const float l );
idVec3 ToNormal() const;
#ifdef PREY
// HUMANHEAD nla - Returns a Mat3 with Z up instead of down
idMat3 hhToMat3(void) const; // vector should be normalized
int DirectionMask() const; // calculate direction bitmask
idVec3(int directionMask); // construct from direction bitmask
// HUMANHEAD END
#endif
};
extern idVec3 vec3_origin;
#define vec3_zero vec3_origin
ID_INLINE idVec3 idVec3::ToNormal() const {
float sqrLength, invLength;
sqrLength = x * x + y * y + z * z;
invLength = idMath::InvSqrt(sqrLength);
return *this * invLength;
}
ID_INLINE idVec3::idVec3( void ) {
}