diff --git a/source/engine.cpp b/source/engine.cpp index 8cff8f7..dbb35a3 100644 --- a/source/engine.cpp +++ b/source/engine.cpp @@ -1798,8 +1798,6 @@ void Engine::enterLogoMode(bool from_demo) { demo_timer_ = 0.0f; demo_next_action_time_ = LOGO_ACTION_INTERVAL_MIN + (rand() % 1000) / 1000.0f * (LOGO_ACTION_INTERVAL_MAX - LOGO_ACTION_INTERVAL_MIN); - - std::cout << "[LOGO MODE] Activado" << (from_demo ? " (desde DEMO)" : " (manual)") << "\n"; } // Salir del Modo Logo (volver a estado anterior o salir de DEMO) @@ -1843,8 +1841,6 @@ void Engine::exitLogoMode(bool return_to_demo) { ((demo_lite_enabled_ ? DEMO_LITE_ACTION_INTERVAL_MAX : DEMO_ACTION_INTERVAL_MAX) - (demo_lite_enabled_ ? DEMO_LITE_ACTION_INTERVAL_MIN : DEMO_ACTION_INTERVAL_MIN)); } - - std::cout << "[LOGO MODE] Desactivado" << (return_to_demo ? " (volviendo a DEMO)" : " (salida manual)") << "\n"; } // Toggle manual del Modo Logo (tecla K) diff --git a/source/shapes/png_shape.cpp b/source/shapes/png_shape.cpp index d974c28..9a5a875 100644 --- a/source/shapes/png_shape.cpp +++ b/source/shapes/png_shape.cpp @@ -130,18 +130,11 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h num_2d_points = active_points_data.size(); total_3d_points = num_2d_points * num_layers_; - std::cout << "[PNG_SHAPE] Nivel 1: Modo inicial " << mode_name - << " (puntos 2D: " << num_2d_points << ", capas: " << num_layers_ - << ", total 3D: " << total_3d_points << ")\n"; - std::cout << "[PNG_SHAPE] Pelotas disponibles: " << num_points << "\n"; - // NIVEL 2: Reducir capas AGRESIVAMENTE hasta 1 (priorizar calidad 2D sobre profundidad 3D) // Objetivo: Llenar bien el texto en 2D antes de reducir píxeles while (num_layers_ > 1 && num_points < static_cast(total_3d_points)) { num_layers_ = std::max(1, num_layers_ / 2); total_3d_points = num_2d_points * num_layers_; - std::cout << "[PNG_SHAPE] Nivel 2: Reduciendo capas a " << num_layers_ - << " (total 3D: " << total_3d_points << ")\n"; } // NIVEL 3: Filas alternas en RELLENO (solo si 1 capa no alcanza) @@ -154,8 +147,6 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h active_points_data = extractAlternateRows(filled_points_original, row_skip); num_2d_points = active_points_data.size(); total_3d_points = num_2d_points * num_layers_; - std::cout << "[PNG_SHAPE] Nivel 3: Filas alternas RELLENO (cada " << row_skip - << " filas, puntos 2D: " << num_2d_points << ", total 3D: " << total_3d_points << ")\n"; mode_name = "RELLENO + FILAS/" + std::to_string(row_skip); } } @@ -167,8 +158,6 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h num_2d_points = active_points_data.size(); total_3d_points = num_2d_points * num_layers_; row_skip = 1; // Reset row_skip para bordes - std::cout << "[PNG_SHAPE] Nivel 4: Cambiando a BORDES (pelotas: " << num_points - << ", necesarias: " << total_3d_points << ")\n"; } // NIVEL 5: Filas alternas en BORDES (si aún no alcanza) @@ -178,8 +167,6 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h active_points_data = extractAlternateRows(edge_points_original, row_skip); num_2d_points = active_points_data.size(); total_3d_points = num_2d_points * num_layers_; - std::cout << "[PNG_SHAPE] Nivel 5: Filas alternas BORDES (cada " << row_skip - << " filas, puntos 2D: " << num_2d_points << ", total 3D: " << total_3d_points << ")\n"; if (mode_name.find("FILAS") == std::string::npos) { mode_name += " + FILAS/" + std::to_string(row_skip); } @@ -198,22 +185,12 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h num_2d_points = active_points_data.size(); total_3d_points = num_2d_points * num_layers_; mode_name = "VÉRTICES"; - std::cout << "[PNG_SHAPE] Nivel 6: Solo vértices (puntos 2D: " << num_2d_points << ")\n"; } } // ✅ CLAVE: Guardar el conjunto de puntos optimizado final en optimized_points_ (usado por getPoint3D) optimized_points_ = active_points_data; - // Debug: mostrar configuración final - std::cout << "[PNG_SHAPE] === CONFIGURACIÓN FINAL ===\n"; - std::cout << "[PNG_SHAPE] Modo: " << mode_name << "\n"; - std::cout << "[PNG_SHAPE] Píxeles 2D: " << num_2d_points << "\n"; - std::cout << "[PNG_SHAPE] Capas extrusión: " << num_layers_ << "\n"; - std::cout << "[PNG_SHAPE] Total puntos 3D: " << total_3d_points << "\n"; - std::cout << "[PNG_SHAPE] Pelotas disponibles: " << num_points << "\n"; - std::cout << "[PNG_SHAPE] Ratio: " << (float)num_points / (float)total_3d_points << " pelotas/punto\n"; - // Calcular escala para centrar la imagen en pantalla float max_dimension = std::max(static_cast(image_width_), static_cast(image_height_)); scale_factor_ = (screen_height * PNG_SIZE_FACTOR) / max_dimension; @@ -287,9 +264,13 @@ std::vector PNGShape::extractCornerVertices(const std::vector void PNGShape::update(float delta_time, float screen_width, float screen_height) { if (!is_flipping_) { - // Estado IDLE: texto de frente + // Estado IDLE: texto de frente con pivoteo sutil (como WAVE_GRID) idle_timer_ += delta_time; + // Pivoteo sutil constante (movimiento orgánico) + tilt_x_ += 0.4f * delta_time; // Velocidad sutil en X + tilt_y_ += 0.6f * delta_time; // Velocidad sutil en Y + if (idle_timer_ >= next_idle_time_) { // Iniciar voltereta is_flipping_ = true; @@ -355,6 +336,24 @@ void PNGShape::getPoint3D(int index, float& x, float& y, float& z) const { z_base = -extrusion_depth_ * 0.5f + layer_index * layer_step; } + // Añadir pivoteo sutil en estado IDLE (similar a WAVE_GRID) + // Calcular tamaño del logo en pantalla para normalizar correctamente + float logo_width = image_width_ * scale_factor_; + float logo_height = image_height_ * scale_factor_; + float logo_size = std::max(logo_width, logo_height); + + // Normalizar coordenadas a rango [-1, 1] + float u = x_base / (logo_size * 0.5f); + float v = y_base / (logo_size * 0.5f); + + // Calcular pivoteo (amplitudes más grandes, similar a WAVE_GRID) + float tilt_amount_x = sinf(tilt_x_) * 0.15f; // 15% como WAVE_GRID + float tilt_amount_y = sinf(tilt_y_) * 0.1f; // 10% como WAVE_GRID + + // Aplicar pivoteo proporcional al tamaño del logo + float z_tilt = (u * tilt_amount_y + v * tilt_amount_x) * logo_size; + z_base += z_tilt; // Añadir pivoteo sutil a la profundidad + // Aplicar rotación en eje Y (horizontal) float cos_y = cosf(angle_y_); float sin_y = sinf(angle_y_); @@ -371,10 +370,10 @@ void PNGShape::getPoint3D(int index, float& x, float& y, float& z) const { x = x_rot_y; y = y_rot; - // Cuando está de frente (sin rotación), forzar Z positivo (primer plano brillante) + // Cuando está de frente (sin rotación), usar Z con pivoteo sutil if (angle_x_ == 0.0f && angle_y_ == 0.0f) { - // De frente: todo en primer plano (Z máximo) - z = extrusion_depth_ * 0.5f; // Máximo Z = más brillante + // De frente: usar z_base que incluye el pivoteo sutil + z = z_base; } else { z = z_rot; } diff --git a/source/shapes/png_shape.h b/source/shapes/png_shape.h index 4a2e4bb..40adcd3 100644 --- a/source/shapes/png_shape.h +++ b/source/shapes/png_shape.h @@ -34,6 +34,10 @@ private: bool is_flipping_ = false; // Estado: quieto o voltereta int flip_axis_ = 0; // Eje de voltereta (0=X, 1=Y, 2=ambos) + // Pivoteo sutil en estado IDLE (similar a WAVE_GRID) + float tilt_x_ = 0.0f; // Oscilación sutil en eje X + float tilt_y_ = 0.0f; // Oscilación sutil en eje Y + // Dimensiones normalizadas float scale_factor_ = 1.0f; float center_offset_x_ = 0.0f;