Class Scene#

Inheritance Relationships#

Base Type#

Derived Types#

Class Documentation#

class Scene : public Karana::Core::BaseWithVars#

Base container for a hierarchy of geometries.

See Scene layer for more discussion on the scene layer.

Subclassed by Karana::Scene::CollisionScene, Karana::Scene::GraphicalScene, Karana::Scene::ProxyScene

Public Functions

virtual ~Scene()#

Destructor.

Scene(const Scene&) = delete#
Scene &operator=(const Scene&) = delete#
Karana::Core::ks_ptr<Scene> getManager() const#

Get the Scene managing this one.

Returns:

The managing scene or nullptr

void setManager(const Karana::Core::ks_ptr<Scene> &manager)#

Assign a managing scene.

Parameters:

manager – The scene managing this one (nullable)

const std::vector<kc::ks_ptr<SceneNode>> getSceneNodes() const#

Get the list of scene nodes in the scene.

Returns:

The SceneNodes for this Scene.

const std::vector<kc::ks_ptr<ScenePart>> getSceneParts(layer_t layers = LAYER_ALL) const#

Get the list of scene parts in the scene.

Parameters:

layers – limit returned list to parts belong to the specified layers

Returns:

The SceneParts for this Scene.

virtual layer_t defaultLayers() const#

Get the layers that should be created by default.

Returns:

The default layers

void beginTransformUpdates()#

Signal that many transform updates are about to occur.

This state should be exited by a corresponding endTransformUpdates call. Entering this state is reentrant, such that nested calls are ignored.

To safely ensure the corresponding endTransformUpdates is called, prefer using the TransformUpdateScope class instead.

void endTransformUpdates()#

Signal the end of a prior beginTransformUpdates call.

This state should first be entered by a corresponding beginTransformUpdates call. This state is reentrant, such that nested calls are ignored.

To safely ensure this is called, prefer using the TransformUpdateScope class instead.

Protected Functions

Scene(std::string_view name)#

Scene constructor.

Parameters:

name – - Name of the Scene.

virtual Karana::Core::ks_ptr<Karana::Core::BaseVars> _getVars() const override#

Create the vars for this object.

Returns:

The vars for this object.

virtual void _discard(Karana::Core::ks_ptr<Karana::Core::Base> &s) override = 0#

Discard the scene. Derived scenes need to implement this with the logic required to discard their scene.

Parameters:

s – - A pointer to the scene to discard.

virtual Karana::Core::ks_ptr<SceneNode> _createNodeBase(std::string_view name) = 0#

Helper to create a SceneNode.

Derived scenes should implement by calling their non-virtual createNode. This is to support derived return types.

Parameters:

name – - Name for the SceneNode.

Returns:

The created SceneNode.

virtual void _discardNodeBase(Karana::Core::ks_ptr<SceneNode> &node)#

Discard the provided node. Derived scenes should implement downcasting and calling their non-abstract _discardNodeBase.

Parameters:

node – - The node to discard.

virtual Karana::Core::ks_ptr<ScenePart> _createPartBase(std::string_view name, const VarStaticGeometry &geometry, const VarMaterial &material, layer_t layers) = 0#

Helper to create a ScenePart.

Derived scenes should implement by calling their non-virtual createPart. This is to support derived return types.

Parameters:
Returns:

The created ScenePart.

virtual void _discardPartBase(Karana::Core::ks_ptr<ScenePart> &part)#

Helper to discard a ScenePart.

Derived scenes should implement downcasting and calling their non-abstract _discardPartBase.

Parameters:

part – - The ScenePart to discard.

void _track(const Karana::Core::ks_ptr<SceneNode> &node)#

Track the usage of a SceneNode.

Parameters:

node – - The SceneNode to track.

void _untrack(Karana::Core::ks_ptr<SceneNode> &node)#

Stop tracking the usage of a SceneNode.

Parameters:

node – - The SceneNode to stop tracking.

inline virtual void _doBeginTransformUpdates()#

Signal that many transform updates are about to occur.

A Scene may implement this to make optimizations, for example by waiting until endTransformUpdates is called and doing a batch update.

inline virtual void _doEndTransformUpdates()#

Signal the end of a prior beginTransformUpdates call.

A Scene may implement this to make optimizations, for example by waiting until endTransformUpdates is called and doing a batch update.

Protected Attributes

std::weak_ptr<Scene> _manager#

The scene managing this one (if any).