MeshRenderable.ixx File
Representative of a configurable MeshRenderable rendered by the underlying GL API. More...
Included Headers
#include <memory>
#include <optional>
#include <stdexcept>
#include <helios.util.log.LogManager>
#include <helios.util.log.Logger>
#include <helios.rendering.RenderPrototype>
#include <helios.rendering.material.MaterialShaderPropertiesOverride>
#include <helios.rendering.RenderQueue>
#include <helios.rendering.Renderable>
#include <helios.rendering.shader.UniformValueMap>
#include <helios.rendering.mesh.MeshRenderCommand>
Namespaces Index
| namespace | helios |
| namespace | rendering |
|
Graphics rendering infrastructure. More... | |
| namespace | mesh |
Classes Index
| class | MeshRenderable |
|
Represents a renderable object that combines a shared prototype with instance-specific overrides. More... | |
Macro Definitions Index
| #define | HELIOS_LOG_SCOPE "helios::rendering::MeshRenderable" |
Description
Representative of a configurable MeshRenderable rendered by the underlying GL API.
Macro Definitions
HELIOS_LOG_SCOPE
|
Definition at line 24 of file MeshRenderable.ixx.
24#define HELIOS_LOG_SCOPE "helios::rendering::MeshRenderable"
File Listing
The file content with the documentation metadata removed is:
24#define HELIOS_LOG_SCOPE "helios::rendering::MeshRenderable"
25export namespace helios::rendering::mesh {
29 * @brief Represents a renderable object that combines a shared prototype with instance-specific overrides.
37 * - **Shared Prototype:** Multiple `MeshRenderable` instances can reference the same `RenderPrototype`.
73 class MeshRenderable final : public helios::rendering::Renderable {
80 std::shared_ptr<const helios::rendering::RenderPrototype> renderPrototype_ = nullptr;
83 * @brief The MaterialShaderPropertiesOverride owned by this class. This will be std::nullopt if not
86 std::optional<helios::rendering::material::MaterialShaderPropertiesOverride> materialOverride_;
91 inline static const helios::util::log::Logger& logger_ = helios::util::log::LogManager::loggerForScope(HELIOS_LOG_SCOPE);
97 MeshRenderable() = delete;
102 MeshRenderable(const MeshRenderable&) = delete;
107 MeshRenderable& operator=(const MeshRenderable&)= delete;
112 MeshRenderable(MeshRenderable&&) noexcept = default;
117 MeshRenderable& operator=(MeshRenderable&&) noexcept = default;
122 * @param renderPrototype A shared pointer to the immutable RenderPrototype definition. Must not be nullptr.
124 * If std::nullopt, the MeshRenderable uses only the default properties from the RenderPrototype's Material.
128 explicit MeshRenderable(
129 std::shared_ptr<const helios::rendering::RenderPrototype> renderPrototype,
130 const std::optional<helios::rendering::material::MaterialShaderPropertiesOverride>& materialOverride = std::nullopt
132 renderPrototype_(std::move(renderPrototype)),
136 if (!renderPrototype_) {
138 logger_.error(msg);
150 [[nodiscard]] std::shared_ptr<const helios::rendering::RenderPrototype> shareRenderPrototype() const noexcept {
151 return renderPrototype_;
162 [[nodiscard]] const helios::rendering::RenderPrototype* renderPrototype() const noexcept {
163 return renderPrototype_.get();
167 * @brief Returns a const reference to the optional instance-specific MaterialShaderPropertiesOverride.
175 [[nodiscard]] const std::optional<helios::rendering::material::MaterialShaderPropertiesOverride>& materialOverride() const noexcept {
176 return materialOverride_;
180 * @brief Returns a non-const reference to the optional instance-specific MaterialShaderPropertiesOverride.
183 * it can be assigned to or `.emplace()` can be used to create a new MaterialShaderPropertiesOverride.
187 [[nodiscard]] std::optional<helios::rendering::material::MaterialShaderPropertiesOverride>& materialOverride() noexcept {
188 return materialOverride_;
192 * @brief Returns true if this MeshRenderable was configured with a MaterialShaderPropertiesOverride.
194 * @return True if this MeshRenderable was configured with a MaterialShaderPropertiesOverride instance, otherwise false.
196 [[nodiscard]] bool hasMaterialOverride() const noexcept {
197 return materialOverride_.has_value();
207 [[nodiscard]] const helios::math::aabbf& localAABB() const noexcept override {
208 return renderPrototype_->mesh().aabb();
215 * then overlays any specific overrides provided by this instance's MaterialShaderPropertiesOverride.
219 void writeUniformValues(helios::rendering::shader::UniformValueMap& uniformValueMap) const noexcept override {
220 renderPrototype_->material().writeUniformValues(uniformValueMap);
222 if (materialOverride_) {
223 materialOverride_->writeUniformValues(uniformValueMap);
235 * @param materialUniformValues Material uniform values (will be merged with material properties).
238 helios::rendering::RenderQueue& renderQueue,
239 helios::rendering::shader::UniformValueMap& objectUniformValues,
240 helios::rendering::shader::UniformValueMap& materialUniformValues) const override {
242 writeUniformValues(materialUniformValues);
244 renderQueue.add(helios::rendering::mesh::MeshRenderCommand(
245 renderPrototype_.get(),
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.