Class WebSceneDirectionalLight#

Inheritance Relationships#

Base Type#

Class Documentation#

class WebSceneDirectionalLight : public Karana::Scene::WebSceneNode#

Specialized node to provide a viewpoint for the WebScene.

See Scene layer for more discussion on the scene layer.

Public Functions

WebSceneDirectionalLight(std::string_view name, const Karana::Core::ks_ptr<Scene> &scene, const Karana::Core::ks_ptr<Karana::WebUI::Server> &server, bool *batching, const Color &color, float intensity)#

WebSceneDirectionalLight constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.

Parameters:
  • name – Name for the WebSceneDirectionalLight

  • scene – WebScene to add the camera to.

  • server – Server to communicate with frontends

  • batching – Whether transform updates are being batched.

  • color – Color of the light.

  • intensity – Intensity of the light.

const Color &getColor()#

Get the light color.

Returns:

The light color

void setColor(const Color &color)#

Set the light color.

Parameters:

color – The light color

float getIntensity()#

Get the light intensity.

Returns:

The light intensity

void setIntensity(float intensity)#

Set the light intensity.

Parameters:

intensity – The light intensity

void setShadows(float intensity = 1.0, int pixels = 2048, float radius = 10.0, float near = 1e-3, float far = 1e11)#

Enable and configure shadow casting for this light.

Parameters:
  • intensity – Shadow intensity in the range [0, 1]

  • pixels – Pixel dimensions of the square shadow map

  • radius – Radius of shadow camera frustum cross-section

  • near – Minimum distance to cast shadows

  • far – Maximum distance to cast shadows

void clearShadows()#

Disable shadow casting for this light.

void setTarget(const Karana::Core::ks_ptr<WebSceneNode> &target)#

Set a target node to point the light at.

Parameters:

target – The target node

Public Static Functions

static Karana::Core::ks_ptr<WebSceneDirectionalLight> create(std::string_view name, const Karana::Core::ks_ptr<WebScene> &scene, const Color &color = Color::WHITE, float intensity = 1)#

Create a new WebSceneDirectionalLight.

Parameters:
Returns:

A pointer to the new light.

Protected Functions

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

Discard the provided WebSceneDirectionalLight.

Parameters:

base – - Base pointer to the WebSceneDirectionalLight.