diff --git a/source/core/graphics/starfield3d.hpp b/source/core/graphics/starfield3d.hpp index f441697..5f7b2fc 100644 --- a/source/core/graphics/starfield3d.hpp +++ b/source/core/graphics/starfield3d.hpp @@ -48,9 +48,9 @@ namespace Graphics { // Volum de spawn / regeneració en l'espai 3D. static constexpr float Z_NEAR_RESPAWN = 5.0F; // Si Z < aquest valor → regenera - static constexpr float Z_FAR_SPAWN = 800.0F; // Z de regeneració (lluny) - static constexpr float HALF_SPAWN_X = 600.0F; // X aleatori dins [-, +] - static constexpr float HALF_SPAWN_Y = 360.0F; // Y aleatori dins [-, +] + static constexpr float Z_FAR_SPAWN = 1500.0F; // Z de regeneració (lluny — més profunditat) + static constexpr float HALF_SPAWN_X = 900.0F; // X aleatori dins [-, +] + static constexpr float HALF_SPAWN_Y = 540.0F; // Y aleatori dins [-, +] // Mida i moviment. static constexpr float STAR_BASE_SCALE = 1.8F; diff --git a/source/game/title/ship_animator3d.cpp b/source/game/title/ship_animator3d.cpp index 82dd209..35561b8 100644 --- a/source/game/title/ship_animator3d.cpp +++ b/source/game/title/ship_animator3d.cpp @@ -18,10 +18,17 @@ namespace Title { // 0.0F → emet només la silueta plana. >0 emet volum extrudit. constexpr float SHIP_EXTRUSION_DEPTH = 1.0F; - // Punt de fuga (al fons, centre projectat). Tots els paths convergeixen aquí. + // VP lògic per definir forward_dir / direcció del path. Tots els paths + // s'allunyen cap a aquest punt; les naus exiting continuen MÉS ENLLÀ + // (vegeu SHIP_EXIT_TRAVEL) per no desaparèixer en arribar al VP. constexpr float SHIP_EXIT_Z = 800.0F; constexpr Vec3 VANISHING_POINT{.x = 0.0F, .y = 0.0F, .z = SHIP_EXIT_Z}; + // Distància que la nau recorre durant EXITING, sumada al forward_dir + // sobre la posició inicial de l'exit. La nau travessa el VP i continua + // allunyant-se per perspectiva fins gairebé desaparèixer per mida. + constexpr float SHIP_EXIT_TRAVEL = 2500.0F; + // Directors VP → origen de cada nau, normalitzats. P1 ve des de "les 7" // del rellotge (baix-esquerra), P2 des de "les 5" (baix-dreta). Els // components estan calibrats perquè a TARGET_DIST el pixel projectat @@ -80,7 +87,7 @@ namespace Title { constexpr float SHIP_FLOAT_SCALE = 2.0F; constexpr float SHIP_ENTRY_SCALE = 2.0F; // Mida mundial idèntica; la perspectiva fa la resta constexpr float ENTRY_DURATION = 2.0F; - constexpr float EXIT_DURATION = 1.0F; + constexpr float EXIT_DURATION = 1.5F; // Oscil·lació en unitats mundials (al voltant del target_position). constexpr float FLOAT_AMPLITUDE_X = 1.5F; @@ -276,10 +283,17 @@ namespace Title { const float PROGRESS = std::min(1.0F, ship.state_time / EXIT_DURATION); const float EASED = Easing::easeInQuad(PROGRESS); - // Vola cap al centre projectat (x=0, y=0) i a Z gran (lluny). - ship.current_position.x = Easing::lerp(ship.initial_position.x, 0.0F, EASED); - ship.current_position.y = Easing::lerp(ship.initial_position.y, 0.0F, EASED); - ship.current_position.z = Easing::lerp(ship.initial_position.z, SHIP_EXIT_Z, EASED); + // Destí: forward_dir prolongat des de l'inici de l'exit. La nau + // segueix la mateixa línia recta (mateix path), travessa el VP i + // continua allunyant-se fins a la mida visual ~0. + const Vec3 EXIT_DEST{ + .x = ship.initial_position.x + (ship.forward_dir.x * SHIP_EXIT_TRAVEL), + .y = ship.initial_position.y + (ship.forward_dir.y * SHIP_EXIT_TRAVEL), + .z = ship.initial_position.z + (ship.forward_dir.z * SHIP_EXIT_TRAVEL), + }; + ship.current_position.x = Easing::lerp(ship.initial_position.x, EXIT_DEST.x, EASED); + ship.current_position.y = Easing::lerp(ship.initial_position.y, EXIT_DEST.y, EASED); + ship.current_position.z = Easing::lerp(ship.initial_position.z, EXIT_DEST.z, EASED); ship.current_scale = ship.target_scale; // L'escala visual baixa via la perspectiva if (PROGRESS >= 1.0F) {