Refactor: Mover BALL_COUNT_SCENARIOS a defines.h + priorizar 1 capa
REFACTORING: - Movido array de escenarios desde engine.h a defines.h - Nombre más descriptivo: test_ → BALL_COUNT_SCENARIOS - Ahora es constexpr y accesible globalmente MEJORA PNG_SHAPE: - Priorizar calidad 2D sobre profundidad 3D - Reducir capas AGRESIVAMENTE hasta 1 (antes se detenía en 3) - Condiciones más estrictas: < total (antes < total * 0.8) - Vértices activados hasta 150 pelotas (antes 100) FILOSOFÍA NUEVA: 1. Reducir capas hasta 1 (llenar bien el texto en 2D) 2. Si no alcanza: filas alternas en relleno 3. Si no alcanza: cambiar a bordes 4. Si no alcanza: filas alternas en bordes 5. Último recurso: vértices RESULTADO ESPERADO: - 500 pelotas: RELLENO completo 1 capa (texto lleno, sin 3D) - 100 pelotas: BORDES completos 1 capa (todo visible) - 50 pelotas: VÉRTICES (esqueleto visible) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -135,20 +135,20 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h
|
||||
<< ", total 3D: " << total_3d_points << ")\n";
|
||||
std::cout << "[PNG_SHAPE] Pelotas disponibles: " << num_points << "\n";
|
||||
|
||||
// NIVEL 2: Reducir capas de extrusión PRIMERO (antes de cambiar a bordes)
|
||||
// Objetivo: Mantener relleno completo pero más fino
|
||||
while (num_layers_ > 3 && num_points < static_cast<int>(total_3d_points) * 0.8f) {
|
||||
num_layers_ = std::max(3, num_layers_ / 2);
|
||||
// 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<int>(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_
|
||||
<< " (puntos 3D: " << total_3d_points << ")\n";
|
||||
<< " (total 3D: " << total_3d_points << ")\n";
|
||||
}
|
||||
|
||||
// NIVEL 3: Filas alternas en RELLENO (mantiene densidad visual)
|
||||
// NIVEL 3: Filas alternas en RELLENO (solo si 1 capa no alcanza)
|
||||
// Esto permite usar relleno incluso con pocas pelotas
|
||||
int row_skip = 1;
|
||||
if (!PNG_USE_EDGES_ONLY) { // Solo si empezamos con relleno
|
||||
while (row_skip < 4 && num_points < static_cast<int>(total_3d_points) * 0.8f) {
|
||||
while (row_skip < 5 && num_points < static_cast<int>(total_3d_points)) {
|
||||
row_skip++;
|
||||
// ✅ CLAVE: Recalcular desde el ORIGINAL cada vez (no desde el filtrado previo)
|
||||
active_points_data = extractAlternateRows(filled_points_original, row_skip);
|
||||
@@ -160,8 +160,8 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h
|
||||
}
|
||||
}
|
||||
|
||||
// NIVEL 4: Cambiar a BORDES solo si relleno optimizado no es suficiente
|
||||
if (!PNG_USE_EDGES_ONLY && num_points < static_cast<int>(total_3d_points) * 0.5f) {
|
||||
// NIVEL 4: Cambiar a BORDES (solo si relleno con filas alternas no alcanza)
|
||||
if (!PNG_USE_EDGES_ONLY && num_points < static_cast<int>(total_3d_points)) {
|
||||
active_points_data = edge_points_original;
|
||||
mode_name = "BORDES (auto)";
|
||||
num_2d_points = active_points_data.size();
|
||||
@@ -171,8 +171,8 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h
|
||||
<< ", necesarias: " << total_3d_points << ")\n";
|
||||
}
|
||||
|
||||
// NIVEL 5: Filas alternas en BORDES (si aún no es suficiente)
|
||||
while (row_skip < 8 && num_points < static_cast<int>(total_3d_points) * 0.7f) {
|
||||
// NIVEL 5: Filas alternas en BORDES (si aún no alcanza)
|
||||
while (row_skip < 8 && num_points < static_cast<int>(total_3d_points)) {
|
||||
row_skip++;
|
||||
// ✅ CLAVE: Recalcular desde edge_points_original cada vez
|
||||
active_points_data = extractAlternateRows(edge_points_original, row_skip);
|
||||
@@ -185,16 +185,8 @@ void PNGShape::generatePoints(int num_points, float screen_width, float screen_h
|
||||
}
|
||||
}
|
||||
|
||||
// NIVEL 6: Reducir más las capas si aún sobran puntos
|
||||
while (num_layers_ > 1 && num_points < static_cast<int>(total_3d_points) * 0.6f) {
|
||||
num_layers_ = std::max(1, num_layers_ / 2);
|
||||
total_3d_points = num_2d_points * num_layers_;
|
||||
std::cout << "[PNG_SHAPE] Nivel 6: Reduciendo más capas a " << num_layers_
|
||||
<< " (puntos 3D: " << total_3d_points << ")\n";
|
||||
}
|
||||
|
||||
// NIVEL 7: Vértices/esquinas (último recurso, muy pocas pelotas)
|
||||
if (num_points < static_cast<int>(total_3d_points) * 0.4f && num_points < 100) {
|
||||
// NIVEL 6: Vértices/esquinas (último recurso, muy pocas pelotas)
|
||||
if (num_points < static_cast<int>(total_3d_points) && num_points < 150) {
|
||||
// Determinar desde qué conjunto extraer vértices (el que esté activo actualmente)
|
||||
const std::vector<Point2D>& source_for_vertices = (mode_name.find("BORDES") != std::string::npos)
|
||||
? edge_points_original
|
||||
@@ -206,7 +198,7 @@ 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 7: Solo vértices (puntos 2D: " << num_2d_points << ")\n";
|
||||
std::cout << "[PNG_SHAPE] Nivel 6: Solo vértices (puntos 2D: " << num_2d_points << ")\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user