From e533387ce58e3dfe50e50238f03fa9100cc20fb3 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 22 May 2026 09:11:26 +0200 Subject: [PATCH] =?UTF-8?q?fix(title-3d):=20naus=20rotades=20cap=20al=20VP?= =?UTF-8?q?,=20al=C3=A7ada=20m=C3=ADnima,=20eix=20X=20de=20c=C3=A0mera=20c?= =?UTF-8?q?orregit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/core/graphics/camera3d.cpp | 10 ++++++---- source/game/title/ship_animator3d.cpp | 9 +++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source/core/graphics/camera3d.cpp b/source/core/graphics/camera3d.cpp index 9fe386c..b247ad5 100644 --- a/source/core/graphics/camera3d.cpp +++ b/source/core/graphics/camera3d.cpp @@ -49,10 +49,12 @@ namespace Graphics { void Camera3D::recomputeBasis() { // Forward = del position cap al target. forward_ = (target_ - position_).normalized(); - // Right = forward × up_world. Cau a (1,0,0) si forward ≈ up_world. - right_ = forward_.cross(up_world_).normalized(); - // Up real ortogonal = right × forward. - up_ = right_.cross(forward_).normalized(); + // Right = up_world × forward (convenció right-handed amb Y up, + // mirant cap a +Z → right cau a +X). L'invers (forward × up_world) + // donava la base mirall i invertia l'eix X de la projecció. + right_ = up_world_.cross(forward_).normalized(); + // Up ortogonal real = forward × right (manté la mà dreta). + up_ = forward_.cross(right_).normalized(); } void Camera3D::recomputeFocal() { diff --git a/source/game/title/ship_animator3d.cpp b/source/game/title/ship_animator3d.cpp index 6b4139d..df38220 100644 --- a/source/game/title/ship_animator3d.cpp +++ b/source/game/title/ship_animator3d.cpp @@ -15,7 +15,12 @@ namespace Title { namespace { // Profunditat d'extrusió de la silueta 2D de la nau (en unitats mundials). - constexpr float SHIP_EXTRUSION_DEPTH = 8.0F; + // Mantenir-la xicoteta: l'usuari vol naus "casi 2D" amb alçada mínima. + constexpr float SHIP_EXTRUSION_DEPTH = 1.5F; + + // Rotació pitch que aplica el draw() per orientar la silueta cap al punt + // de fuga: el Y2D negatiu del shape (la punta) passa a +Z mundial. + constexpr float SHIP_PITCH_RAD = -1.5707963F; // -π/2 // Posicions en l'espai 3D (càmera a (0,0,0) mirant cap a +Z, Y cap amunt). constexpr float SHIP_FLOAT_X = 20.0F; // Separació horitzontal @@ -102,7 +107,7 @@ namespace Title { } const Graphics::Transform3D TRANSFORM{ .position = ship.current_position, - .rotation_euler = Vec3{}, + .rotation_euler = Vec3{.x = SHIP_PITCH_RAD, .y = 0.0F, .z = 0.0F}, .scale = ship.current_scale, }; Graphics::drawWireframe(renderer_, *camera_, ship.mesh, TRANSFORM, 1.0F);