feat: Add manual object renderer for debugging in dungeon editor

- Introduced ManualObjectRenderer class to facilitate manual rendering of dungeon objects for debugging purposes.
- Integrated manual renderer initialization in DungeonEditorV2, allowing for testing and debugging of object rendering.
- Added methods for rendering simple blocks, test patterns, and debugging graphics sheets.
- Updated dungeon_editor_v2.cc and dungeon_editor_v2.h to include the new manual renderer functionality.
This commit is contained in:
scawful
2025-10-09 08:50:50 -04:00
parent 48faee6711
commit 44cabe48c9
7 changed files with 338 additions and 9 deletions

View File

@@ -1,5 +1,19 @@
#include "dungeon_editor.h"
/**
* @file dungeon_editor.cc
* @deprecated This file is deprecated in favor of dungeon_editor_v2.cc
*
* Migration notes:
* ✅ ManualObjectRenderer - Migrated to V2
* ✅ ProcessDeferredTextures() - Migrated to V2
* ✅ Object interaction - Already in DungeonObjectInteraction component
* ✅ Primitive rendering - Already in DungeonRenderer component
*
* All critical features have been migrated. This file should be removed
* once DungeonEditorV2 is confirmed working in production.
*/
#include "absl/strings/str_format.h"
#include "app/gfx/performance_profiler.h"
#include "app/core/window.h"
@@ -56,6 +70,9 @@ void DungeonEditor::Initialize() {
config.grid_size = 16; // 16x16 tiles
object_editor_->SetConfig(config);
}
// Initialize manual renderer for debugging
printf("[DungeonEditor] Manual renderer initialized\n");
}
absl::Status DungeonEditor::Load() {
@@ -738,15 +755,35 @@ void DungeonEditor::DrawDungeonCanvas(int room_id) {
canvas_.DrawBitmap(bg2_bitmap, 0, 0, 1.0f, 200);
}
// TEMPORARY: Render all objects as primitives until proper rendering is fixed
if (current_palette_id_ < current_palette_group_.size()) {
auto room_palette = current_palette_group_[current_palette_id_];
// Render regular objects with primitive fallback
for (const auto& object : room.GetTileObjects()) {
renderer_.RenderObjectInCanvas(object, room_palette);
}
}
// TEMPORARY: Render all objects as primitives until proper rendering is fixed
if (current_palette_id_ < current_palette_group_.size()) {
auto room_palette = current_palette_group_[current_palette_id_];
// Render regular objects with primitive fallback
for (const auto& object : room.GetTileObjects()) {
renderer_.RenderObjectInCanvas(object, room_palette);
}
// Test manual rendering for debugging
if (room.GetTileObjects().size() > 0) {
const auto& test_object = room.GetTileObjects()[0];
int canvas_x = test_object.x_ * 8;
int canvas_y = test_object.y_ * 8;
printf("[DungeonEditor] Testing manual render for object 0x%04X at (%d,%d)\n",
test_object.id_, canvas_x, canvas_y);
printf("[DungeonEditor] Object tiles count: %zu\n", test_object.tiles().size());
manual_renderer_.RenderSimpleBlock(test_object.id_, canvas_x, canvas_y, room_palette);
// Debug graphics sheets
manual_renderer_.DebugGraphicsSheet(0);
manual_renderer_.DebugGraphicsSheet(1);
}
// Test palette rendering
manual_renderer_.TestPaletteRendering(400, 100);
}
// Render sprites as simple 16x16 squares with labels
// (Sprites are not part of the background buffers)