Fix face animations

Caused by `--fpmode fast` optimization
This commit is contained in:
Shinovon 2026-05-09 18:56:44 +05:00
parent fa4776192b
commit d49730b827
2 changed files with 6 additions and 3 deletions

View file

@ -137,6 +137,9 @@ slerp(const Quat &q, const Quat &p, float32 a)
c = -c; c = -c;
q1 = negate(q1); q1 = negate(q1);
} }
if(c > 1.0f) {
c = 1.0f;
}
float32 phi = acosf(c); float32 phi = acosf(c);
if(phi > 0.00001f){ if(phi > 0.00001f){
float32 s = sinf(phi); float32 s = sinf(phi);
@ -547,7 +550,7 @@ Matrix::invertGeneral(Matrix *dst, const Matrix *src)
// get the determinant from that // get the determinant from that
det = src->up.x * dst->right.y + src->at.x * dst->right.z + dst->right.x * src->right.x; det = src->up.x * dst->right.y + src->at.x * dst->right.z + dst->right.x * src->right.x;
invdet = 1.0; invdet = 1.0;
if(det != 0.0f) if(fabsf(det) > 0.00001f)
invdet = 1.0f/det; invdet = 1.0f/det;
dst->right.x *= invdet; dst->right.x *= invdet;
dst->right.y *= invdet; dst->right.y *= invdet;
@ -570,7 +573,7 @@ Matrix::makeRotation(Matrix *dst, const V3d *axis, float32 angle)
{ {
// V3d v = normalize(*axis); // V3d v = normalize(*axis);
float32 len = dot(*axis, *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); V3d v = rw::scale(*axis, len);
angle = angle*(float)M_PI/180.0f; angle = angle*(float)M_PI/180.0f;
float32 s = sinf(angle); float32 s = sinf(angle);

View file

@ -560,7 +560,7 @@ enum Platform
PLATFORM_WDGL = 11, // WarDrum OpenGL PLATFORM_WDGL = 11, // WarDrum OpenGL
PLATFORM_GL3 = 12, // my GL3 implementation PLATFORM_GL3 = 12, // my GL3 implementation
PLATFORM_GLES1 = 13, PLATFORM_GLES1 = 14,
NUM_PLATFORMS, NUM_PLATFORMS,