From 5dca07d113df5e9785f855fac34ff7999ce84a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Tue, 3 Sep 2024 17:13:29 +0200 Subject: [PATCH] fix idq and eulerq --- demos/04-actor.c | 4 ++-- depot | 2 +- engine/joint/v4k.h | 4 ++-- engine/split/v4k_math.c | 4 ++-- engine/v4k.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/demos/04-actor.c b/demos/04-actor.c index 49d5974..7bc3d11 100644 --- a/demos/04-actor.c +++ b/demos/04-actor.c @@ -27,9 +27,9 @@ int main() { { "PLAYER-1", model("kgirls01.fbx", 0), loop(0,60,0.25,0), loop(66,85,0.25,0), // idle anim [0..60], run anim [66..85] {KEY_UP,KEY_DOWN,KEY_LEFT,KEY_RIGHT}, 2, {0.90,0.80}, {0,90}, {3, 0.30, 30}, {0}, {1} }, { "PLAYER-2", model("george.fbx", 0), loop(0,100,0.25,0), loop(372,396,0.25,0), // idle anim [0..100], run anim [372..396] - {KEY_I,KEY_K,KEY_J,KEY_L}, 1, {0.95,0.90}, {90,-180}, {1.75, 0.25, 24}, {-5}, {1} }, + {KEY_I,KEY_K,KEY_J,KEY_L}, 1, {0.95,0.90}, {-180,90}, {1.75, 0.25, 24}, {-5}, {1} }, { "PLAYER-3", model("alien.fbx", 0), loop(110,208,0.25,0), loop(360,380,0.25,0), // idle anim [110..208], run anim [360..380] - {KEY_W,KEY_S,KEY_A,KEY_D}, 0.85, {0.85,0.75}, {90,-180}, {3.5, 0.35, 60}, {5}, {1} } + {KEY_W,KEY_S,KEY_A,KEY_D}, 0.85, {0.85,0.75}, {-180,90}, {3.5, 0.35, 60}, {5}, {1} } }; // camera that points to origin, skybox, and a background tune diff --git a/depot b/depot index 25f79cb..dc53801 160000 --- a/depot +++ b/depot @@ -1 +1 @@ -Subproject commit 25f79cb67011ce1848ae2de45a010a07cddc00dd +Subproject commit dc53801aafff279cd12903aa85a5091d5a528ed5 diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 0fa1165..3bd6640 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -377349,7 +377349,7 @@ vec4 clamp4f(vec4 v,float a,float b){ return vec4(maxf(minf(b,v.x),a),maxf(minf( // ---------------------------------------------------------------------------- -quat idq ( ) { return quat(1,0,0,0); } // 0,0,0,1? +quat idq ( ) { return quat(0,0,0,1); } quat ptrq (const float *a ) { return quat(a[0],a[1],a[2],a[3]); } quat vec3q (vec3 a, float w ) { return quat(a.x,a.y,a.z,w); } quat vec4q (vec4 a ) { return quat(a.x,a.y,a.z,a.w); } @@ -377434,7 +377434,7 @@ quat eulerq (vec3 pyr_degrees) { // bugs? float p = rad(pyr_degrees.x), y = rad(pyr_degrees.y), r = rad(pyr_degrees.z); float ha = p * 0.5f, hb = r * 0.5f, hc = y * 0.5f; float cp = cosf(ha), sp = sinf(ha), cr = cosf(hb), sr = sinf(hb), cy = cosf(hc), sy = sinf(hc); - return quat(cy*cr*cp + sy*sr*sp, cy*sr*cp - sy*cr*sp, cy*cr*sp + sy*sr*cp, sy*cr*cp - cy*sr*sp); + return quat(sy*cr*cp - cy*sr*sp, cy*sr*cp - sy*cr*sp, cy*cr*sp + sy*sr*cp, cy*cr*cp + sy*sr*sp); #endif } diff --git a/engine/split/v4k_math.c b/engine/split/v4k_math.c index c626736..96a1c88 100644 --- a/engine/split/v4k_math.c +++ b/engine/split/v4k_math.c @@ -226,7 +226,7 @@ vec4 clamp4f(vec4 v,float a,float b){ return vec4(maxf(minf(b,v.x),a),maxf(minf( // ---------------------------------------------------------------------------- -quat idq ( ) { return quat(1,0,0,0); } // 0,0,0,1? +quat idq ( ) { return quat(0,0,0,1); } quat ptrq (const float *a ) { return quat(a[0],a[1],a[2],a[3]); } quat vec3q (vec3 a, float w ) { return quat(a.x,a.y,a.z,w); } quat vec4q (vec4 a ) { return quat(a.x,a.y,a.z,a.w); } @@ -311,7 +311,7 @@ quat eulerq (vec3 pyr_degrees) { // bugs? float p = rad(pyr_degrees.x), y = rad(pyr_degrees.y), r = rad(pyr_degrees.z); float ha = p * 0.5f, hb = r * 0.5f, hc = y * 0.5f; float cp = cosf(ha), sp = sinf(ha), cr = cosf(hb), sr = sinf(hb), cy = cosf(hc), sy = sinf(hc); - return quat(cy*cr*cp + sy*sr*sp, cy*sr*cp - sy*cr*sp, cy*cr*sp + sy*sr*cp, sy*cr*cp - cy*sr*sp); + return quat(sy*cr*cp - cy*sr*sp, cy*sr*cp - sy*cr*sp, cy*cr*sp + sy*sr*cp, cy*cr*cp + sy*sr*sp); #endif } diff --git a/engine/v4k.c b/engine/v4k.c index 83ff63a..73e6789 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -12379,7 +12379,7 @@ vec4 clamp4f(vec4 v,float a,float b){ return vec4(maxf(minf(b,v.x),a),maxf(minf( // ---------------------------------------------------------------------------- -quat idq ( ) { return quat(1,0,0,0); } // 0,0,0,1? +quat idq ( ) { return quat(0,0,0,1); } quat ptrq (const float *a ) { return quat(a[0],a[1],a[2],a[3]); } quat vec3q (vec3 a, float w ) { return quat(a.x,a.y,a.z,w); } quat vec4q (vec4 a ) { return quat(a.x,a.y,a.z,a.w); } @@ -12464,7 +12464,7 @@ quat eulerq (vec3 pyr_degrees) { // bugs? float p = rad(pyr_degrees.x), y = rad(pyr_degrees.y), r = rad(pyr_degrees.z); float ha = p * 0.5f, hb = r * 0.5f, hc = y * 0.5f; float cp = cosf(ha), sp = sinf(ha), cr = cosf(hb), sr = sinf(hb), cy = cosf(hc), sy = sinf(hc); - return quat(cy*cr*cp + sy*sr*sp, cy*sr*cp - sy*cr*sp, cy*cr*sp + sy*sr*cp, sy*cr*cp - cy*sr*sp); + return quat(sy*cr*cp - cy*sr*sp, cy*sr*cp - sy*cr*sp, cy*cr*sp + sy*sr*cp, cy*cr*cp + sy*sr*sp); #endif }