C3Spline/Bezier3/CatmullRom (10-slot vtable, NaN-safe t clamps, ISetPoints counts per the binary), CMath fnotequal family returning true for NaN, CMemBlock, NTempest, C33/C44Matrix, C3Vector, CAaBox, and CRange::Random (0x4C5D40) / CRandom::ufloat_(float, CRndSeed&) (0x982310, __stdcall per its retn 8) for SoundInterface. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
172 lines
3.9 KiB
C++
172 lines
3.9 KiB
C++
#include <cstdint>
|
|
#include "Engine/Source/Tempest/C44Matrix.h"
|
|
#include "Engine/Source/Tempest/CAaBox.h"
|
|
|
|
// VERIFY: 1bea3dca manual
|
|
// OFFSET: 0x0070BCF0
|
|
bool CAaBox::IsValid() const {
|
|
return this->t.x > this->b.x && this->t.y > this->b.y && this->t.z > this->b.z;
|
|
}
|
|
|
|
// VERIFY: 040a12ae manual
|
|
// OFFSET: 0x0070BD20
|
|
bool CAaBox::IsEmpty() const {
|
|
return this->t.x <= this->b.x || this->t.y <= this->b.y || this->t.z <= this->b.z;
|
|
}
|
|
|
|
// VERIFY: 0f1d380e manual
|
|
// OFFSET: 0x007150D0
|
|
CAaBox operator|(const CAaBox& l, const CAaBox& r) {
|
|
C3Vector t = C3Vector::Max(l.t, r.t);
|
|
C3Vector b = C3Vector::Min(l.b, r.b);
|
|
|
|
CAaBox result;
|
|
result.b = b;
|
|
result.t = t;
|
|
return result;
|
|
}
|
|
|
|
// VERIFY: 724307ab manual
|
|
// OFFSET: 0x00715130
|
|
CAaBox CAaBox::operator|=(const CAaBox& box) {
|
|
*this = *this | box;
|
|
return *this;
|
|
}
|
|
|
|
// VERIFY: 417ec50b manual
|
|
// OFFSET: 0x0075B5B0
|
|
bool CAaBox::ContainsPoint(const C3Vector& point) const {
|
|
return this->b.x <= point.x && this->b.y <= point.y && this->b.z <= point.z && this->t.x >= point.x && this->t.y >= point.y && this->t.z >= point.z;
|
|
}
|
|
|
|
// VERIFY: 195b7d66 manual
|
|
// OFFSET: 0x0078F370
|
|
bool CAaBox::Intersects(const CAaBox& box) const {
|
|
return this->t.x >= box.b.x && this->t.y >= box.b.y && this->t.z >= box.b.z && this->b.x <= box.t.x && this->b.y <= box.t.y && this->b.z <= box.t.z;
|
|
}
|
|
|
|
// VERIFY: 77b1dfb8 auto
|
|
// OFFSET: 0x0078F480
|
|
CAaBox::CAaBox(const C3Vector& b, const C3Vector& t) {
|
|
this->b = b;
|
|
this->t = t;
|
|
}
|
|
|
|
// VERIFY: 4ac67881 manual
|
|
// OFFSET: 0x007AE2B0
|
|
bool CAaBox::IntersectsXY(const CAaBox& box) const {
|
|
return this->t.x >= box.b.x && this->t.y >= box.b.y && this->b.x <= box.t.x && this->b.y <= box.t.y;
|
|
}
|
|
|
|
// VERIFY: 2895a20e manual
|
|
// OFFSET: 0x00984860
|
|
CAaBox CAaBox::Transform(const CAaBox& box, const C44Matrix& m) {
|
|
CAaBox result;
|
|
result.b.x = m.d0;
|
|
result.b.y = m.d1;
|
|
result.b.z = m.d2;
|
|
result.t.x = m.d0;
|
|
result.t.y = m.d1;
|
|
result.t.z = m.d2;
|
|
|
|
const float* rows = &m.a0;
|
|
|
|
for (uint32_t i = 0; i < 3; i++) {
|
|
float* lo = &result.b.x + i;
|
|
float* hi = &result.t.x + i;
|
|
|
|
float e = box.b.x * rows[0 + i];
|
|
float f = rows[0 + i] * box.t.x;
|
|
|
|
if (f <= e) {
|
|
*lo = f + *lo;
|
|
} else {
|
|
*lo = e + *lo;
|
|
e = f;
|
|
}
|
|
|
|
*hi = e + *hi;
|
|
|
|
e = box.b.y * rows[4 + i];
|
|
f = box.t.y * rows[4 + i];
|
|
|
|
if (f <= e) {
|
|
*lo = f + *lo;
|
|
} else {
|
|
*lo = e + *lo;
|
|
e = f;
|
|
}
|
|
|
|
*hi = e + *hi;
|
|
|
|
e = rows[8 + i] * box.b.z;
|
|
f = rows[8 + i] * box.t.z;
|
|
|
|
if (f <= e) {
|
|
*lo = f + *lo;
|
|
} else {
|
|
*lo = e + *lo;
|
|
e = f;
|
|
}
|
|
|
|
*hi = e + *hi;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// VERIFY: d22b3ba3 manual
|
|
// OFFSET: 0x00984930
|
|
CAaBox CAaBox::Bounding(const C3Vector* points, uint32_t count) {
|
|
CAaBox result;
|
|
|
|
if (!count) {
|
|
return result;
|
|
}
|
|
|
|
result.b = points[0];
|
|
result.t = points[0];
|
|
|
|
for (uint32_t i = 1; i < count; i++) {
|
|
const C3Vector& point = points[i];
|
|
|
|
if (result.b.x > point.x) {
|
|
result.b.x = point.x;
|
|
}
|
|
|
|
if (result.b.y > point.y) {
|
|
result.b.y = point.y;
|
|
}
|
|
|
|
if (result.b.z > point.z) {
|
|
result.b.z = point.z;
|
|
}
|
|
|
|
if (result.t.x < point.x) {
|
|
result.t.x = point.x;
|
|
}
|
|
|
|
if (result.t.y < point.y) {
|
|
result.t.y = point.y;
|
|
}
|
|
|
|
if (result.t.z < point.z) {
|
|
result.t.z = point.z;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// VERIFY: 0a872e55 auto
|
|
// OFFSET: 0x005FECB0
|
|
CAaBox& CAaBox::operator*=(float scale) {
|
|
this->b.x = this->b.x * scale;
|
|
this->b.y = this->b.y * scale;
|
|
this->b.z = this->b.z * scale;
|
|
this->t.x = this->t.x * scale;
|
|
this->t.y = this->t.y * scale;
|
|
this->t.z = scale * this->t.z;
|
|
return *this;
|
|
}
|