bbbb8d47ae
Identifier-naming: rename de métodos públicos y cross-file al inglés
(camelBack), traducción de campos y locales en el proceso (TitleShip,
StageManager, SpawnController, ShipAnimator, helpers de PlayArea, etc.).
Refactor por cognitive-complexity (>25): GameScene::draw (59→3) con 9
helpers de estado, PhysicsWorld::resolveBodyCollisions (35→5) extrayendo
resolveBodyPair, Options::load{Window,Physics,Audio}ConfigFromYaml
(32/49/57→5/2/3) con templates readField, TitleScene::update (68→4) con
5 sub-pasos por estado + handleSkipInput/handleStartInput +
triggerExitForJoinedPlayers, DebrisManager::explode (39→3) con
extractSegments/spawnDebris/applyAngularVelocity/applyVisualRotation.
use-anyofallof: bucles → std::ranges::any_of/all_of en Input,
ShipAnimator y SpawnController.
readability-static-accessed-through-instance: Director::run y
VectorText::getTextWidth/Height invocados por clase.
readability-convert-member-functions-to-static: ResourcePack::decryptData.
unused-includes: eliminación de <utility>, <cstdint>, <vector>,
<iostream>, defaults.hpp y otros no usados directamente en headers y
unidades de traducción. Restablecido core/defaults.hpp en title_scene.cpp
(falsa "unused" del header).
Bug fix: eliminado isActive() duplicado en Bullet (redeclaración tras
rename de esta_activa→isActive que chocaba con el override de Entity).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
// shape_renderer.hpp - Renderizado de formes vectorials
|
|
// © 2026 JailDesigner
|
|
|
|
#pragma once
|
|
|
|
#include "core/rendering/render_context.hpp"
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <memory>
|
|
|
|
#include "core/graphics/shape.hpp"
|
|
#include "core/types.hpp"
|
|
|
|
namespace Rendering {
|
|
|
|
// Estructura per rotacions 3D (pitch, yaw, roll)
|
|
struct Rotation3D {
|
|
float pitch; // Rotación eix X (cabeceo arriba/baix)
|
|
float yaw; // Rotación eix Y (guiñada izquierda/derecha)
|
|
float roll; // Rotación eix Z (alabeo lateral)
|
|
|
|
Rotation3D()
|
|
: pitch(0.0F),
|
|
yaw(0.0F),
|
|
roll(0.0F) {}
|
|
Rotation3D(float p, float y, float r)
|
|
: pitch(p),
|
|
yaw(y),
|
|
roll(r) {}
|
|
|
|
[[nodiscard]] auto hasRotation() const -> bool {
|
|
return pitch != 0.0F || yaw != 0.0F || roll != 0.0F;
|
|
}
|
|
};
|
|
|
|
// Renderizar shape con transformacions
|
|
// - renderer: SDL renderer
|
|
// - shape: shape vectorial a draw
|
|
// - position: posición del centro en coordenades mundials
|
|
// - angle: rotación en radians (0 = amunt, sentit horari)
|
|
// - scale: factor de scale (1.0 = mida original)
|
|
// - progress: progrés de l'animación (0.0-1.0, default 1.0 = tot visible)
|
|
// - brightness: factor de brightness (0.0-1.0, default 1.0 = màxima brightness)
|
|
void renderShape(Rendering::Renderer* renderer,
|
|
const std::shared_ptr<Graphics::Shape>& shape,
|
|
const Vec2& position,
|
|
float angle,
|
|
float scale = 1.0F,
|
|
float progress = 1.0F,
|
|
float brightness = 1.0F,
|
|
const Rotation3D* rotation_3d = nullptr,
|
|
SDL_Color color = {0, 0, 0, 0}); // alpha==0 → usa global oscilador
|
|
|
|
} // namespace Rendering
|