Class WebScene#

Inheritance Relationships#

Base Type#

Class Documentation#

class WebScene : public Karana::Scene::GraphicalScene#

GraphicalScene implementation for web-based visualization.

Public Functions

WebScene(std::string_view name, const Karana::Core::ks_ptr<Karana::WebUI::Server> &server)#

WebScene constructor.

Parameters:
  • name – - Name for the WebScene

  • server – - Server to communicate with frontends

~WebScene()#
virtual void renderToFile(const std::string &filepath) override#

Render the scene to a file.

Parameters:

filepath – - filename to render to

virtual Karana::Core::id_t addOverlayText(const std::string &message, float x, float y, const TextParameters &parameters = TextParameters{}) override#

Add text in screen space.

Parameters:
  • message – - The content of the overlay text

  • x – - The horizontal position of the text between 0 and 1

  • y – - The vertical position of the text between 0 and 1

  • parameters – - Addition text parameters

Returns:

Unique id to later update the text instance

virtual void setOverlayText(const Karana::Core::id_t &id, const std::string &message) override#

Update the content of an existing overlay text.

Parameters:
  • id – - Id for the text returned by a prior addOverlayText call

  • message – - The new content of the overlay text

virtual void removeOverlayText(const Karana::Core::id_t &id) override#

Delete an overlay text instance.

Parameters:

id – - Id for the text returned by a prior addOverlayText call

virtual Karana::Core::ks_ptr<GraphicalSceneCamera> defaultCamera() const override#

Get the default camera.

Returns:

The camera

void _forceRender() const#

Force a render on the frontend.

void _setShadows(const Karana::Math::Vec3 &direction)#

Configure shadows.

Note: this is an experimental API subject to removal

Parameters:

direction – - The non-normalized direction to cast shadows or the zero vector to disable shadows.

void _setBackgroundColor(const Color &color)#

Set the color of the background.

Note: this is an experimental API subject to removal

Parameters:

color – - The new background color.

Karana::Core::id_t _addLineBetween(const Karana::Core::ks_ptr<WebSceneNode> &node1, const Karana::Core::ks_ptr<WebSceneNode> &node2, const Color &color1, const Color &color2, bool dashed = false)#

Create a line segment connecting a pair of nodes.

Note: this is an experimental API subject to removal

Parameters:
  • node1 – - The first node.

  • node2 – - The second node.

  • color1 – - The line’s color at the first node.

  • color2 – - The line’s color at the second node.

Returns:

A unique id for the created line

void _removeLineBetween(Karana::Core::id_t line_id)#

Remove a line segment created by _addLineBetween.

Note: this is an experimental API subject to removal

Parameters:

line_id – - The id returned prior by _addLineBetween

Public Static Functions

static Karana::Core::ks_ptr<WebScene> create(std::string_view name, const Karana::Core::ks_ptr<Karana::WebUI::Server> &server)#

Create a WebScene.

Parameters:
  • name – - Name for the WebScene

  • server – - Server to communicate with frontends

Returns:

The created WebScene

Protected Functions

virtual void _discard(Karana::Core::ks_ptr<Base> &base) override#

This does the work to discard the WebScene.

Parameters:

base – - A Base pointer to the WebScene to discard.