class RendererScene

Inherits: CoreObject

Contains information about the scene (e.g. renderables, lights, cameras) required by the renderer.

Public

Methods

~RendererScene

~RendererScene() noexcept override

staticCreate

static SPtr<RendererScene> Create()

Creates a new renderer scene.

AllocateRenderableId

RendererId AllocateRenderableId(ecs::Registry &registry, ecs::Entity entity)

Allocates a persistent render object ID for a renderable and adds the ecs::RenderableId fragment.

DeallocateRenderableId

void DeallocateRenderableId(ecs::Registry &registry, ecs::Entity entity)

Removes the ecs::RenderableId fragment and deallocates the persistent render object ID.

AllocateLightId

RendererId AllocateLightId(ecs::Registry &registry, ecs::Entity entity)

Allocates a persistent render object ID for a light and adds the ecs::LightId fragment.

DeallocateLightId

void DeallocateLightId(ecs::Registry &registry, ecs::Entity entity)

Removes the ecs::LightId fragment and deallocates the persistent render object ID.

AllocateDecalId

RendererId AllocateDecalId(ecs::Registry &registry, ecs::Entity entity)

Allocates a persistent render object ID for a decal and adds the ecs::DecalId fragment.

DeallocateDecalId

void DeallocateDecalId(ecs::Registry &registry, ecs::Entity entity)

Removes the ecs::DecalId fragment and deallocates the persistent render object ID.

AllocateParticleSystemId

RendererId AllocateParticleSystemId(ecs::Registry &registry, ecs::Entity entity)

Allocates a persistent render object ID for a particle system and adds the ecs::ParticleSystemId fragment.

DeallocateParticleSystemId

void DeallocateParticleSystemId(ecs::Registry &registry, ecs::Entity entity)

Removes the ecs::ParticleSystemId fragment and deallocates the persistent render object ID.

AllocateReflectionProbeId

RendererId AllocateReflectionProbeId(ecs::Registry &registry, ecs::Entity entity)

Allocates a persistent render object ID for a reflection probe and adds the ecs::ReflectionProbeId fragment.

DeallocateReflectionProbeId

void DeallocateReflectionProbeId(ecs::Registry &registry, ecs::Entity entity)

Removes the ecs::ReflectionProbeId fragment and deallocates the persistent render object ID.

GetReflectionProbeStorage

const SPtr<ReflectionProbeObjectStorageBase> &GetReflectionProbeStorage() const

Returns the reflection probe object storage for this scene.

SetOwner

void SetOwner(const SPtr<SceneInstance> &scene)

Sets the owning SceneInstance and subscribes to OnWillRemove events for automatic cleanup of renderer IDs and dirty tags when data fragments are removed from entities.

SyncToRenderThread

void SyncToRenderThread(ecs::Registry &registry, FrameAllocator &allocator)

Reads dirty ECS data on the main thread and posts a command to write the changes to the render thread, for all RenderableObjectStorage objects.

Protected

Methods

Initialize

void Initialize() override

Initializes all the internal data of this object.

Must be called right after construction for new objects, or after deserialization for deserialized objects. If requested, render proxy is created and queued for initialization on the render thread.

CreateRenderProxy

SPtr<render::RenderProxy> CreateRenderProxy() const override

Creates an object that contains render thread specific data and methods for this object.

Can be null if such object is not required.

SyncRead

RendererSceneSyncData *SyncRead(ecs::Registry &registry, FrameAllocator &allocator)

Reads dirty ECS data for all sync handlers in this scene into a frame-allocated RendererSceneSyncData.

Returns nullptr if no data is dirty.

Private

Fields

mOwner

WeakSPtr<SceneInstance> mOwner

mDecalStorage

SPtr<DecalObjectStorageBase> mDecalStorage

mRenderableStorage

SPtr<RenderableObjectStorageBase> mRenderableStorage

mLightStorage

SPtr<LightObjectStorageBase> mLightStorage

mParticleSystemStorage

SPtr<ParticleSystemObjectStorageBase> mParticleSystemStorage

mReflectionProbeStorage

SPtr<ReflectionProbeObjectStorageBase> mReflectionProbeStorage

mLightRemovedHandle

THEvent<ThreadUnsafe> mLightRemovedHandle

mRenderableRemovedHandle

THEvent<ThreadUnsafe> mRenderableRemovedHandle

mDecalRemovedHandle

THEvent<ThreadUnsafe> mDecalRemovedHandle

mParticleSystemRemovedHandle

THEvent<ThreadUnsafe> mParticleSystemRemovedHandle

mReflectionProbeRemovedHandle

THEvent<ThreadUnsafe> mReflectionProbeRemovedHandle