Class ProxyScene#

Inheritance Relationships#

Base Type#

Class Documentation#

class ProxyScene : public Karana::Scene::Scene#

A Scene implementation acting as a proxy to any number of registered ‘client’ Scenes.

See Scene layer for more discussion on the scene layer.

Public Functions

ProxyScene(std::string_view name, const kc::ks_ptr<kf::Frame> &root_frame)#

ProxyScene constructor.

Parameters:
  • name – - Name of the ProxyScene.

  • root_frame – - Default Frame to attach nodes to.

~ProxyScene()#
void update()#

Update all Frame-attached nodes’ transforms for all clients.

void update(Scene &scene)#

Update all Frame-attached nodes’ transforms for a client.

Parameters:

scene – - The client Scene to update

void registerClientScene(const kc::ks_ptr<Scene> &scene, const kc::ks_ptr<kf::Frame> &origin_frame, layer_t layers = LAYER_ALL)#

Register a client Scene to be managed.

Parameters:
  • scene – - The client Scene

  • origin_frame – - The Frame to center the client’s origin at

  • layers – - Bitmask for objects to implement

void unregisterClientScene(Scene &scene)#

Unregister a client Scene to no longer be managed.

Parameters:

scene – - The client Scene.

std::vector<kc::ks_ptr<Karana::Scene::Scene>> clientScenes() const#

Get a list of all registered client Scenes.

Returns:

The list of client Scenes

kc::ks_ptr<Karana::Scene::GraphicalScene> graphics() const#

Get a registered GraphicalScene.

If there is more than one only the first one found is returned.

Returns:

A GraphicalScene or nullptr

kc::ks_ptr<Karana::Scene::CollisionScene> collision() const#

Get a registered CollisionScene.

If there is more than one only the first one found is returned.

Returns:

A CollisionScene or nullptr

const kc::ks_ptr<ProxySceneNode> &lookupProxyFromImpl(const SceneNode &impl)#

Lookup the ProxySceneNode managing the given implementation.

Parameters:

impl – - The SceneNode in a client Scene

Returns:

The corresponding ProxySceneNode

const kc::ks_ptr<kf::Frame> &originFrame(const Scene &client_scene)#

Get the Frame the client’s origin is centered at.

Parameters:

client_scene – - The client Scene

Returns:

The origin Frame for the given client Scene

std::vector<kc::ks_ptr<ProxySceneNode>> getNodesAttachedToFrame(const kc::ks_ptr<kf::Frame> &frame)#

Retrieve all ProxySceneNodes attached to the provided frame.

Parameters:

frame – - The frame to retrieve nodes from.

Returns:

- A vector of ProxySceneNodes attached to the provided frame.

void showAxes(kc::ks_ptr<kf::Frame> frm, float size = 1)#

Show the axes for a Frame.

Parameters:
  • frm – the Frame to show axes for

  • size – the size of the axes

void viewAroundFrame(kc::ks_ptr<kf::Frame> frm, const km::Vec3 &offset, const km::Vec3 &at_offset = {0, 0, 0}, const km::Vec3 &up = {0, 0, 1})#

Position the default camera relative to a Frame.

Parameters:
  • frm – the Frame to view around

  • offset – camera position relative to the Frame

  • at_offset – camera target relative to the Frame

  • up – camera up vector

Public Members

kc::CallbackRegistry<void> update_callbacks#

Registry for callbacks that run during the scene update.

These callbacks will run after the nodes are updated.

Public Static Functions

static kc::ks_ptr<ProxyScene> create(std::string_view name, const kc::ks_ptr<kf::Frame> &root_frame)#

Create a ProxyScene.

Parameters:
  • name – - Name of the ProxyScene.

  • root_frame – - Default Frame to attach nodes to.

Returns:

The created ProxyScene

Protected Functions

virtual void _discard(kc::ks_ptr<Base> &b) override#

This does the work to discard the ProxyScene.

Parameters:

b – - A pointer to the ProxyScene to discard.