RPLight

from panda3d._rplight import RPLight
class RPLight

Bases: ReferenceCount

This is the base class for all lights in the render pipeline. It stores common properties, and provides methods to modify these. It also defines some interface functions which subclasses have to implement.

Inheritance diagram

Inheritance diagram of RPLight

LTEmpty = 0
LTPointLight = 1
LTSpotLight = 2
LT_empty = 0
LT_point_light = 1
LT_spot_light = 2
__init__(*args, **kwargs)
casts_shadows
clearIesProfile()

C++ Interface: clear_ies_profile(const RPLight self)

/**
  • @brief Clears the IES profile

  • @details This clears the IES profile of the light, telling it to no longer

  • use an IES profile, and instead use the default attenuation.

*/

clear_ies_profile()

C++ Interface: clear_ies_profile(const RPLight self)

/**
  • @brief Clears the IES profile

  • @details This clears the IES profile of the light, telling it to no longer

  • use an IES profile, and instead use the default attenuation.

*/

color
energy
getCastsShadows()

C++ Interface: get_casts_shadows(RPLight self)

/**
  • @brief Returns whether the light casts shadows

  • @details This returns whether the light casts shadows, the returned value

  • is the one previously set with RPLight::set_casts_shadows.

  • @return true if the light casts shadows, false otherwise

*/

getColor()

C++ Interface: get_color(RPLight self)

/**
  • @brief Returns the lights color

  • @details This returns the light color, previously set with RPLight::set_color.

  • This does not include the energy of the light. It might differ from what

  • was set with set_color, because the color is normalized by dividing it

  • by its luminance.

  • @return Light-color

*/

getEnergy()

C++ Interface: get_energy(RPLight self)

/**
  • @brief Returns the energy of the light

  • @details This returns the energy of the light, previously set with

  • RPLight::set_energy.

  • @return energy of the light

*/

getIesProfile()

C++ Interface: get_ies_profile(RPLight self)

/**
  • @brief Returns the light’s IES profile

  • @details This returns the IES profile of a light, previously set with

  • RPLight::set_ies_profile. In case no ies profile was set, returns -1.

  • @return IES Profile handle

*/

getLightType()

C++ Interface: get_light_type(RPLight self)

/**
  • @brief Returns the type of the light

  • @details This returns the internal type of the light, which was specified

  • in the lights constructor. This can be used to distinguish between light

  • types.

  • @return Type of the light

*/

getNearPlane()

C++ Interface: get_near_plane(RPLight self)

/**
  • @brief Returns the near plane of the light

  • @details This returns the light’s near plane, previously set with

  • RPLight::set_near_plane. If the light does not cast shadows, this value

  • is meaningless.

  • @return Near-plane

*/

getPos()

C++ Interface: get_pos(RPLight self)

/**
  • @brief Returns the position of the light

  • @details This returns the position of the light previously set with

  • RPLight::set_pos(). The returned position is in world space.

  • @return Light-position

*/

getShadowMapResolution()

C++ Interface: get_shadow_map_resolution(RPLight self)

/**
  • @brief Returns the shadow map resolution

  • @details This returns the shadow map resolution of each source of the light.

  • If the light is not setup to cast shadows, this value is meaningless.

  • The returned value is the one previously set with RPLight::set_shadow_map_resolution.

  • @return Shadow map resolution in pixels

*/

get_casts_shadows()

C++ Interface: get_casts_shadows(RPLight self)

/**
  • @brief Returns whether the light casts shadows

  • @details This returns whether the light casts shadows, the returned value

  • is the one previously set with RPLight::set_casts_shadows.

  • @return true if the light casts shadows, false otherwise

*/

get_color()

C++ Interface: get_color(RPLight self)

/**
  • @brief Returns the lights color

  • @details This returns the light color, previously set with RPLight::set_color.

  • This does not include the energy of the light. It might differ from what

  • was set with set_color, because the color is normalized by dividing it

  • by its luminance.

  • @return Light-color

*/

get_energy()

C++ Interface: get_energy(RPLight self)

/**
  • @brief Returns the energy of the light

  • @details This returns the energy of the light, previously set with

  • RPLight::set_energy.

  • @return energy of the light

*/

get_ies_profile()

C++ Interface: get_ies_profile(RPLight self)

/**
  • @brief Returns the light’s IES profile

  • @details This returns the IES profile of a light, previously set with

  • RPLight::set_ies_profile. In case no ies profile was set, returns -1.

  • @return IES Profile handle

*/

get_light_type()

C++ Interface: get_light_type(RPLight self)

/**
  • @brief Returns the type of the light

  • @details This returns the internal type of the light, which was specified

  • in the lights constructor. This can be used to distinguish between light

  • types.

  • @return Type of the light

*/

get_near_plane()

C++ Interface: get_near_plane(RPLight self)

/**
  • @brief Returns the near plane of the light

  • @details This returns the light’s near plane, previously set with

  • RPLight::set_near_plane. If the light does not cast shadows, this value

  • is meaningless.

  • @return Near-plane

*/

get_pos()

C++ Interface: get_pos(RPLight self)

/**
  • @brief Returns the position of the light

  • @details This returns the position of the light previously set with

  • RPLight::set_pos(). The returned position is in world space.

  • @return Light-position

*/

get_shadow_map_resolution()

C++ Interface: get_shadow_map_resolution(RPLight self)

/**
  • @brief Returns the shadow map resolution

  • @details This returns the shadow map resolution of each source of the light.

  • If the light is not setup to cast shadows, this value is meaningless.

  • The returned value is the one previously set with RPLight::set_shadow_map_resolution.

  • @return Shadow map resolution in pixels

*/

hasIesProfile()

C++ Interface: has_ies_profile(RPLight self)

/**
  • @brief Returns whether the light has an IES profile assigned

  • @details This returns whether the light has an IES profile assigned,

  • previously done with RPLight::set_ies_profile.

  • @return true if the light has an IES profile assigned, false otherwise

*/

has_ies_profile()

C++ Interface: has_ies_profile(RPLight self)

/**
  • @brief Returns whether the light has an IES profile assigned

  • @details This returns whether the light has an IES profile assigned,

  • previously done with RPLight::set_ies_profile.

  • @return true if the light has an IES profile assigned, false otherwise

*/

ies_profile
invalidateShadows()

C++ Interface: invalidate_shadows(const RPLight self)

/**
  • @brief Invalidates the shadows

  • @details This invalidates all shadows of the light, causing them to get

  • regenerated. This might be the case when the lights position or similar

  • changed. This will cause all shadow sources to be updated, emitting a

  • shadow update. Be careful when calling this method if you don’t want all

  • sources to get updated. If you only have to invalidate a single shadow source,

  • use get_shadow_source(n)->set_needs_update(true).

*/

invalidate_shadows()

C++ Interface: invalidate_shadows(const RPLight self)

/**
  • @brief Invalidates the shadows

  • @details This invalidates all shadows of the light, causing them to get

  • regenerated. This might be the case when the lights position or similar

  • changed. This will cause all shadow sources to be updated, emitting a

  • shadow update. Be careful when calling this method if you don’t want all

  • sources to get updated. If you only have to invalidate a single shadow source,

  • use get_shadow_source(n)->set_needs_update(true).

*/

light_type
near_plane
pos
setCastsShadows()

C++ Interface: set_casts_shadows(const RPLight self, bool flag)

/**
  • @brief Controls whether the light casts shadows

  • @details This sets whether the light casts shadows. You can not change this

  • while the light is attached. When flag is set to true, the light will be

  • setup to cast shadows, spawning shadow sources based on the lights type.

  • If the flag is set to false, the light will be inddicated to cast no shadows.

  • @param flag Whether the light casts shadows

*/

setColor()

C++ Interface: set_color(const RPLight self, const LVecBase3f color) set_color(const RPLight self, float r, float g, float b)

/**
  • @brief Sets the lights color

  • @details This sets the lights color. The color should not include the brightness

  • of the light, you should control that with the energy. The color specifies

  • the lights “tint” and will get multiplied with its specular and diffuse

  • contribution.

  • The color will be normalized by dividing by the colors luminance. Setting

  • higher values than 1.0 will have no effect.

  • @param color Light color

*/

/**
  • @brief Sets the lights color

  • @details @copydetails RPLight::set_color(const LVecBase3 &color)

  • @param r Red-component of the color

  • @param g Green-component of the color

  • @param b Blue-component of the color

*/

setColorFromTemperature()

C++ Interface: set_color_from_temperature(const RPLight self, float temperature)

/**
  • @brief Sets the lights color from a given color temperature

  • @details This sets the lights color, given a temperature. This is more

  • physically based than setting a user defined color. The color will be

  • computed from the given temperature.

  • @param temperature Light temperature

*/

setEnergy()

C++ Interface: set_energy(const RPLight self, float energy)

/**
  • @brief Sets the energy of the light

  • @details This sets the energy of the light, which can be seen as the brightness

  • of the light. It will get multiplied with the normalized color.

  • @param energy energy of the light

*/

setIesProfile()

C++ Interface: set_ies_profile(const RPLight self, int profile)

/**
  • @brief Sets the IES profile

  • @details This sets the ies profile of the light. The parameter should be a

  • handle previously returned by RenderPipeline.load_ies_profile. Using a

  • value of -1 indicates no ies profile.

  • Notice that for IES profiles which cover a whole range, you should use an

  • RPPointLight, whereas for ies profiles which only cover the lower

  • hemisphere you should use an RPSpotLight for the best performance.

  • @param profile IES Profile handle

*/

setNearPlane()

C++ Interface: set_near_plane(const RPLight self, float near_plane)

/**
  • @brief Sets the near plane of the light

  • @details This sets the near plane of all shadow sources of the light. It has

  • no effects if the light does not cast shadows. This prevents artifacts from

  • objects near to the light. It behaves like Lens::set_near().

  • It can also help increasing shadow map precision, low near planes will

  • cause the precision to suffer. Try setting the near plane as big as possible.

  • If a negative or zero near plane is passed, an assertion is thrown.

  • @param near_plane Near-plane

*/

setPos()

C++ Interface: set_pos(const RPLight self, const LVecBase3f pos) set_pos(const RPLight self, float x, float y, float z)

/**
  • @brief Sets the position of the light

  • @details This sets the position of the light in world space. It will cause

  • the light to get invalidated, and resubmitted to the GPU.

  • @param pos Position in world space

*/

/**
  • @brief Sets the position of the light

  • @details @copydetails RPLight::set_pos(const LVecBase3 &pos)

  • @param x X-component of the position

  • @param y Y-component of the position

  • @param z Z-component of the position

*/

setShadowMapResolution()

C++ Interface: set_shadow_map_resolution(const RPLight self, int resolution)

/**
  • @brief Sets the light’s shadow map resolution

  • @details This sets the light’s shadow map resolution. This has no effect

  • when the light is not told to cast shadows (Use RPLight::set_casts_shadows).

  • When calling this on a light with multiple shadow sources (e.g.

  • RPPointLight), this controls the resolution of each source. If the light

  • has 6 shadow sources, and you use a resolution of 512x512, the light’s

  • shadow map will occupy a space of 6 * 512x512 maps in the shadow atlas.

  • @param resolution Resolution of the shadow map in pixels

*/

set_casts_shadows()

C++ Interface: set_casts_shadows(const RPLight self, bool flag)

/**
  • @brief Controls whether the light casts shadows

  • @details This sets whether the light casts shadows. You can not change this

  • while the light is attached. When flag is set to true, the light will be

  • setup to cast shadows, spawning shadow sources based on the lights type.

  • If the flag is set to false, the light will be inddicated to cast no shadows.

  • @param flag Whether the light casts shadows

*/

set_color()

C++ Interface: set_color(const RPLight self, const LVecBase3f color) set_color(const RPLight self, float r, float g, float b)

/**
  • @brief Sets the lights color

  • @details This sets the lights color. The color should not include the brightness

  • of the light, you should control that with the energy. The color specifies

  • the lights “tint” and will get multiplied with its specular and diffuse

  • contribution.

  • The color will be normalized by dividing by the colors luminance. Setting

  • higher values than 1.0 will have no effect.

  • @param color Light color

*/

/**
  • @brief Sets the lights color

  • @details @copydetails RPLight::set_color(const LVecBase3 &color)

  • @param r Red-component of the color

  • @param g Green-component of the color

  • @param b Blue-component of the color

*/

set_color_from_temperature()

C++ Interface: set_color_from_temperature(const RPLight self, float temperature)

/**
  • @brief Sets the lights color from a given color temperature

  • @details This sets the lights color, given a temperature. This is more

  • physically based than setting a user defined color. The color will be

  • computed from the given temperature.

  • @param temperature Light temperature

*/

set_energy()

C++ Interface: set_energy(const RPLight self, float energy)

/**
  • @brief Sets the energy of the light

  • @details This sets the energy of the light, which can be seen as the brightness

  • of the light. It will get multiplied with the normalized color.

  • @param energy energy of the light

*/

set_ies_profile()

C++ Interface: set_ies_profile(const RPLight self, int profile)

/**
  • @brief Sets the IES profile

  • @details This sets the ies profile of the light. The parameter should be a

  • handle previously returned by RenderPipeline.load_ies_profile. Using a

  • value of -1 indicates no ies profile.

  • Notice that for IES profiles which cover a whole range, you should use an

  • RPPointLight, whereas for ies profiles which only cover the lower

  • hemisphere you should use an RPSpotLight for the best performance.

  • @param profile IES Profile handle

*/

set_near_plane()

C++ Interface: set_near_plane(const RPLight self, float near_plane)

/**
  • @brief Sets the near plane of the light

  • @details This sets the near plane of all shadow sources of the light. It has

  • no effects if the light does not cast shadows. This prevents artifacts from

  • objects near to the light. It behaves like Lens::set_near().

  • It can also help increasing shadow map precision, low near planes will

  • cause the precision to suffer. Try setting the near plane as big as possible.

  • If a negative or zero near plane is passed, an assertion is thrown.

  • @param near_plane Near-plane

*/

set_pos()

C++ Interface: set_pos(const RPLight self, const LVecBase3f pos) set_pos(const RPLight self, float x, float y, float z)

/**
  • @brief Sets the position of the light

  • @details This sets the position of the light in world space. It will cause

  • the light to get invalidated, and resubmitted to the GPU.

  • @param pos Position in world space

*/

/**
  • @brief Sets the position of the light

  • @details @copydetails RPLight::set_pos(const LVecBase3 &pos)

  • @param x X-component of the position

  • @param y Y-component of the position

  • @param z Z-component of the position

*/

set_shadow_map_resolution()

C++ Interface: set_shadow_map_resolution(const RPLight self, int resolution)

/**
  • @brief Sets the light’s shadow map resolution

  • @details This sets the light’s shadow map resolution. This has no effect

  • when the light is not told to cast shadows (Use RPLight::set_casts_shadows).

  • When calling this on a light with multiple shadow sources (e.g.

  • RPPointLight), this controls the resolution of each source. If the light

  • has 6 shadow sources, and you use a resolution of 512x512, the light’s

  • shadow map will occupy a space of 6 * 512x512 maps in the shadow atlas.

  • @param resolution Resolution of the shadow map in pixels

*/

shadow_map_resolution