![]() |
Lysa
0.0
Lysa 3D Engine
|
Scene orchestrator.
Thread-safety: unless stated otherwise, methods are intended to be called only from the render thread.
Classes | |
| struct | InstanceIndexConstant |
| struct | PipelineData |
Public Member Functions | |
| Scene (const SceneConfiguration &config, const RenderingConfiguration &renderingConfig, uint32 framesInFlight, const vireo::Viewport &viewport, const vireo::Rect &scissors) | |
| auto | getCurrentCamera () const |
| auto | getViewport () const |
| auto | getScissors () const |
| virtual void | addNode (const std::shared_ptr< Node > &node) |
| virtual void | removeNode (const std::shared_ptr< Node > &node) |
| virtual void | activateCamera (const std::shared_ptr< Camera > &camera) |
| void | update (const vireo::CommandList &commandList) |
| void | compute (vireo::CommandList &commandList) const |
| void | setInitialState (const vireo::CommandList &commandList) const |
| 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 | getDescriptorSetOptional1 () const |
| auto | getShadowMapRenderers () const |
| virtual | ~Scene () = default |
| Scene (Scene &) = delete | |
| Scene & | operator= (Scene &) = delete |
Static Public Member Functions | |
| static void | createDescriptorLayouts () |
| static void | destroyDescriptorLayouts () |
Static Public Attributes | |
| static constexpr uint32 | MAX_SHADOW_MAPS {20} |
| 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 std::shared_ptr< vireo::DescriptorLayout > | sceneDescriptorLayoutOptional1 {nullptr} |
| static constexpr vireo::DescriptorIndex | BINDING_INSTANCES {0} |
| static std::shared_ptr< vireo::DescriptorLayout > | pipelineDescriptorLayout {nullptr} |
| static constexpr auto | instanceIndexConstantDesc |
| Scene | ( | const SceneConfiguration & | config, |
| const RenderingConfiguration & | renderingConfig, | ||
| uint32 | framesInFlight, | ||
| const vireo::Viewport & | viewport, | ||
| const vireo::Rect & | scissors | ||
| ) |
Constructs a Scene for a given configuration and viewport/scissors.
| config | Scene high-level configuration (buffers sizes, features). |
| renderingConfig | Global rendering configuration. |
| framesInFlight | Number of buffered frames. |
| viewport | Default viewport used for render passes. |
| scissors | Default scissors rectangle. |
|
virtualdefault |
|
delete |
|
virtual |
Activates the provided camera as the current rendering viewpoint.
|
virtual |
Adds a node (camera, light, mesh instance, environment, etc.) to the scene.
| void compute | ( | vireo::CommandList & | commandList | ) | const |
Executes compute workloads such as frustum culling.
|
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 |
Common draw helper that dispatches indirect draws per pipeline using culled lists.
| commandList | Command buffer to record into. |
| set | Descriptor set index to bind for the pipelines family. |
| culledDrawCommandsBuffers | Per-pipeline indirect commands buffer. |
| culledDrawCommandsCountBuffers | Per-pipeline commands count buffer. |
| frustumCullingPipelines | Per-pipeline frustum culling compute pipelines. |
| void drawOpaquesModels | ( | vireo::CommandList & | commandList, |
| const std::unordered_map< uint32, std::shared_ptr< vireo::GraphicPipeline >> & | pipelines | ||
| ) | const |
Issues draw calls for opaque models using the supplied pipelines map.
| 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.
| void drawTransparentModels | ( | vireo::CommandList & | commandList, |
| const std::unordered_map< uint32, std::shared_ptr< vireo::GraphicPipeline >> & | pipelines | ||
| ) | const |
Issues draw calls for transparent models.
|
inline |
Returns the currently active camera (may be null).
|
inline |
Returns the main descriptor set containing scene resources.
|
inline |
Returns the optional descriptor set (transparency color for shadows).
|
inline |
Returns the mapping of pipeline identifiers to their materials.
|
inline |
Returns the default scissors rectangle for this scene.
|
inline |
Returns a view over the shadow map renderers values.
|
inline |
Returns the default viewport for this scene.
|
inline |
True when materials set changed and pipelines/descriptors must be refreshed.
|
delete |
|
virtual |
Removes a node previously added to the scene.
|
inline |
Resets the materials updated flag after processing.
| void setInitialState | ( | const vireo::CommandList & | commandList | ) | const |
Writes initial GPU state required before issuing draw calls.
| void update | ( | const vireo::CommandList & | commandList | ) |
Updates CPU/GPU scene state (uniforms, lights, instances, descriptors).
|
staticconstexpr |
Descriptor binding for per-instance buffer used by pipelines.
|
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 |
|
staticconstexpr |
Maximum number of shadow maps supported by the scene.
|
inlinestatic |
Shared descriptor layout for pipeline-local resources.
|
inlinestatic |
Shared descriptor layout for the main scene set.
|
inlinestatic |
Optional descriptor layout (set used when transparency color is needed).