Class ProxyScene#
Defined in File ProxyScene.h
Inheritance Relationships#
Base Type#
public Karana::Scene::Scene(Class Scene)
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()#
Destructor.
-
ProxyScene(const ProxyScene&) = delete#
-
ProxyScene &operator=(const ProxyScene&) = delete#
-
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, std::optional<layer_t> layers = std::nullopt)#
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) const#
Lookup the ProxySceneNode managing the given implementation.
- Parameters:
- Returns:
The corresponding ProxySceneNode
-
const kc::ks_ptr<kf::Frame> &originFrame(const Scene &client_scene) const#
Get the Frame the client’s origin is centered at.
-
layer_t layers(const Scene &client_scene) const#
Get the client’s layers value.
- Parameters:
client_scene – - The client Scene
- Returns:
The layers value
-
const kc::ks_ptr<kf::Frame> &rootFrame() const#
Get the root frame.
This is the frame that nodes are attached to by default.
- Returns:
The root Frame.
-
std::vector<kc::ks_ptr<ProxySceneNode>> getNodesAttachedToFrame(const kf::Frame &frame, bool strict) const#
Retrieve all ProxySceneNodes attached to the provided frame.
- Parameters:
frame – - The frame to retrieve nodes from.
strict – - If true, then only get nodes directly attached to the provided frame. If false, then return all nodes whose ancestor frame is the provided frame.
- Returns:
- A vector of ProxySceneNodes attached to the provided frame.
-
std::vector<kc::ks_ptr<ProxyScenePart>> getPartsAttachedToFrame(const kf::Frame &frame, bool strict, layer_t layers = LAYER_ALL) const#
Retrieve all ProxySceneParts attached to the provided frame.
- Parameters:
frame – - The frame to retrieve parts from.
strict – - If true, then only get parts directly attached to the provided frame. If false, then return all parts whose ancestor frame is the provided frame.
layers – - Limit to parts belong to the specified layer
- Returns:
- A vector of ProxySceneParts attached to the provided frame.
-
void showAxes(const 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(const kf::Frame &frm, const km::Vec3 &offset, const km::Vec3 &at_offset = {0, 0, 0}, const km::Vec3 &up = {0, 0, 1}) const#
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
-
void chaseFrame(const 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 chase around
offset – camera position relative to the Frame
at_offset – camera target relative to the Frame
up – camera up vector
-
bool empty() const#
Check if the ProxyScene has any nodes or parts.
- Returns:
Whether the ProxyScene is empty
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 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(kc::ks_ptr<Base> &b) override#
This does the work to discard the ProxyScene.
- Parameters:
b – - A pointer to the ProxyScene to discard.
-
ProxyScene(std::string_view name, const kc::ks_ptr<kf::Frame> &root_frame)#