Skip to content

feat: Scene Viewport Grid & Entity Type System#132

Open
LyeZinho wants to merge 163 commits into
mainfrom
121-44-audio-preview-spatial-placement
Open

feat: Scene Viewport Grid & Entity Type System#132
LyeZinho wants to merge 163 commits into
mainfrom
121-44-audio-preview-spatial-placement

Conversation

@LyeZinho
Copy link
Copy Markdown
Member

Summary

Complete implementation of Scene Viewport grid rendering and professional entity creation system for doppio IDE. Adds Camera, Light, and Mesh Renderer components with full UI integration.

Changes

Features Implemented

  • Grid Rendering: Visible grid in Scene Viewport with zoom/pan support, configurable spacing, highlighted center axis
  • Camera Components: Camera2D (zoom-based orthographic), Camera3D (FOV-based perspective), CameraActive marker
  • Light Components: LightComponent base, DirectionalLight, PointLight, SpotLight with shadow configuration
  • Mesh Renderer Components: MeshRendererComponent (static), SkinnedMeshRendererComponent (skinned)
  • Entity Type Selector UI: Context menu submenu in Hierarchy Panel for creating 7 typed entity types
  • Auto-component Population: Each typed entity auto-populated with required components
  • Undo/Redo Integration: Full support for entity creation with command system

Fixes

  • Fixed namespace scoping issue in Components.hpp (moved includes outside namespace block)
  • Renamed ECS components to avoid collisions:
    • Camera2D → Camera2DComponent (avoid Render::Camera2D)
    • MeshRenderer → MeshRendererComponent (avoid Assets::MeshRenderer)
    • All light components renamed for consistency
  • All compiler warnings resolved

Testing

✅ caffeine-core builds without errors
✅ doppio builds without errors
✅ CaffeineTest builds without errors (previously failing)
✅ DoppioTest builds without errors (previously failing)
✅ Grid rendering verified in code
✅ All 7 entity types verified in menu
✅ Component references verified in implementation

Files Changed

  • src/ecs/CameraComponents.hpp (new)
  • src/ecs/LightComponents.hpp (new)
  • src/ecs/MeshComponents.hpp (new)
  • src/ecs/Components.hpp (updated)
  • src/editor/SceneViewport.hpp/cpp (grid implementation)
  • src/editor/HierarchyPanel.hpp/cpp (entity type selector)

Git History

  • 4596a2d: feat: add grid rendering to Scene Viewport
  • d5fb975: feat: add Camera2D and Camera3D components
  • 45b9d6b: feat: add Light components (Directional, Point, Spot)
  • c5f5bd0: feat: add MeshRenderer components
  • 770c4a0: feat: add entity type selector UI to Hierarchy Panel
  • 99152ef: fix: rename ECS components to avoid namespace collisions

LyeZinho added 30 commits May 16, 2026 15:40
- caffeine-build (Unix/macOS): Single entry point for all build operations
- caffeine-build.bat (Windows): Windows batch version with same interface
- BUILD_GUIDE.md: Comprehensive documentation with examples and troubleshooting

Supports:
- Commands: config, build, rebuild, test, run, clean, help
- Options: --debug, --release, --headless, --scripting, --clean, --jobs
- Auto-detection of CPU cores for parallel builds
- Automatic CMake configuration on first build
- Cross-platform compatibility (Windows, macOS, Linux)

Usage examples:
  ./caffeine-build                # Debug build (default)
  ./caffeine-build build --release # Release build
  ./caffeine-build rebuild --release # Full release rebuild
  ./caffeine-build test # Run tests
  ./caffeine-build run # Execute binary
- Full-featured build system with incremental builds
- Asset caching with content hash validation
- Platform support: Windows_x64 and Linux_x64
- Real-time progress tracking and logging
- Automatic game execution with process waiting
- Complete failure cleanup strategy
- Detailed asset cooking pipeline (textures, shaders, scripts)
- Thread-safe architecture using JobSystem and atomic progress

Ready for implementation.
…ialog UI, and AssetCooker stubs

- Add BuildSystem coordinator with atomic progress tracking and 7-stage build pipeline
- Implement BuildDialog ImGui panel with configuration, progress, and logging sections
- Create AssetCooker stubs for texture and shader cooking (future implementation)
- Wire BuildDialog into editor UI rendering loop
- All code compiles cleanly with diagnostics passing
- caffeine-core library builds successfully with new editor components
- Include all imgui_test_engine source files in doppio target
- Add imgui_test_engine include directory to doppio
- Fixes linker errors for ImGuiTestEngineHook symbols
- caffeine-build now completes successfully
- New component ProjectStartupDialog.hpp/cpp with 3-tab modal dialog
  - Tab 1: Create New Project (name, template selection, location picker)
  - Tab 2: Recent Projects (persistent list across sessions)
  - Tab 3: Browse (placeholder for folder browser, TODO)
  - Error popup for validation/file operation failures

- Data layer (always compiled): Constructor, init(), tryCreateProject(), tryOpenProject(), setError()
- UI layer (CF_HAS_IMGUI guarded): render(), renderCreateTab(), renderRecentTab(), renderBrowseTab(), renderErrorPopup()
- Integrates with existing ProjectManager for all file operations

- Updated SceneEditor::init() to accept ProjectConfig instead of hardcoded asset path
- Wired ProjectStartupDialog into main.cpp startup flow - blocks editor until project selected
- Updated test harness to create minimal ProjectConfig for testing

- CMakeLists.txt updated to include ProjectStartupDialog.cpp

This fixes the critical blocker where editor was hardcoded to 'Untitled' scene with no project selection.
Users can now create and manage projects before entering the editor.

Builds with all 5 targets (libcaffeine-core, doppio, CaffeineTest, DoppioTest, imgui_test_engine).
…e timing and advance animations during render
…nd tools - adds interactive grid display with brush, bucket, eraser, and picker tools
…simplify UI

- Changed from BeginPopupModal to Begin window (more reliable rendering)
- Removed complex tab bar, replaced with simple buttons for quick testing
- Added m_popupOpened tracking fix (reset in init())
- Window now properly initializes and displays on startup
- Simplified to: Project Name input + Create/Quit buttons

This resolves the black window issue where the project selector wasn't visible.
- Link caffeine-core library to ImGui and ImNodes in CMakeLists.txt
- Add CF_HAS_IMGUI define for caffeine-core compilation
- Move imgui.h include outside namespace to avoid operator overload conflicts
- Fix TransformGizmo::isKeyPressed() parameter type (int -> ImGuiKey)
- Remove HelpMarker() calls (not part of ImGui public API)
- Clean up debug logging from ProjectStartupDialog, ImGuiIntegration, main

ProjectStartupDialog now properly renders ImGui UI for project selection.
Fixes black screen issue by ensuring UI code compiles with ImGui enabled.
- Add FilePicker class with ImGui-based directory browser
- Support cross-platform file selection (native dialog stub + ImGui fallback)
- Integrate file picker into Create and Browse tabs of ProjectStartupDialog
- Fix type ambiguity in Browse tab path handling
- Add FilePicker.cpp to CMakeLists.txt source list
- Track last title to detect when user switches between different file dialogs
- Reset search filter when opening new dialog
- Prevents stale path/state from Create tab affecting Browse tab picker
- Rewrite pickPathImGui with per-dialog state using unordered_map
- Remove incorrect IsPopupOpen checks (modals != popups)
- Each file dialog now maintains separate state by title
- Prevents file picker from closing immediately on first render
- Add wasJustClosed flag to defer state cleanup by one frame
- Prevents picker from reinitializing on next call after user cancels
- Fixes issue where picker would flash and immediately close
- Restructure file picker window rendering to always call End()
- Fixes 'Missing End()' assertion error
- ImGui requires matching Begin/End pairs even if Begin() returns false
- Wrap entire loop iteration with PushID/PopID to scope unique ID
- Fixes 'ID Collision' errors when rendering project lists
- Selectable() and Button() now share same ID scope per item
- Dialog was not closing after selecting a project
- This caused multiple render frames with invalid ImGui state
- Leading to 'DragDropActive' assertion when panels rendered
- Now properly closes dialog after project selection
- Prevents re-rendering dialog in next iteration
LyeZinho added 30 commits May 23, 2026 15:24
Implement 6-phase wiring of mesh and prefab asset pipeline:

PHASE 1: SceneSerializer mesh support
- Added MeshFilterComponent and MeshRendererComponent serialization
- Added kTypeMeshFilter=18, kTypeMeshRenderer=19 type IDs
- Scenes with mesh components now persist across save/load

PHASE 2: PrefabInstance component
- Created src/ecs/PrefabComponents.hpp with PrefabInstance struct
- Tracks prefab origins (prefabPath, rootEntityId)
- Registered in ComponentRegistry for editor UI

PHASE 3: AssetCooker mesh cooking
- Implemented CookMeshes() for automatic .obj/.gltf/.glb → .caf conversion
- Supports recursive directory scanning of mesh assets
- Outputs cooked .caf files with metadata and binary vertex/index data

PHASE 4: HierarchyPanel prefab placement
- Added 'Place Prefab...' context menu item
- Modal dialog with path input and error feedback
- Loads prefab and creates PrefabInstance wrapper entity

PHASE 5: SceneSerializer prefab support
- Added kTypePrefabInstance=20 type ID
- Prefab instances now serialize/deserialize with scenes
- Full round-trip persistence for prefab references

PHASE 6: UX Polish
- Added validation to savePrefab() (entity validity, path checks)
- Implemented error messages and console feedback
- Enhanced Place Prefab dialog with error display and recovery

All phases compile without errors. Linker issues pre-existing (tinygltf)
- SceneSerializer: Added mesh component collection/application, prefab instance serialization
- AssetCooker: Implemented CookMeshes() with gltf/glb/obj support
- ComponentRegistry: Registered PrefabInstance component for editor UI
- HierarchyPanel: Added Place Prefab dialog with validation and error handling
- InspectorPanel: Enhanced savePrefab() with validation and console feedback
- Add glTF mesh loading via tinygltf with external buffer support
- Load ALL meshes from glTF files (not just first mesh)
- Implement Custom mesh rendering in SceneViewport with wireframe display
- Add auto-scaling and centering for mesh visualization
- Support for POSITION, NORMAL, TEXCOORD_0 attributes
- Handle absolute and relative mesh file paths
- Clean architecture with no debug output

Fixes: User can now import and visualize 3D models (glTF/glb) in editor
- Implement TestUIMapper.hpp: viewport state capture with entity mapping
- Implement TestRequestHandler.hpp: JSON protocol for test commands
- Add headless test mode to Doppio (DOPPIO_TEST_MODE=1)
- Support get_ui_map, click, get_state commands via stdin/stdout
- Create Python test client (DoppioUITestClient) with full workflow tests
- Non-blocking stdin reading for test mode event loop
- Protocol: JSON REQUEST/RESPONSE over stdin/stdout with REQUEST_RESPONSE marker
- Fix drawGrid3D: replace world-space near-plane lerp with correct
  clip-space interpolation in drawLine3D
- Fix drawGrid3D: remove NDC +-1.5 cull from project lambda so off-screen
  line endpoints pass through (ImGui clips them), fixing missing axis lines
- Fix drawGrid3D: raise w guard from 0.01 to 0.1 (matches spec)
- Fix drawGrid3D: use float startX/Z/endX/endZ instead of int to preserve
  sub-unit precision at spacing=0.5
- Fix drawGrid3D: call computeVP3D() instead of duplicating VP computation
- Add projectToScreenVP() + computeVP3D() helpers with per-frame VP cache
  for drawEmptyEntities and drawLightGizmos
- Add automated UI test suite (tests/test_ui_automated.py, 17 tests)
- Add DoppioUIAutomated CTest target
- Add docs/AUDIT_REPORT.md with full engine audit (28 findings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant