Implementar zoom por profundidad Z con perspectiva 3D + toggle

NUEVAS CARACTERÍSTICAS:
- Zoom por profundidad Z: Escala sprites según distancia (0.5x-1.5x)
- Toggle con Numpad / (KP_DIVIDE) para activar/desactivar perspectiva
- Fix transición figura→física: Reset automático de depth_scale a 1.0
- Texto informativo: "DEPTH ZOOM ON/OFF"

IMPLEMENTACIÓN TÉCNICA:
- Ball class: Nueva variable depth_scale_ (0.5-1.5)
- Ball class: Getters/setters getDepthScale() / setDepthScale()
- Engine::addSpriteToBatch(): Parámetro scale con valor defecto 1.0
- Engine::addSpriteToBatch(): Cálculo de vértices escalados centrados
- Engine::updateShape(): Cálculo depth_scale = 0.5 + z_normalized * 1.0
- Engine::render(): Pasa depth_scale al batch en modo SHAPE
- Engine::toggleShapeMode(): Reset depth_scale en salida de figura
- Engine: Variable depth_zoom_enabled_ (true por defecto)
- Batch rendering: Mantiene performance (sin llamadas individuales)

EFECTO VISUAL:
- Pelotas lejanas (Z-): Pequeñas (50%) y oscuras
- Pelotas medias (Z=0): Normales (100%) y brillo medio
- Pelotas cercanas (Z+): Grandes (150%) y brillantes
- Perspectiva 3D realista combinada con Z-sorting

CONTROLES:
- Numpad /: Toggle zoom por profundidad (solo en modo SHAPE)
- Por defecto: ACTIVADO para máximo realismo 3D

README ACTUALIZADO:
- Añadida tecla KP_/ a tabla de controles
- Actualizada sección "Características Técnicas"
- Añadida línea "Zoom por profundidad" en características
- Actualizada sección "Uso" con control de perspectiva

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 21:00:19 +02:00
parent a484ce69e8
commit 91f8bfdd30
5 changed files with 47 additions and 11 deletions

View File

@@ -50,6 +50,7 @@ Ball::Ball(float x, float vx, float vy, Color color, std::shared_ptr<Texture> te
target_x_ = pos_.x;
target_y_ = pos_.y;
depth_brightness_ = 1.0f;
depth_scale_ = 1.0f;
rotoball_attraction_active_ = false;
}
@@ -297,6 +298,10 @@ void Ball::setDepthBrightness(float brightness) {
depth_brightness_ = brightness;
}
void Ball::setDepthScale(float scale) {
depth_scale_ = scale;
}
// Activar/desactivar atracción física hacia esfera RotoBall
void Ball::enableRotoBallAttraction(bool enable) {
rotoball_attraction_active_ = enable;