Skip to main content

RenderableComponent Class

Component that holds a shared pointer to a Renderable resource. More...

Declaration

class helios::engine::modules::rendering::renderable::components::RenderableComponent { ... }

Public Constructors Index

RenderableComponent (std::shared_ptr< helios::rendering::Renderable > renderable)

Constructs a RenderableComponent. More...

RenderableComponent (const RenderableComponent &other)

Copy constructor. More...

RenderableComponent (RenderableComponent &&) noexcept=default

Move constructor. More...

Public Operators Index

RenderableComponent &operator= (const RenderableComponent &)=default

Copy assignment operator. More...

RenderableComponent &operator= (RenderableComponent &&) noexcept=default

Move assignment operator. More...

Public Member Functions Index

boolisEnabled () const noexcept

Checks whether this component is enabled. More...

voidenable () noexcept

Enables this component. More...

voiddisable () noexcept

Disables this component. More...

std::shared_ptr< helios::rendering::Renderable >shareRenderable () const noexcept

Retrieves a shared pointer to the stored Renderable. More...

const helios::rendering::Renderable &renderable () const noexcept

Retrieves a const ref to the stored Renderable. More...

Private Member Attributes Index

std::shared_ptr< helios::rendering::Renderable >renderable_

Shared pointer to the renderable resource. More...

helios::math::aabbfaabb_ {}

The initial AABB of the model associated with the renderable. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that holds a shared pointer to a Renderable resource.

This component links a GameObject to a visual representation (Renderable). When attached, it automatically extracts the AABB from the renderable's mesh and populates a ModelAabbComponent on the same GameObject.

Definition at line 30 of file RenderableComponent.ixx.

Public Constructors

RenderableComponent()

helios::engine::modules::rendering::renderable::components::RenderableComponent::RenderableComponent (std::shared_ptr< helios::rendering::Renderable > renderable)
inline explicit

Constructs a RenderableComponent.

Parameters
renderable

Shared pointer to the Renderable. Must not be nullptr.

Definition at line 77 of file RenderableComponent.ixx.

77 explicit RenderableComponent(std::shared_ptr<helios::rendering::Renderable> renderable) :
78 renderable_(std::move(renderable)) {
79
80 assert(renderable_ != nullptr && "renderable must not be nullptr");
81 aabb_ = renderable_->localAABB();
82
83 }

Reference renderable.

Referenced by operator=, operator=, RenderableComponent and RenderableComponent.

RenderableComponent()

helios::engine::modules::rendering::renderable::components::RenderableComponent::RenderableComponent (const RenderableComponent & other)
inline

Copy constructor.

Copies the shared pointer to the Renderable. Both components will reference the same Renderable resource (shared ownership).

Parameters
other

The component to copy from.

Definition at line 93 of file RenderableComponent.ixx.

94 renderable_(other.renderable_), aabb_(other.aabb_) {}

Reference RenderableComponent.

RenderableComponent()

helios::engine::modules::rendering::renderable::components::RenderableComponent::RenderableComponent (RenderableComponent &&)
noexcept default

Move constructor.

Definition at line 104 of file RenderableComponent.ixx.

Reference RenderableComponent.

Public Operators

operator=()

RenderableComponent & helios::engine::modules::rendering::renderable::components::RenderableComponent::operator= (const RenderableComponent &)
default

Copy assignment operator.

Definition at line 99 of file RenderableComponent.ixx.

Reference RenderableComponent.

operator=()

RenderableComponent & helios::engine::modules::rendering::renderable::components::RenderableComponent::operator= (RenderableComponent &&)
noexcept default

Move assignment operator.

Definition at line 109 of file RenderableComponent.ixx.

Reference RenderableComponent.

Public Member Functions

disable()

void helios::engine::modules::rendering::renderable::components::RenderableComponent::disable ()
inline noexcept

Disables this component.

Definition at line 68 of file RenderableComponent.ixx.

68 void disable() noexcept {
69 isEnabled_ = false;
70 }

enable()

void helios::engine::modules::rendering::renderable::components::RenderableComponent::enable ()
inline noexcept

Enables this component.

Definition at line 61 of file RenderableComponent.ixx.

61 void enable() noexcept {
62 isEnabled_ = true;
63 }

isEnabled()

bool helios::engine::modules::rendering::renderable::components::RenderableComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 54 of file RenderableComponent.ixx.

54 [[nodiscard]] bool isEnabled() const noexcept {
55 return isEnabled_;
56 }

renderable()

const helios::rendering::Renderable & helios::engine::modules::rendering::renderable::components::RenderableComponent::renderable ()
inline nodiscard noexcept

Retrieves a const ref to the stored Renderable.

Returns

Const ref to the Renderable (never null after construction).

Definition at line 127 of file RenderableComponent.ixx.

127 [[nodiscard]] const helios::rendering::Renderable& renderable() const noexcept {
128 return *renderable_;
129 }

Referenced by RenderableComponent.

shareRenderable()

std::shared_ptr< helios::rendering::Renderable > helios::engine::modules::rendering::renderable::components::RenderableComponent::shareRenderable ()
inline nodiscard noexcept

Retrieves a shared pointer to the stored Renderable.

Returns

Shared pointer to the Renderable.

Definition at line 118 of file RenderableComponent.ixx.

118 [[nodiscard]] std::shared_ptr<helios::rendering::Renderable> shareRenderable() const noexcept {
119 return renderable_;
120 }

Reference shareRenderable.

Referenced by helios::engine::builder::gameObject::builders::configs::SceneNodeConfig::parent, helios::engine::builder::gameObject::builders::configs::SceneNodeConfig::parent and shareRenderable.

Private Member Attributes

aabb_

helios::math::aabbf helios::engine::modules::rendering::renderable::components::RenderableComponent::aabb_ {}

The initial AABB of the model associated with the renderable.

Definition at line 40 of file RenderableComponent.ixx.

isEnabled_

bool helios::engine::modules::rendering::renderable::components::RenderableComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 45 of file RenderableComponent.ixx.

45 bool isEnabled_ = true;

renderable_

std::shared_ptr<helios::rendering::Renderable> helios::engine::modules::rendering::renderable::components::RenderableComponent::renderable_

Shared pointer to the renderable resource.

Definition at line 35 of file RenderableComponent.ixx.

35 std::shared_ptr<helios::rendering::Renderable> renderable_;

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.