From d49730b8275e45b24b249a21eeb2237cd3feeb96 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Sat, 9 May 2026 18:56:44 +0500 Subject: [PATCH] Fix face animations Caused by `--fpmode fast` optimization --- vendor/librw/src/base.cpp | 7 +++++-- vendor/librw/src/rwbase.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vendor/librw/src/base.cpp b/vendor/librw/src/base.cpp index e3b78a0..02457c4 100644 --- a/vendor/librw/src/base.cpp +++ b/vendor/librw/src/base.cpp @@ -137,6 +137,9 @@ slerp(const Quat &q, const Quat &p, float32 a) c = -c; q1 = negate(q1); } + if(c > 1.0f) { + c = 1.0f; + } float32 phi = acosf(c); if(phi > 0.00001f){ float32 s = sinf(phi); @@ -547,7 +550,7 @@ Matrix::invertGeneral(Matrix *dst, const Matrix *src) // get the determinant from that det = src->up.x * dst->right.y + src->at.x * dst->right.z + dst->right.x * src->right.x; invdet = 1.0; - if(det != 0.0f) + if(fabsf(det) > 0.00001f) invdet = 1.0f/det; dst->right.x *= invdet; dst->right.y *= invdet; @@ -570,7 +573,7 @@ Matrix::makeRotation(Matrix *dst, const V3d *axis, float32 angle) { // V3d v = normalize(*axis); float32 len = dot(*axis, *axis); - if(len != 0.0f) len = 1.0f/sqrtf(len); + if(len > 0.00001f) len = 1.0f/sqrtf(len); V3d v = rw::scale(*axis, len); angle = angle*(float)M_PI/180.0f; float32 s = sinf(angle); diff --git a/vendor/librw/src/rwbase.h b/vendor/librw/src/rwbase.h index 9a8f660..fca8bed 100644 --- a/vendor/librw/src/rwbase.h +++ b/vendor/librw/src/rwbase.h @@ -560,7 +560,7 @@ enum Platform PLATFORM_WDGL = 11, // WarDrum OpenGL PLATFORM_GL3 = 12, // my GL3 implementation - PLATFORM_GLES1 = 13, + PLATFORM_GLES1 = 14, NUM_PLATFORMS,