Class ProxySceneNode#

Inheritance Relationships#

Base Type#

Derived Type#

Class Documentation#

class ProxySceneNode : public virtual Karana::Scene::SceneNode#

SceneNode acting as a proxy for client SceneNodes.

See Scene layer for more discussion on the scene layer.

Subclassed by Karana::Scene::ProxyScenePart

Public Functions

ProxySceneNode(std::string_view name, const Karana::Core::ks_ptr<ClientRegistry> &client_registry, const Karana::Core::ks_ptr<ImplDatabase> &impl_database, const Karana::Core::ks_ptr<ProxyScene> &scene)#

ProxySceneNode constructor.

Parameters:
  • name – - Name of the ProxySceneNode.

  • client_registry – - Helper to track registered client scenes

  • impl_database – - Helper to track implementations of objects for client scenes

  • scene – - The Scene to add the node to.

virtual ~ProxySceneNode()#
virtual void update()#

Update the transform for all clients if attached to a Frame.

virtual void update(Scene &scene)#

Update the transform for a client if attached to a Frame.

Parameters:

scene – - The client to update

const Karana::Core::ks_ptr<SceneNode> &of(Scene &scene) const#

Get the implementation for a given client.

Parameters:

scene – - The client scene

Returns:

The implementation of this node for the client

Karana::Core::ks_ptr<GraphicalSceneNode> graphics() const#

Get a graphical implementation If there is more than one graphical implementation only the first one found is returned.

Returns:

A graphical implementation or nullptr

Karana::Core::ks_ptr<GraphicalSceneNode> graphics(Scene &scene) const#

Get the graphical implementation for a client.

Parameters:

scene – - The client scene

Returns:

The graphical implementation or for the client

Karana::Core::ks_ptr<CollisionSceneNode> collision() const#

Get a collision implementation If there is more than one collision implementation only the first one found is returned.

Returns:

A collision implementation or nullptr

Karana::Core::ks_ptr<CollisionSceneNode> collision(Scene &scene) const#

Get the collision implementation for a client.

Parameters:

scene – - The client scene

Returns:

The collision implementation or for the client

virtual void setUnitQuaternion(const Karana::Math::UnitQuaternion &quaternion) override#

Set rotation of the node relative to its parent.

Parameters:

quaternion – - The relative rotation as a unit quaternion

virtual void setTranslation(const Karana::Math::Vec3 &translation) override#

Set position of the node relative to its parent.

Parameters:

translation – - The relative translation

virtual void setScale(double scale) override#

Set uniform of the node relative to its parent.

Parameters:

scale – - The relative uniform scale

virtual void setVisible(bool visible) override#

Set whether the object is visible.

Parameters:

visible – - The visibility flag

void attachTo(const Karana::Core::ks_ptr<Karana::Frame::Frame> &parent, bool maintain_world_transform = false)#

Attach the node to a Frame.

Parameters:
  • parent – - The Frame to attach to

  • maintain_world_transform – - If true, update the node’s relative transform so that its overall world transform doesn’t change after attaching it to the parent

virtual void attachTo(const Karana::Core::ks_ptr<SceneNode> &parent, bool maintain_world_transform = false) override#

Attach to a parent node.

Parameters:
  • parent – - The parent node

  • maintain_world_transform – - If true, update the node’s relative transform so that its overall world transform doesn’t change after attaching it to the parent

virtual void detach(bool maintain_world_transform = false) override#

Detach the node from its parent.

Parameters:

maintain_world_transform – - If true, update the node’s relative transform so that its overall world transform doesn’t change after detaching

const Karana::Core::ks_ptr<Karana::Frame::Frame> &ancestorFrame() const#

Get the unique Frame that an ancestor is attached to.

Returns:

The Frame that this node or an ancestor is attached to

Public Static Functions

static kc::ks_ptr<ProxySceneNode> create(std::string_view name, const Karana::Core::ks_ptr<ProxyScene> &scene)#

Create a ProxyScene node.

Parameters:
Returns:

The created ProxySceneNode

Protected Functions

virtual void _implement(Scene &scene)#

Create the implementation for a client scene.

This is called automatically as needed and shouldn’t need to be called outside of ProxyScene internals.

Parameters:

scene – - The client to create an implementation for.

virtual void _unimplement(Scene &scene)#

Destroy the implementation for a client scene.

This is called automatically as needed and shouldn’t need to be called outside of ProxyScene internals.

Parameters:

scene – - The client to destroy the implementation for.

virtual void _initialize(Scene &scene)#

Initialize the state of an implementation.

Parameters:

scene – - The client the initialize the implementation for.

template<typename Func>
inline void _forEachImpl(Func &&func) const#

Helper to invoke a callback for each implementation.

Parameters:

func – - The callback function

Protected Attributes

Karana::Core::ks_ptr<ClientRegistry> _client_registry#

Helper to track registered client scenes.

std::weak_ptr<ImplDatabase> _impl_database#

Helper to track implementations.

Karana::Core::ks_ptr<Karana::Frame::Frame> _parent_frame#

The Frame this node is attached to (if any)

std::unordered_map<Karana::Core::id_t, Karana::Core::ks_ptr<SceneNode>> _impls#

Implementations for this node.