Files
vibe3_physics/source/shapes/shape.h
Sergio Valor a7ec764ebc Implementar sistema polimórfico de figuras 3D (Sphere + Cube)
- Crear interfaz abstracta Shape con métodos virtuales
- Refactorizar RotoBall → SphereShape (clase polimórfica)
- Implementar CubeShape con triple rotación (X/Y/Z)
- Distribución inteligente en cubo: vértices/centros/grid 3D
- Cambiar controles: F=toggle, Q/W/E/R/T/Y/U/I=figuras, B=temas
- Actualizar SimulationMode: ROTOBALL → SHAPE
- Añadir enum ShapeType (8 figuras: Sphere/Cube/Helix/Torus/etc.)
- Incluir source/shapes/*.cpp en CMakeLists.txt
- Física compartida escalable entre todas las figuras
- Roadmap: 6 figuras pendientes (Helix/Torus/Wave/Cylinder/Icosahedron/Atom)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 20:20:10 +02:00

31 lines
1.3 KiB
C++

#pragma once
// Interfaz abstracta para todas las figuras 3D
class Shape {
public:
virtual ~Shape() = default;
// Generar distribución inicial de puntos en la figura
// num_points: cantidad de pelotas a distribuir
// screen_width/height: dimensiones del área de juego (para escalar)
virtual void generatePoints(int num_points, float screen_width, float screen_height) = 0;
// Actualizar animación de la figura (rotación, deformación, etc.)
// delta_time: tiempo transcurrido desde último frame
// screen_width/height: dimensiones actuales (puede cambiar con F4)
virtual void update(float delta_time, float screen_width, float screen_height) = 0;
// Obtener posición 3D del punto i después de transformaciones (rotación, etc.)
// index: índice del punto (0 a num_points-1)
// x, y, z: coordenadas 3D en espacio mundo (centradas en 0,0,0)
virtual void getPoint3D(int index, float& x, float& y, float& z) const = 0;
// Obtener nombre de la figura para debug display
virtual const char* getName() const = 0;
// Obtener factor de escala para ajustar física según tamaño de figura
// screen_height: altura actual de pantalla
// Retorna: factor multiplicador para constantes de física (spring_k, damping, etc.)
virtual float getScaleFactor(float screen_height) const = 0;
};