fix: corregir límite de sprites en SHAPE mode con muchas bolas
GpuSpriteBatch::init() ahora acepta capacidad dinámica para soportar --custom-balls N con N > 200000. El buffer se dimensiona a (N+1) quads, reservando siempre un slot para el overlay. addFullscreenOverlay() calcula overlay_index_count_ desde el delta real de indices_ en lugar de fijarlo a 6 incondicionalmente. Engine calcula la capacidad correcta al init. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -231,8 +231,14 @@ bool Engine::initialize(int width, int height, int zoom, bool fullscreen, AppMod
|
||||
success = false;
|
||||
}
|
||||
|
||||
// Calcular capacidad: background (1) + bolas del escenario máximo + overlay (+1 interno en init)
|
||||
int sprite_capacity = BALL_COUNT_SCENARIOS[DEMO_AUTO_MAX_SCENARIO];
|
||||
if (custom_scenario_enabled_ && custom_scenario_balls_ > sprite_capacity)
|
||||
sprite_capacity = custom_scenario_balls_;
|
||||
sprite_capacity += 1; // +1 por el background
|
||||
|
||||
sprite_batch_ = std::make_unique<GpuSpriteBatch>();
|
||||
if (!sprite_batch_->init(gpu_ctx_->device())) {
|
||||
if (!sprite_batch_->init(gpu_ctx_->device(), sprite_capacity)) {
|
||||
std::cerr << "ERROR: No se pudo crear el sprite batch GPU" << std::endl;
|
||||
success = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user