#pragma once #include // for unique_ptr #include "../defines.h" // for SimulationMode, ShapeType #include "../shapes/shape.h" // for Shape base class // Forward declarations class Engine; /** * @class ShapeManager * @brief Gestiona el sistema de figuras 3D (esferas, cubos, PNG shapes, etc.) * * Responsabilidad única: Gestión de figuras 3D polimórficas * * Características: * - Control de modo simulación (PHYSICS/SHAPE) * - Gestión de tipos de figura (SPHERE/CUBE/PYRAMID/TORUS/ICOSAHEDRON/PNG_SHAPE) * - Sistema de escalado manual (Numpad +/-) * - Toggle de depth zoom (Z) * - Generación y actualización de puntos de figura * - Callbacks al Engine para renderizado */ class ShapeManager { public: /** * @brief Constructor */ ShapeManager(); /** * @brief Destructor */ ~ShapeManager(); /** * @brief Inicializa el ShapeManager con referencia al Engine * @param engine Puntero al Engine (para callbacks) */ void initialize(Engine* engine); /** * @brief Toggle entre modo PHYSICS y SHAPE * @param force_gravity_on_exit Forzar gravedad al salir de SHAPE mode */ void toggleShapeMode(bool force_gravity_on_exit = true); /** * @brief Activa un tipo específico de figura * @param type Tipo de figura a activar */ void activateShape(ShapeType type); /** * @brief Cambia la escala de la figura actual * @param increase true para aumentar, false para reducir */ void handleShapeScaleChange(bool increase); /** * @brief Resetea la escala de figura a 1.0 */ void resetShapeScale(); /** * @brief Toggle del zoom por profundidad Z */ void toggleDepthZoom(); /** * @brief Actualiza la figura activa (rotación, etc.) * @param delta_time Delta time para animaciones */ void update(float delta_time); /** * @brief Genera los puntos de la figura activa */ void generateShape(); // === Getters === /** * @brief Obtiene el modo de simulación actual */ SimulationMode getCurrentMode() const { return current_mode_; } /** * @brief Obtiene el tipo de figura actual */ ShapeType getCurrentShapeType() const { return current_shape_type_; } /** * @brief Obtiene puntero a la figura activa */ Shape* getActiveShape() { return active_shape_.get(); } const Shape* getActiveShape() const { return active_shape_.get(); } /** * @brief Obtiene el factor de escala actual */ float getShapeScaleFactor() const { return shape_scale_factor_; } /** * @brief Verifica si depth zoom está activado */ bool isDepthZoomEnabled() const { return depth_zoom_enabled_; } /** * @brief Verifica si modo SHAPE está activo */ bool isShapeModeActive() const { return current_mode_ == SimulationMode::SHAPE; } private: // === Referencia al Engine (callback) === Engine* engine_; // === Estado de figuras 3D === SimulationMode current_mode_; ShapeType current_shape_type_; ShapeType last_shape_type_; std::unique_ptr active_shape_; float shape_scale_factor_; bool depth_zoom_enabled_; // === Métodos privados === /** * @brief Implementación interna de activación de figura * @param type Tipo de figura */ void activateShapeInternal(ShapeType type); /** * @brief Limita la escala para evitar clipping */ void clampShapeScale(); };