EntropyCanvas::SceneService
EntropyCanvas::SceneService
Section titled “EntropyCanvas::SceneService”SceneService manages scene graph operations via ISceneGraph interface. More…
#include <SceneService.h>
Inherits from EntropyEngine::Core::EntropyService, EntropyEngine::Core::EntropyObject
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| ~SceneService() override | |
| flecs::world & | world() Get the Flecs world from the scene graph. |
| const flecs::world & | world() const |
| virtual const char * | version() const override |
| void | updateCameraAspectRatio(float aspectRatio) Update the active camera’s aspect ratio (call on window resize). |
| virtual void | unload() override |
| virtual EntropyEngine::Core::TypeSystem::TypeID | typeId() const override |
| void | tick(float deltaTime) Tick the scene - runs ECS systems and updates entities. |
| virtual void | stop() override |
| virtual void | start() override |
| void | setSchemaService(ComponentSchemaService * service) Set the schema service for hash-based component lookup. |
| void | setDataProvider(IDataProvider * provider) Set the data provider for receiving scene data. |
| void | setActiveCamera(flecs::entity camera) Set the active camera. |
| ComponentSchemaService * | schemaService() const Get the schema service. |
| void | scheduleAsyncTick(EntropyEngine::Core::Concurrency::WorkContractGroup & group, float deltaTime) Schedule tick as async work contract (fire-and-forget). |
| ISceneGraph * | sceneGraph() const Get the underlying ISceneGraph. |
| void | prepareForShutdown() Prepare for shutdown - prevents new ticks from being scheduled. |
| SceneService & | operator=(const SceneService & ) =delete |
| virtual const char * | name() const override |
| uint64_t | makeLocalEntityId(uint32_t serverId, uint64_t serverEntityId) Create a local entity ID from server ID and server entity ID. |
| virtual void | load() override |
| bool | isValid(flecs::entity entity) const Check if an entity is valid. |
| bool | isTickInProgress() const Check if a tick is currently in progress. |
| virtual const char * | id() const override |
| glm::mat4 | getActiveCameraViewProjection() const Get the view-projection matrix from the active camera. |
| glm::mat4 | getActiveCameraView() const Get just the view matrix from the active camera. |
| glm::mat4 | getActiveCameraProjection() const Get just the projection matrix from the active camera. |
| glm::vec3 | getActiveCameraPosition() const Get the world position of the active camera. |
| std::optional< flecs::entity > | getActiveCamera() const Get the active camera entity. |
| template <typename Func > void | forEachRenderable(Func && func) Iterate all entities with Transform and MeshComponent. |
| template <typename Func > void | forEachLight(Func && func) Iterate all entities with Transform and Light. |
| template <typename Func > void | forEachCamera(Func && func) Iterate all entities with Transform and CameraComponent. |
| ExternalTransformRegistry & | externalTransformRegistry() Get the external transform registry for low-latency transform sources. |
| const ExternalTransformRegistry & | externalTransformRegistry() const |
| size_t | entityCount() const Get entity count. |
| void | destroyEntity(flecs::entity entity) Destroy an entity. |
| IDataProvider * | dataProvider() const Get the current data provider. |
| flecs::entity | createEntity(const char * name =nullptr) Create a new entity with an optional name. |
| flecs::entity | createEntity(const Transform & transform, const char * name =nullptr) Create an entity with Transform component. |
| flecs::entity | createCamera(const Transform & transform, const CameraComponent & camera, const char * name =nullptr) Create a camera entity with Transform and CameraComponent. |
| SimulationCommandQueue & | commandQueue() Get the command queue for external systems to submit flecs mutations. |
| void | applySnapshot(const SceneSnapshot & snapshot) Apply a scene snapshot (full scene replacement). |
| void | applyDelta(const PropertyDelta & delta) Apply a property delta (single property change). |
| SceneService() Construct with default SceneGraph (created on load). | |
| SceneService(std::unique_ptr< ISceneGraph > sceneGraph) Construct with injected ISceneGraph implementation. | |
| SceneService(const SceneService & ) =delete |
Additional inherited members
Section titled “Additional inherited members”Public Functions inherited from EntropyEngine::Core::EntropyService
| Name | |
|---|---|
| ~EntropyService() override =default | |
| ServiceState | state() const |
| virtual std::vector< TypeSystem::TypeID > | dependsOnTypes() const |
| virtual std::vector< std::string > | dependsOn() const |
| virtual const char * | className() const override Runtime class name for diagnostics and reflection. |
Protected Functions inherited from EntropyEngine::Core::EntropyService
| Name | |
|---|---|
| void | setState(ServiceState s) |
Friends inherited from EntropyEngine::Core::EntropyService
| Name | |
|---|---|
| class | EntropyServiceRegistry |
Protected Classes inherited from EntropyEngine::Core::EntropyObject
| Name | |
|---|---|
| struct | HandleCore Optional handle identity stamped by an owner/registry. |
Public Functions inherited from EntropyEngine::Core::EntropyObject
| Name | |
|---|---|
| virtual | ~EntropyObject() =default |
| virtual const TypeSystem::TypeInfo * | typeInfo() const Optional richer type information; may be null. |
| bool | tryRetain() const Attempts to retain only if the object is still alive. |
| virtual std::string | toString() const Human-readable short string (class@ptr by default). |
| void | retain() const Increments the reference count. |
| void | release() const Decrements the reference count and deletes when it reaches zero. |
| uint32_t | refCount() const Current reference count (approximate under contention). |
| bool | hasHandle() const |
| template <class OwnerT > OwnerT * | handleOwnerAs() const Returns the stamped owner pointer cast to the requested type. |
| const void * | handleOwner() const |
| uint32_t | handleIndex() const |
| uint64_t | handleId() const |
| uint32_t | handleGeneration() const |
| WeakControlBlock * | getWeakControlBlock() const Lazily retrieves or creates the weak control block. |
| virtual std::string | description() const Long-form description; defaults to toString(). |
| virtual std::string | debugString() const Debug-oriented string including refcount and handle when present. |
| virtual const char * | className() const Runtime class name for diagnostics and reflection. |
| virtual uint64_t | classHash() const Stable type hash for cross-language identification. |
| EntropyObject() =default | |
| EntropyObject(EntropyObject && ) =delete | |
| EntropyObject(const EntropyObject & ) =delete |
Protected Functions inherited from EntropyEngine::Core::EntropyObject
| Name | |
|---|---|
| void | _setHandleIdentity(void * owner, uint32_t index, uint32_t generation) |
| void | _clearHandleIdentity() |
Protected Attributes inherited from EntropyEngine::Core::EntropyObject
| Name | |
|---|---|
| std::atomic< WeakControlBlock * > | _weakBlock Lazily allocated control block for weak refs. |
| std::atomic< uint32_t > | _refCount Thread-safe retain/release counter. |
| struct EntropyEngine::Core::EntropyObject::HandleCore | _handle |
Friends inherited from EntropyEngine::Core::EntropyObject
| Name | |
|---|---|
| struct | HandleAccess |
Detailed Description
Section titled “Detailed Description”class EntropyCanvas::SceneService;SceneService manages scene graph operations via ISceneGraph interface.
This service works with any ISceneGraph implementation:
- SceneGraph: Base implementation for clients
- PersistentSceneGraph: Server-side with USD persistence, DeltaTracker, etc.
Responsibilities:
- Wraps ISceneGraph for service lifecycle management
- Receives scene snapshots and deltas via IDataProvider
- Provides entity creation/destruction API
- Supports querying entities by component
- Manages the active camera
Public Functions Documentation
Section titled “Public Functions Documentation”function ~SceneService
Section titled “function ~SceneService”~SceneService() overridefunction world
Section titled “function world”inline flecs::world & world()Get the Flecs world from the scene graph.
Use for advanced queries or direct Flecs API access.
function world
Section titled “function world”inline const flecs::world & world() constfunction version
Section titled “function version”inline virtual const char * version() const overrideReimplements: EntropyEngine::Core::EntropyService::version
function updateCameraAspectRatio
Section titled “function updateCameraAspectRatio”void updateCameraAspectRatio( float aspectRatio)Update the active camera’s aspect ratio (call on window resize).
function unload
Section titled “function unload”virtual void unload() overrideReimplements: EntropyEngine::Core::EntropyService::unload
function typeId
Section titled “function typeId”inline virtual EntropyEngine::Core::TypeSystem::TypeID typeId() const overrideReimplements: EntropyEngine::Core::EntropyService::typeId
function tick
Section titled “function tick”void tick( float deltaTime)Tick the scene - runs ECS systems and updates entities.
Parameters:
- deltaTime Time since last tick in seconds
Call once per frame from simulation thread/main loop.
function stop
Section titled “function stop”virtual void stop() overrideReimplements: EntropyEngine::Core::EntropyService::stop
function start
Section titled “function start”virtual void start() overrideReimplements: EntropyEngine::Core::EntropyService::start
function setSchemaService
Section titled “function setSchemaService”void setSchemaService( ComponentSchemaService * service)Set the schema service for hash-based component lookup.
function setDataProvider
Section titled “function setDataProvider”void setDataProvider( IDataProvider * provider)Set the data provider for receiving scene data.
This registers for delta callbacks automatically.
function setActiveCamera
Section titled “function setActiveCamera”void setActiveCamera( flecs::entity camera)Set the active camera.
function schemaService
Section titled “function schemaService”inline ComponentSchemaService * schemaService() constGet the schema service.
function scheduleAsyncTick
Section titled “function scheduleAsyncTick”void scheduleAsyncTick( EntropyEngine::Core::Concurrency::WorkContractGroup & group, float deltaTime)Schedule tick as async work contract (fire-and-forget).
Parameters:
- group WorkContractGroup to schedule on
- deltaTime Time since last tick in seconds
If a tick is already in progress, this is a no-op.
function sceneGraph
Section titled “function sceneGraph”inline ISceneGraph * sceneGraph() constGet the underlying ISceneGraph.
Return: Pointer to ISceneGraph (nullptr if not loaded)
function prepareForShutdown
Section titled “function prepareForShutdown”void prepareForShutdown()Prepare for shutdown - prevents new ticks from being scheduled.
Call before waiting for in-flight tick to complete.
function operator=
Section titled “function operator=”SceneService & operator=( const SceneService &) =deletefunction name
Section titled “function name”inline virtual const char * name() const overrideReimplements: EntropyEngine::Core::EntropyService::name
function makeLocalEntityId
Section titled “function makeLocalEntityId”static uint64_t makeLocalEntityId( uint32_t serverId, uint64_t serverEntityId)Create a local entity ID from server ID and server entity ID.
This allows entities from multiple servers to coexist.
function load
Section titled “function load”virtual void load() overrideReimplements: EntropyEngine::Core::EntropyService::load
function isValid
Section titled “function isValid”bool isValid( flecs::entity entity) constCheck if an entity is valid.
function isTickInProgress
Section titled “function isTickInProgress”bool isTickInProgress() constCheck if a tick is currently in progress.
Used to prevent overlapping ticks.
function id
Section titled “function id”inline virtual const char * id() const overrideReimplements: EntropyEngine::Core::EntropyService::id
function getActiveCameraViewProjection
Section titled “function getActiveCameraViewProjection”glm::mat4 getActiveCameraViewProjection() constGet the view-projection matrix from the active camera.
Returns identity matrix if no active camera.
function getActiveCameraView
Section titled “function getActiveCameraView”glm::mat4 getActiveCameraView() constGet just the view matrix from the active camera.
function getActiveCameraProjection
Section titled “function getActiveCameraProjection”glm::mat4 getActiveCameraProjection() constGet just the projection matrix from the active camera.
function getActiveCameraPosition
Section titled “function getActiveCameraPosition”glm::vec3 getActiveCameraPosition() constGet the world position of the active camera.
function getActiveCamera
Section titled “function getActiveCamera”std::optional< flecs::entity > getActiveCamera() constGet the active camera entity.
function forEachRenderable
Section titled “function forEachRenderable”template <typename Func >inline void forEachRenderable( Func && func)Iterate all entities with Transform and MeshComponent.
function forEachLight
Section titled “function forEachLight”template <typename Func >inline void forEachLight( Func && func)Iterate all entities with Transform and Light.
function forEachCamera
Section titled “function forEachCamera”template <typename Func >inline void forEachCamera( Func && func)Iterate all entities with Transform and CameraComponent.
function externalTransformRegistry
Section titled “function externalTransformRegistry”inline ExternalTransformRegistry & externalTransformRegistry()Get the external transform registry for low-latency transform sources.
function externalTransformRegistry
Section titled “function externalTransformRegistry”inline const ExternalTransformRegistry & externalTransformRegistry() constfunction entityCount
Section titled “function entityCount”size_t entityCount() constGet entity count.
function destroyEntity
Section titled “function destroyEntity”void destroyEntity( flecs::entity entity)Destroy an entity.
function dataProvider
Section titled “function dataProvider”inline IDataProvider * dataProvider() constGet the current data provider.
function createEntity
Section titled “function createEntity”flecs::entity createEntity( const char * name =nullptr)Create a new entity with an optional name.
function createEntity
Section titled “function createEntity”flecs::entity createEntity( const Transform & transform, const char * name =nullptr)Create an entity with Transform component.
function createCamera
Section titled “function createCamera”flecs::entity createCamera( const Transform & transform, const CameraComponent & camera, const char * name =nullptr)Create a camera entity with Transform and CameraComponent.
function commandQueue
Section titled “function commandQueue”inline SimulationCommandQueue & commandQueue()Get the command queue for external systems to submit flecs mutations.
Thread-safe: can be called from any thread.
function applySnapshot
Section titled “function applySnapshot”void applySnapshot( const SceneSnapshot & snapshot)Apply a scene snapshot (full scene replacement).
function applyDelta
Section titled “function applyDelta”void applyDelta( const PropertyDelta & delta)Apply a property delta (single property change).
function SceneService
Section titled “function SceneService”SceneService()Construct with default SceneGraph (created on load).
function SceneService
Section titled “function SceneService”explicit SceneService( std::unique_ptr< ISceneGraph > sceneGraph)Construct with injected ISceneGraph implementation.
Parameters:
- sceneGraph ISceneGraph implementation (e.g., PersistentSceneGraph)
Takes ownership of the scene graph.
function SceneService
Section titled “function SceneService”SceneService( const SceneService &) =deleteUpdated on 2026-01-26 at 17:14:35 -0500