mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-12 21:45:19 -04:00
Merge branch 'main' of https://github.com/zeldaret/tp
This commit is contained in:
@@ -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); }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user