Implementar figura WAVE_GRID (malla ondeante 3D) - Tecla W
- Nueva clase WaveGridShape con ecuaciones de onda 2D - Grid adaptativo según número de pelotas (1-N puntos) - Ecuación: z = A*sin(kx*x + phase)*cos(ky*y + phase) - Rotación lenta en Y + animación de fase rápida - Compatible con física spring-damper y z-sorting - Escalable con Numpad +/- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
24
source/shapes/wave_grid_shape.h
Normal file
24
source/shapes/wave_grid_shape.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "shape.h"
|
||||
|
||||
// Figura: Malla ondeante 3D (Wave Grid)
|
||||
// Comportamiento: Grid 2D con ondas sinusoidales en Z + rotación
|
||||
// Ecuaciones: z = A * sin(kx*x + phase) * cos(ky*y + phase)
|
||||
class WaveGridShape : public Shape {
|
||||
private:
|
||||
float angle_y_ = 0.0f; // Ángulo de rotación en eje Y (rad)
|
||||
float phase_ = 0.0f; // Fase de animación de ondas (rad)
|
||||
float grid_size_ = 0.0f; // Tamaño del grid (píxeles)
|
||||
float amplitude_ = 0.0f; // Amplitud de las ondas (píxeles)
|
||||
int grid_cols_ = 0; // Número de columnas del grid
|
||||
int grid_rows_ = 0; // Número de filas del grid
|
||||
int num_points_ = 0; // Cantidad total de puntos
|
||||
|
||||
public:
|
||||
void generatePoints(int num_points, float screen_width, float screen_height) override;
|
||||
void update(float delta_time, float screen_width, float screen_height) override;
|
||||
void getPoint3D(int index, float& x, float& y, float& z) const override;
|
||||
const char* getName() const override { return "WAVE GRID"; }
|
||||
float getScaleFactor(float screen_height) const override;
|
||||
};
|
||||
Reference in New Issue
Block a user