fix(title-3d): naus rotades cap al VP, alçada mínima, eix X de càmera corregit
This commit is contained in:
@@ -49,10 +49,12 @@ namespace Graphics {
|
|||||||
void Camera3D::recomputeBasis() {
|
void Camera3D::recomputeBasis() {
|
||||||
// Forward = del position cap al target.
|
// Forward = del position cap al target.
|
||||||
forward_ = (target_ - position_).normalized();
|
forward_ = (target_ - position_).normalized();
|
||||||
// Right = forward × up_world. Cau a (1,0,0) si forward ≈ up_world.
|
// Right = up_world × forward (convenció right-handed amb Y up,
|
||||||
right_ = forward_.cross(up_world_).normalized();
|
// mirant cap a +Z → right cau a +X). L'invers (forward × up_world)
|
||||||
// Up real ortogonal = right × forward.
|
// donava la base mirall i invertia l'eix X de la projecció.
|
||||||
up_ = right_.cross(forward_).normalized();
|
right_ = up_world_.cross(forward_).normalized();
|
||||||
|
// Up ortogonal real = forward × right (manté la mà dreta).
|
||||||
|
up_ = forward_.cross(right_).normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera3D::recomputeFocal() {
|
void Camera3D::recomputeFocal() {
|
||||||
|
|||||||
@@ -15,7 +15,12 @@ namespace Title {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Profunditat d'extrusió de la silueta 2D de la nau (en unitats mundials).
|
// 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).
|
// 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
|
constexpr float SHIP_FLOAT_X = 20.0F; // Separació horitzontal
|
||||||
@@ -102,7 +107,7 @@ namespace Title {
|
|||||||
}
|
}
|
||||||
const Graphics::Transform3D TRANSFORM{
|
const Graphics::Transform3D TRANSFORM{
|
||||||
.position = ship.current_position,
|
.position = ship.current_position,
|
||||||
.rotation_euler = Vec3{},
|
.rotation_euler = Vec3{.x = SHIP_PITCH_RAD, .y = 0.0F, .z = 0.0F},
|
||||||
.scale = ship.current_scale,
|
.scale = ship.current_scale,
|
||||||
};
|
};
|
||||||
Graphics::drawWireframe(renderer_, *camera_, ship.mesh, TRANSFORM, 1.0F);
|
Graphics::drawWireframe(renderer_, *camera_, ship.mesh, TRANSFORM, 1.0F);
|
||||||
|
|||||||
Reference in New Issue
Block a user