Editor: headless Vulkan graphics + entity/component InspectorView + --headless CLI
Engine (headless construction, no display / no WSI):
- Graphics/Vulkan/Graphics.{h,cpp} + Graphics/Initializer.h: a 'headless' flag
skips surface/swapchain extension negotiation and the window path so a VkDevice
can be created with a driver present but no display.
- Scene/Scene.{h,cpp}: null-guards + PScene circular-include decoupling.
- Actor/Entity.{h,cpp}: hasComponent fix (handle-space component query).
Editor:
- Editor/Window/InspectorView.{h,cpp}: Unity-style entity/component inspector on a
fixed widget pool (no runtime tree mutation) driven by a UIPass in the render
graph; owns its UI::System via UI::OSystem.
- Editor/ComponentRegistry.{h,cpp}: type-erased component catalog (handle-space only,
no entt in the editor API) that drives the inspector's component pane.
- Editor/main.cpp: --headless / --dump-entities path (headless device + scene dump,
no window) and InspectorView wiring with a live PScene on the windowed path.
Compile-verified (-fsyntax-only, -std=c++23) across all touched TUs.
This commit is contained in:
1 parent
499407d366
commit
c5c66f8cf3
12 files changed
+830
-46
No files matched your search
@@ -16,7 +16,22 @@ class Scene {
|
||||
void bakeLighting();
|
||||
void update(float deltaTime);
|
||||
entt::entity createEntity() { return registry.create(); }
|
||||
void destroyEntity(entt::entity identifier) { registry.destroy(identifier); }
|
||||
// Out-of-line (Scene.cpp): the bodies need the complete Entity type (they call
|
||||
// getIdentifier() on roster entries). Scene.h only forward-declares Entity
|
||||
// (DECLARE_REF) to keep the header light and to avoid a circular include -
|
||||
// Entity.h includes Scene.h, so Scene.h must not pull Actor/Entity.h back in.
|
||||
void destroyEntity(entt::entity identifier);
|
||||
// The scene is the single source of truth for which entities exist. The editor's
|
||||
// inspector enumerates this roster (non-owning views) to build its entity list - the
|
||||
// whole point of "the scene owns the entity". Populated as entities are created and
|
||||
// pruned as they are destroyed; never points at a live handle that outlives its record.
|
||||
const Array<PEntity>& getEntities() const { return entities; }
|
||||
// Internal: called by Entity's ctor/dtor to keep the roster in lock-step with the
|
||||
// registry. Not part of the public "create/destroy" surface (use createEntity /
|
||||
// destroyEntity for that).
|
||||
void registerEntity(entt::entity identifier, PEntity self) { entities.add(self); }
|
||||
// Out-of-line (Scene.cpp): calls getIdentifier() on roster entries -> needs complete Entity.
|
||||
void unregisterEntity(entt::entity identifier);
|
||||
template <typename Component, typename... Args> Component& attachComponent(entt::entity entity, Args&&... args) {
|
||||
return registry.emplace<Component>(entity, std::forward<Args>(args)...);
|
||||
}
|
||||
@@ -37,6 +52,15 @@ class Scene {
|
||||
|
||||
private:
|
||||
Gfx::PGraphics graphics;
|
||||
|
||||
// The roster: the scene's single source of truth for which entities currently exist.
|
||||
// Non-owning views (P* = RefPtr, a plain pointer) - the *owning* O* (OwningPtr) held
|
||||
// by the code that created each actor still owns the C++ object; the roster only tracks
|
||||
// existence so tooling (the editor's inspector) can enumerate entities in handle space.
|
||||
// Kept in lock-step by Entity's ctor (registerEntity) and dtor (routed through
|
||||
// destroyEntity -> unregisterEntity), so it never points at a dead record.
|
||||
Array<PEntity> entities;
|
||||
|
||||
OLightEnvironment lightEnv;
|
||||
OFluidScene fluidScene;
|
||||
PhysicsSystem physics;
|
||||
|
||||
Reference in new issue
Block a user