Classes

Scene

Brief descriptions

Structures

nau::scene::IScene

Encapsulates a scene and all objects associated with it.

nau::scene::ISceneFactory

nau::scene_internal::ISceneFactoryInternal

The API is solely intended for use in test projects only.

nau::scene::ISceneManager

Provides interface for managing scenes and worlds.

nau::scene::IComponentsActivator

Provides interface for activating & deactivating components.

nau::scene::DeactivatedComponentData

Deactivated component data for async handlers.

nau::scene::IComponentsAsyncActivator

Provides interface for asynchronously activating & deactivating components.

nau::scene::ISceneProcessor

nau::scene::SceneQuery

nau::scene::TransformProperties

Provides interface for read-only access to the object transform properties.

nau::scene::TransformControl

Provides interface for read&write access to the object transform properties.

nau::scene::IWorld

nau::scene::ICameraProperties

nau::scene::ICameraControl

nau::scene::CameraProperties

nau::scene::ICameraManager

Camera management API

nau::scene::IMissingComponent

Detailed information

scene::IScene

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

struct IScene : public nau::scene::NauObject

Encapsulates a scene and all objects associated with it.

Public Types

using Ptr = ObjectUniquePtr<IScene>
using WeakRef = ObjectWeakRef<IScene>

Public Functions

virtual eastl::string_view getName() const = 0

Retrieves the name of the scene.

Returns:

Name of the scene.

virtual void setName(eastl::string_view name) = 0

Assigns the name to the scene.

Parameters:

name[in] Name to assign.

virtual IWorld *getWorld() const = 0

Retrieves the world which the scene is associated with.

Returns:

A pointer to the retrieved world.

virtual SceneObject &getRoot() const = 0

Retrives the sceneroot object.

Returns:

A reference to the scene root object.


scene::ISceneFactory

engine/core/modules/scene/include/nau/scene/scene_factory.h

struct ISceneFactory

Public Functions

virtual ~ISceneFactory() = default
virtual IScene::Ptr createEmptyScene() = 0
virtual IScene::Ptr createSceneFromAsset(const SceneAsset &sceneAsset, CreateSceneOptionFlag options = {}) = 0
virtual SceneObject::Ptr createSceneObjectFromAsset(const SceneAsset &sceneAsset) = 0
virtual SceneObject::Ptr createSceneObject(const rtti::TypeInfo *rootComponentType = nullptr, const eastl::span<const rtti::TypeInfo*> components = {}) = 0
template<std::derived_from<SceneComponent> ComponentType, std::derived_from<Component>... MoreComponents>
inline ObjectUniquePtr<SceneObject> createSceneObject()

scene_internal::ISceneFactoryInternal

engine/core/modules/scene/include/nau/scene/scene_factory.h

struct ISceneFactoryInternal

The API is solely intended for use in test projects only.

Public Functions

virtual ~ISceneFactoryInternal() = default
virtual scene::SceneObject::Ptr createSceneObjectFromAssetWithOptions(const SceneAsset &sceneAsset, scene::CreateSceneOptionFlag options) = 0

same as ISceneFactory::createSceneObjectFromAsset, but allow to specify option flags (to test object copying with no uid overriding)


scene::ISceneManager

engine/core/modules/scene/include/nau/scene/scene_manager.h

struct ISceneManager

Provides interface for managing scenes and worlds.

Public Functions

virtual ~ISceneManager() = default

Destructor.

virtual IWorld &getDefaultWorld() const = 0

Retrieves the default game world.

The default world always exists: it is created automatically and can not be removed.

virtual Vector<IWorld::WeakRef> getWorlds() const = 0

Retrives all worlds including the default one.

virtual IWorld::WeakRef findWorld(Uid worldUid) const = 0
virtual IWorld::WeakRef createWorld() = 0

Creates a new world.

virtual void destroyWorld(IWorld::WeakRef world) = 0

Destroys the world object and deactivates all scenes associated with it. The function will wait until operation is complete.

Note

The function may be called multiple times over the same world. The second and the following calls will just wait until the operation is complete.

Parameters:

A[in] pointer to the world object to destroy.

virtual Vector<IScene::WeakRef> getActiveScenes() const = 0

Retrieves all active scenes associated with the default world.

See also: IWorld::getScenes and getDefaultWorld.

Returns:

A vector of all active scenes of the default world.

virtual async::Task<IScene::WeakRef> activateScene(IScene::Ptr &&scene) = 0

Makes the scene active withing the context of the default world.

Note

Calling this renders input scene pointer empty.

Parameters:

scene[in] Scene to activate.

Returns:

Task object providing the operation status as well as access to the resulted scene.

virtual void deactivateScene(IScene::WeakRef sceneRef) = 0

Detaches the scene from the associated world and destroys all the contained objects. This function waits until the operation is complete.

Note

The function may be called multiple times over the same scene. The second and the following calls will just wait until the operation is complete.

Parameters:

sceneRef[in] Scene to deactivate.

virtual ObjectWeakRef querySingleObject(const SceneQuery &query) = 0

scene::IComponentsActivator

engine/core/modules/scene/include/nau/scene/scene_processor.h

struct IComponentsActivator

Provides interface for activating & deactivating components.

Public Functions

inline virtual Result activateComponents(Uid worldUid, eastl::span<Component*> components)
inline virtual void deactivateComponents(Uid worldUid, eastl::span<Component*> components)

scene::DeactivatedComponentData

engine/core/modules/scene/include/nau/scene/scene_processor.h

struct DeactivatedComponentData

Deactivated component data for async handlers. When component (or owner object) is going to be deactivated it.

Public Members

const Component *component
Uid componentUid
Uid parentObjectUid
Uid sceneUid
Uid worldUid

scene::IComponentsAsyncActivator

engine/core/modules/scene/include/nau/scene/scene_processor.h

struct IComponentsAsyncActivator

Provides interface for asynchronously activating & deactivating components.

Subclassed by nau::animation::AnimationSceneProcessor

Public Functions

inline virtual async::Task activateComponentsAsync(Uid worldUid, eastl::span<const Component*> components, async::Task<> barrier)

Asynchronously activates components.

Parameters:
  • components[in] A collection of components to activate.

  • barrier[in]

Returns:

Task object providing status of the operation.

inline virtual async::Task deactivateComponentsAsync(Uid worldUid, eastl::span<const DeactivatedComponentData> components)

Asynchronously deactivates components.

Parameters:

components[in] A collection of components to deactivate.

Returns:

Task object providing status of the operation.


scene::ISceneProcessor

engine/core/modules/scene/include/nau/scene/scene_processor.h

struct ISceneProcessor : public virtual IRttiObject

Subclassed by nau::animation::AnimationSceneProcessor

Public Functions

virtual nau::scene::ISceneProcessor void syncSceneState ()=0

scene::SceneQuery

engine/core/modules/scene/include/nau/scene/scene_query.h

struct SceneQuery

Public Functions

SceneQuery() = default
SceneQuery(QueryObjectCategory inCategory, Uid inUid = NullUid)
SceneQuery(const SceneQuery&) = default
SceneQuery(eastl::string_view queryString)
SceneQuery &operator=(const SceneQuery&) = default
template<rtti::WithTypeInfo T>
void setType()
void setType(const rtti::TypeInfo &typeInfo)
rtti::TypeInfo getType() const
bool hasType() const

Public Members

eastl::optional<QueryObjectCategory> category
Uid uid = NullUid
size_t typeHashCode = 0

Friends

friend bool operator==(const SceneQuery &left, const SceneQuery &right)
friend Result parse(std::string_view queryStr, SceneQuery &query)
friend std::string toString(const SceneQuery &query)

scene::TransformProperties

engine/core/modules/scene/include/nau/scene/transform_control.h

struct TransformProperties

Provides interface for read-only access to the object transform properties.

Subclassed by nau::scene::ICameraProperties, nau::scene::TransformControl

Public Functions

virtual ~TransformProperties() = default

Destructor.

virtual const math::Transform &getWorldTransform() const = 0

Retrieves object world transformation.

Returns:

Object transformation in world coordinates.

virtual const math::Transform &getTransform() const = 0

Retrieves object local transformation.

Returns:

Object transformation with respect to its parent.

virtual math::quat getRotation() const = 0

Retrieves object local rotation.

Returns:

Object rotation with respect to its parent.

virtual math::vec3 getTranslation() const = 0

Retrieves object local translation.

Returns:

Object translation with respect to its parent.

virtual math::vec3 getScale() const = 0

Retrieves object local scale.

Returns:

Object scale with respect to its parent.


scene::TransformControl

engine/core/modules/scene/include/nau/scene/transform_control.h

struct TransformControl : public virtual nau::scene::TransformProperties

Provides interface for read&write access to the object transform properties.

Subclassed by nau::scene::ICameraControl, nau::scene::SceneComponent, nau::scene::SceneObject

Public Functions

virtual ~TransformControl() = default

Destructor.

virtual void setWorldTransform(const math::Transform &transform) = 0

Sets object transform in world coordinates.

Parameters:

transform[in] Transform to assign.

virtual void setTransform(const math::Transform &transform) = 0

Sets object transform relative to its parent.

Parameters:

transform[in] Transform to assign.

virtual void setRotation(math::quat rotation) = 0

Sets object rotation relative to its parent.

Parameters:

transform[in] Transform to assign.

virtual void setTranslation(math::vec3 position) = 0

Sets object translation relative to its parent.

Parameters:

transform[in] Transform to assign.

virtual void setScale(math::vec3 scale) = 0

Sets object scale relative to its parent.

Parameters:

transform[in] Transform to assign.


scene::IWorld

engine/core/modules/scene/include/nau/scene/world.h

struct IWorld : public nau::scene::NauObject

An interface for logically combining a group of scenes.

Public Types

using WeakRef = ObjectWeakRef<IWorld>

Public Functions

virtual eastl::string_view getName() const = 0

Retrieves the name of the world.

Returns:

Name of the scene.

virtual void setName(eastl::string_view name) = 0

Assigns the name to the world.

Parameters:

name[in] Name to assign.

virtual Vector<IScene::WeakRef> getScenes() const = 0

Retrieves all scenes associated with the world.

Returns:

A collections of scenes associated with the world.

virtual async::Task<IScene::WeakRef> addScene(IScene::Ptr &&scene) = 0

Asynchronously attaches the scene to the world.

Note

Calling this renders input scene pointer empty.

Parameters:

scene[in] Scene to add.

Returns:

Task object providing the operation status as well as access to the added scene.

virtual void removeScene(IScene::WeakRef sceneRef) = 0

Detaches the scene from the world and destroys all the contained objects.

See also: removeSceneNoWait.

Parameters:

sceneRef[in] Scene to detach.

Returns:

Task object providing the operation status.

virtual void setSimulationPause(bool pause) = 0
virtual bool isSimulationPaused() const = 0

scene::ICameraProperties

engine/core/modules/scene/include/nau/scene/camera/camera.h

struct ICameraProperties : public virtual nau::scene::TransformProperties, public virtual IRttiObject

Subclassed by nau::scene::CameraProperties, nau::scene::ICameraControl

Public Functions

virtual IRttiObject Uid getCameraUid () const =0
virtual Uid getWorldUid() const = 0
virtual eastl::string_view getCameraName() const = 0
virtual float getFov() const = 0
virtual float getClipNearPlane() const = 0
virtual float getClipFarPlane() const = 0

Public Members

TransformProperties

scene::ICameraControl

engine/core/modules/scene/include/nau/scene/camera/camera.h

struct ICameraControl : public virtual nau::scene::ICameraProperties, public virtual nau::scene::TransformControl

Subclassed by nau::scene::CameraComponent

Public Functions

virtual TransformControl void setCameraName (eastl::string_view cameraName)=0
virtual void setFov(float fov) = 0
virtual void setClipNearPlane(float clipNearPlane) = 0
virtual void setClipFarPlane(float clipFarPlane) = 0

Public Members

ICameraProperties

scene::CameraProperties

engine/core/modules/scene/include/nau/scene/camera/camera.h

struct CameraProperties : public virtual nau::scene::ICameraProperties

Subclassed by nau::scene::CameraComponent

Public Members

ICameraProperties(1(m_fieldOfView, "FieldOfView"), 1(m_clipNearPlane, "ClipNearPlane"), 1(m_clipFarPlane, "ClipFarPlane")) protected float m_clipNearPlane   = 0.1f
float m_clipFarPlane = 1000.f

scene::ICameraManager

engine/core/modules/scene/include/nau/scene/camera/camera_manager.h

struct ICameraManager

Camera management API.

Camera manager mostly is not thread-safe API, because it require properties syncronization with a scene objects/components
which can only be done on the main/scene thread.

Public Types

using CameraCollection = Vector<nau::Ptr<ICameraProperties>>
using SyncCameraCallback = Functor<void(ICameraProperties&)>

Public Functions

virtual ~ICameraManager() = default
virtual CameraCollection getCameras() = 0

Get all in-game cameras including scene and detached cameras The method is not completely thread-safe and should only be called from the main/scene thread.

virtual void syncCameras(CameraCollection &cameras, SyncCameraCallback onCameraAdded = {}, SyncCameraCallback onCameraRemoved = {}) = 0

Sync cameras collection with all in-game cameras including scene and detached cameras After the method completes, the camera collection will contain only existing in-game cameras: non-existent cameras are removed, newly created cameras will be added to the camera collection. This method is more efficient than getCameras() because cameras that remain unchanged only synchronize their properties with the corresponding camera objects. The method is not completely thread-safe and should only be called from the main/scene thread.

Parameters:
  • cameras – Collection of properties of all cameras

  • onCameraAdded – Callback that will be called when a new camera is added to the camera collection

  • onCameraRemoved – Callback that will be called when a camera is removed from the camera collection.

virtual nau::Ptr<ICameraControl> createDetachedCamera(Uid worldUid = NullUid) = 0

Creating the detached camera The detached camera allows its properties to be read and written in a thread-safe manner. The method is thread-safe and can be called from any thread.


scene::IMissingComponent

engine/core/modules/scene/include/nau/scene/components/internal/missing_component.h

struct IMissingComponent

Public Functions

virtual ~IMissingComponent() = default
virtual void setComponentData(const ComponentAsset &componentData) = 0
virtual void fillComponentData(ComponentAsset &componentData) = 0