mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-20 22:51:16 -04:00
use bit-stable lerp form in frame_interpolation (#1326)
This commit is contained in:
@@ -66,19 +66,18 @@ void copy_view_to_snap(CameraSnapshot* dst, const view_class& v) {
|
||||
}
|
||||
|
||||
inline void lerp_matrix(Mtx out, const Mtx lhs, const Mtx rhs, float step) {
|
||||
const float old_weight = 1.0f - step;
|
||||
for (size_t row = 0; row < 3; ++row) {
|
||||
for (size_t col = 0; col < 4; ++col) {
|
||||
out[row][col] = lhs[row][col] * old_weight + rhs[row][col] * step;
|
||||
const float l = lhs[row][col];
|
||||
out[row][col] = l + (rhs[row][col] - l) * step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void lerp_xyz(cXyz* out, const cXyz& lhs, const cXyz& rhs, float step) {
|
||||
const float old_weight = 1.0f - step;
|
||||
out->x = lhs.x * old_weight + rhs.x * step;
|
||||
out->y = lhs.y * old_weight + rhs.y * step;
|
||||
out->z = lhs.z * old_weight + rhs.z * step;
|
||||
out->x = lhs.x + (rhs.x - lhs.x) * step;
|
||||
out->y = lhs.y + (rhs.y - lhs.y) * step;
|
||||
out->z = lhs.z + (rhs.z - lhs.z) * step;
|
||||
}
|
||||
|
||||
static s16 lerp_bank(s16 a, s16 b, f32 t) {
|
||||
|
||||
Reference in New Issue
Block a user