Classes

Scene/Components

Brief descriptions

Structures

nau::scene_internal::ComponentListNode

nau::scene::IComponentUpdate

Provides an interface for component per-frame update.

nau::scene::IComponentAsyncUpdate

Provides an interface for component per-frame asynchronous update.

nau::scene::IComponentActivation

Provides an interface for component activation & deactivation.

nau::scene::IComponentEvents

Provides an interface for events that are triggered during the component lifecycle.

nau::scene_internal::TransformListNode

Classes

nau::scene::Component

nau::scene::SceneComponent

Detailed information

scene_internal::ComponentListNode

engine/core/modules/scene/include/nau/scene/components/component.h

struct ComponentListNode : public eastl::intrusive_list_node

Subclassed by nau::scene::Component


scene::IComponentUpdate

engine/core/modules/scene/include/nau/scene/components/component_life_cycle.h

struct IComponentUpdate

Provides an interface for component per-frame update.

See also: IComponentAsyncUpdate.

Subclassed by nau::NetSceneComponent, nau::NetSyncBaseComponent, nau::SkeletonSocketComponent, nau::animation::AnimationComponent, nau::animation::AnimationManager, nau::physics::RigidBodyComponent

Public Functions

virtual ~IComponentUpdate() = default

Destructor.

virtual void updateComponent(float dt) = 0

Updates the component.

Warning

The update loop waits for all IComponentUpdate::updateComponent and IComponentAsyncUpdate::updateComponentAsync calls completion, until it can proceed to the next frame. Consequently, all lasting operations are to be avoided within these calls. Instead, address to IComponentAsyncListener::listenComponent.

Parameters:

[int] – dt Elapsed time.


scene::IComponentAsyncUpdate

engine/core/modules/scene/include/nau/scene/components/component_life_cycle.h

struct IComponentAsyncUpdate

Provides an interface for component per-frame asynchronous update.

See also: IComponentUpdate.

Public Functions

virtual ~IComponentAsyncUpdate() = default

Destructor.

virtual async::Task updateComponentAsync(float dt) = 0

Schedules the component update operation.

Warning

The update loop waits for all IComponentUpdate::updateComponent and IComponentAsyncUpdate::updateComponentAsync calls completion, until it can proceed to the next frame. Consequently, all lasting operations are to be avoided within these calls. Instead, address to IComponentAsyncListener::listenComponent.

Parameters:

dt[in] Elapsed time.

Returns:

Task object that provides the operation status.


scene::IComponentActivation

engine/core/modules/scene/include/nau/scene/components/component_life_cycle.h

struct IComponentActivation

Provides an interface for component activation & deactivation.

See also: IComponentAsyncActivation.

Subclassed by nau::animation::AnimationComponent, nau::ui::UiComponent

Public Functions

virtual ~IComponentActivation() = default

Destructor.

inline virtual void activateComponent()

Activates the component.

inline virtual async::Task activateComponentAsync()
inline virtual void deactivateComponent()

Deactivates the component.


scene::IComponentEvents

engine/core/modules/scene/include/nau/scene/components/component_life_cycle.h

struct IComponentEvents

Provides an interface for events that are triggered during the component lifecycle.

Subclassed by nau::NetSceneComponent, nau::NetSyncBaseComponent, nau::animation::AnimationComponent, nau::animation::AnimationManager, nau::ui::UiComponent

Public Functions

virtual ~IComponentEvents() = default

Destructor.

inline virtual void onComponentCreated()

This function is called on component creation.

inline virtual void onComponentActivated()

This function is called on component activation.

inline virtual void onComponentDeactivated()

This function is called on component deactivation.

inline virtual void onComponentDestroyed()

This function is called on component destruction.

inline virtual void onAfterComponentRestored()

This function is called when a scene containing the component is created from an asset.


scene_internal::TransformListNode

engine/core/modules/scene/include/nau/scene/components/scene_component.h

struct TransformListNode : public eastl::intrusive_list_node

Subclassed by nau::scene::SceneComponent

scene::Component

engine/core/modules/scene/include/nau/scene/components/component.h

class Component : public nau::scene::NauObject, public DynamicObjectImpl, private nau::scene_internal::ComponentListNode

Subclassed by nau::NetSceneComponent, nau::NetSyncBaseComponent, nau::scene::DirectionalLightComponent, nau::scene::EnvironmentComponent, nau::scene::SceneComponent

Public Functions

~Component()
virtual void destroy() final

Detaches the component from the parent object and the scene and destroys it.

SceneObject &getParentObject() const

Retrieves the object which this component is attached to.

Note

It is assumed that a component always has an owner object.

bool isOperable() const

Checks whether the component is operable.

Note

A component is alive when it is attached to the scene hierarchy. However, it is possible that after deleting a component, when the component is still active, the system is waiting for the completion of asynchronous operations associated with this component, meanwhile any interaction between the component and scene is impossible since it has been deleted. For such cases, it is necessary to check the state of the component via this method.

ActivationState getActivationState() const

Protected Functions

Component()
Component(const Component&) = delete
Component &operator=(const Component&) = delete
template<typename Callable, typename ...Args>
void runAsync(Callable callable, Args&&... args)

Schedules a callable for an asynchronous call.

Template Parameters:
  • Callable – Callable type.

  • Args – Parameter pack for the callable.

Parameters:
  • callable[in] Functor object or a pointer to the function to schedule.

  • args[in] Arguments for callable call.

template<typename T>
void trackAsyncOperation(async::Task<T> &&task)

Pushes the (active) task into the list of asynchronous operations of the component.

The component are not actually deleted until all tracked operations have been completed.

Template Parameters:

T – Task return value type.

Parameters:

task[in] Task to schedule.

virtual void onBeforeDeleteObject() override

Protected Attributes

SceneObject *m_parentObject = nullptr
ActivationState m_activationState = ActivationState::Inactive
async::TaskCollection m_asyncTasks

Private Functions

void addRef() final
void releaseRef() final
nau::IWeakRef *getWeakRef() final
uint32_t getRefsCount() const final
void changeActivationState(ActivationState newState)
async::Task finalizeAsyncOperations()

Flushes all async tasks associated with the object.

Returns:

Task object, which can provide finalization status.

void onThisValueChanged(std::string_view key) final

Private Members

NauObject
SceneManagerImpl *m_sceneManager = nullptr
friend SceneObject

Friends

friend class SceneManagerImpl

scene::SceneComponent

engine/core/modules/scene/include/nau/scene/components/scene_component.h

class SceneComponent : public nau::scene::Component, public virtual nau::scene::TransformControl, private nau::scene_internal::TransformListNode

Subclassed by nau::SkeletonComponent, nau::SkeletonSocketComponent, nau::SkinnedMeshComponent, nau::animation::AnimationComponent, nau::animation::AnimationManager, nau::physics::RigidBodyComponent, nau::scene::BillboardComponent, nau::scene::CameraComponent, nau::scene::OmnilightComponent, nau::scene::SpotlightComponent, nau::scene::StaticMeshComponent, nau::ui::UiComponent

Public Functions

SceneComponent() = default
SceneComponent(const SceneComponent&) = delete
SceneComponent &operator=(const SceneComponent&) = delete
virtual const math::Transform &getWorldTransform() const final

Retrieves object world transformation.

Returns:

Object transformation in world coordinates.

virtual void setWorldTransform(const math::Transform &transform) final

Sets object transform in world coordinates.

Parameters:

transform[in] Transform to assign.

virtual const math::Transform &getTransform() const final

Retrieves object local transformation.

Returns:

Object transformation with respect to its parent.

virtual void setTransform(const math::Transform &transform) final

Sets object transform relative to its parent.

Parameters:

transform[in] Transform to assign.

virtual void setRotation(math::quat rotation) final

Setting the rotation quaternion of the component relative to its parent.

virtual void setTranslation(math::vec3 position) final

Setting the position of the component relative to its parent.

virtual void setScale(math::vec3 scale) final

Setting the scale of the component relative to its parent.

virtual math::quat getRotation() const final

Retrieves object local rotation.

Returns:

Object rotation with respect to its parent.

virtual math::vec3 getTranslation() const final

Retrieves object local translation.

Returns:

Object translation with respect to its parent.

virtual math::vec3 getScale() const final

Retrieves object local scale.

Returns:

Object scale with respect to its parent.

Protected Functions

virtual void notifyTransformChanged()
virtual void notifyTransformChanged(const math::Transform &worldTransformCache)

Protected Attributes

math::Transform m_transform
mutable eastl::optional<math::Transform> m_worldTransformCache

Private Functions

Scene Scene Component (description)")) ( 1(m_transform
void appendTransformChild(SceneComponent &child)
void removeTransformChild(SceneComponent &child)

Private Members

SystemComponentAttrib
true
ComponentDisplayNameAttrib
Scene Component
Scene ComponentDescriptionAttrib
SceneComponent *m_transformParent = nullptr
eastl::intrusive_list<scene_internal::TransformListNode> m_transformChildren

Friends

friend class SceneObject