This commit is contained in:
TakaRikka
2025-12-05 21:14:19 -08:00
219 changed files with 8399 additions and 7176 deletions
+7 -11
View File
@@ -268,19 +268,15 @@ struct TVec3<f32> : public Vec {
return inv_norm * sq;
}
void normalize(const TVec3<f32>& other) {
f32 normalize(const TVec3<f32>& other) {
f32 sq = other.squared();
if (sq <= TUtil<f32>::epsilon()) {
zero();
return;
}
f32 norm;
if (sq <= 0.0f) {
norm = sq;
} else {
norm = fsqrt_step(sq);
return 0.0f;
}
f32 norm = TUtil<f32>::inv_sqrt(sq);
scale(norm, other);
return norm * sq;
}
f32 length() const {
@@ -411,12 +407,12 @@ struct TVec2 {
TVec2(T v) { set(v); }
template <typename U>
TVec2(U x, U y) { set(x, y); }
TVec2(const U x, const U y) { set(x, y); }
void set(T v) { y = x = v; }
template <typename U>
void set(U x, U y) {
void set(const U x, const U y) {
this->x = x;
this->y = y;
}
@@ -518,7 +514,7 @@ struct TBox2 : public TBox<TVec2<T> > {
}
}
void set(const TBox2& other) { set(other.i, other.f); }
void set(const TBox<TVec2<T> >& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32>& f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { this->i.set(x0, y0); this->f.set(x1, y1); }
};