![]() |
Lysa
0.0
Lysa 3D Engine
|
Manages per-frame scene data for rendering.
SceneFrameData handles the storage and update of scene-wide information, including cameras, lights, environment settings, and mesh instance data. It also manages descriptor sets and buffers required for rendering.
Classes | |
| struct | InstanceIndexConstant |
Public Member Functions | |
| SceneFrameData (uint32 maxLights, uint32 maxMeshInstancesPerScene, uint32 maxMeshSurfacePerPipeline) | |
| void | setEnvironment (const Environment &environment) |
| void | update (const vireo::CommandList &commandList, const Camera &camera, const RendererConfiguration &config, const vireo::Extent &extent, uint32 frameIndex) |
| void | compute (vireo::CommandList &commandList, const Camera &camera) const |
| void | addInstance (const MeshInstance *meshInstance) |
| void | updateInstance (const MeshInstance *meshInstance) |
| void | removeInstance (const MeshInstance *meshInstance) |
| void | addLight (const Light *light) |
| void | removeLight (const Light *light) |
| void | drawOpaquesModels (vireo::CommandList &commandList, const std::unordered_map< uint32, std::shared_ptr< vireo::GraphicPipeline >> &pipelines) const |
| void | drawTransparentModels (vireo::CommandList &commandList, const std::unordered_map< uint32, std::shared_ptr< vireo::GraphicPipeline >> &pipelines) const |
| void | drawShaderMaterialModels (vireo::CommandList &commandList, const std::unordered_map< uint32, std::shared_ptr< vireo::GraphicPipeline >> &pipelines) const |
| void | drawModels (vireo::CommandList &commandList, uint32 set, const std::map< pipeline_id, std::shared_ptr< vireo::Buffer >> &culledDrawCommandsBuffers, const std::map< pipeline_id, std::shared_ptr< vireo::Buffer >> &culledDrawCommandsCountBuffers, const std::map< pipeline_id, std::shared_ptr< FrustumCulling >> &frustumCullingPipelines) const |
| const auto & | getPipelineIds () const |
| auto | isMaterialsUpdated () const |
| void | resetMaterialsUpdated () |
| auto | getDescriptorSet () const |
| auto | getShadowMapRenderers () const |
| SceneFrameData (SceneFrameData &) = delete | |
| SceneFrameData & | operator= (SceneFrameData &) = delete |
Static Public Member Functions | |
| static void | createDescriptorLayouts () |
| static void | destroyDescriptorLayouts () |
Static Public Attributes | |
| static constexpr vireo::DescriptorIndex | BINDING_SCENE {0} |
| static constexpr vireo::DescriptorIndex | BINDING_MODELS {1} |
| static constexpr vireo::DescriptorIndex | BINDING_LIGHTS {2} |
| static constexpr vireo::DescriptorIndex | BINDING_SHADOW_MAPS {3} |
| static std::shared_ptr< vireo::DescriptorLayout > | sceneDescriptorLayout {nullptr} |
| static constexpr vireo::DescriptorIndex | BINDING_SHADOW_MAP_TRANSPARENCY_COLOR {0} |
| static constexpr auto | instanceIndexConstantDesc |
| SceneFrameData | ( | uint32 | maxLights, |
| uint32 | maxMeshInstancesPerScene, | ||
| uint32 | maxMeshSurfacePerPipeline | ||
| ) |
Constructs a new SceneFrameData object.
| maxLights | Maximum number of lights supported. |
| maxMeshInstancesPerScene | Maximum number of mesh instances per scene. |
| maxMeshSurfacePerPipeline | Maximum number of mesh surfaces per pipeline. |
|
delete |
| void addInstance | ( | const MeshInstance * | meshInstance | ) |
Adds a mesh instance to the scene.
| meshInstance | Pointer to the mesh instance to add. |
| void addLight | ( | const Light * | light | ) |
Adds a light to the scene.
| light | Pointer to the light to add. |
| void compute | ( | vireo::CommandList & | commandList, |
| const Camera & | camera | ||
| ) | const |
Executes compute workloads.
Performs operations such as frustum culling.
| commandList | Command buffer for GPU operations. |
| camera | The current camera. |
|
static |
Creates all static descriptor layouts used by scenes and pipelines.
|
static |
Destroys static descriptor layouts created by createDescriptorLayouts().
| void drawModels | ( | vireo::CommandList & | commandList, |
| uint32 | set, | ||
| const std::map< pipeline_id, std::shared_ptr< vireo::Buffer >> & | culledDrawCommandsBuffers, | ||
| const std::map< pipeline_id, std::shared_ptr< vireo::Buffer >> & | culledDrawCommandsCountBuffers, | ||
| const std::map< pipeline_id, std::shared_ptr< FrustumCulling >> & | frustumCullingPipelines | ||
| ) | const |
Issues multi-draw indirect calls for models.
| commandList | Command buffer to record into. |
| set | Descriptor set index. |
| culledDrawCommandsBuffers | Map of buffers containing indirect draw commands. |
| culledDrawCommandsCountBuffers | Map of buffers containing indirect draw counts. |
| frustumCullingPipelines | Map of frustum culling pipelines. |
| void drawOpaquesModels | ( | vireo::CommandList & | commandList, |
| const std::unordered_map< uint32, std::shared_ptr< vireo::GraphicPipeline >> & | pipelines | ||
| ) | const |
Issues draw calls for opaque models.
| commandList | Command buffer to record into. |
| pipelines | Map of material/pipeline identifiers to pipelines. |
| void drawShaderMaterialModels | ( | vireo::CommandList & | commandList, |
| const std::unordered_map< uint32, std::shared_ptr< vireo::GraphicPipeline >> & | pipelines | ||
| ) | const |
Issues draw calls for models driven by shader materials/special passes.
| commandList | Command buffer to record into. |
| pipelines | Map of material/pipeline identifiers to pipelines. |
| void drawTransparentModels | ( | vireo::CommandList & | commandList, |
| const std::unordered_map< uint32, std::shared_ptr< vireo::GraphicPipeline >> & | pipelines | ||
| ) | const |
Issues draw calls for transparent models.
| commandList | Command buffer to record into. |
| pipelines | Map of material/pipeline identifiers to pipelines. |
|
inline |
Returns the main descriptor set.
|
inline |
Returns the mapping of pipeline identifiers to their materials.
|
inline |
Returns the shadow map renderers.
|
inline |
Checks if materials have been updated.
|
delete |
| void removeInstance | ( | const MeshInstance * | meshInstance | ) |
Removes a mesh instance from the scene.
| meshInstance | Pointer to the mesh instance to remove. |
| void removeLight | ( | const Light * | light | ) |
Removes a light from the scene.
| light | Pointer to the light to remove. |
|
inline |
Resets the materials updated flag.
|
inline |
Sets the scene's environment settings.
| environment | The environment to set (e.g., skybox, ambient lighting). |
| void update | ( | const vireo::CommandList & | commandList, |
| const Camera & | camera, | ||
| const RendererConfiguration & | config, | ||
| const vireo::Extent & | extent, | ||
| uint32 | frameIndex | ||
| ) |
Updates CPU/GPU scene state.
Synchronizes uniforms, lights, instances, and descriptors for the current frame.
| commandList | Command buffer for GPU operations. |
| camera | The current camera. |
| config | Renderer configuration. |
| extent | Current render target extent |
| frameIndex | Index of the current frame. |
| void updateInstance | ( | const MeshInstance * | meshInstance | ) |
Updates an existing mesh instance in the scene.
| meshInstance | Pointer to the mesh instance to update. |
|
staticconstexpr |
Descriptor binding for lights buffer.
|
staticconstexpr |
Descriptor binding for per-model/instance data buffer.
|
staticconstexpr |
Descriptor binding for SceneData uniform buffer.
|
staticconstexpr |
Optional descriptor binding: transparency color for shadow maps.
|
staticconstexpr |
Descriptor binding for shadow maps array.
|
staticconstexpr |
Push constants description for the instance index.
|
inlinestatic |
Shared descriptor layout for the main scene set.