Light
- class nvisii.light(*args, **kwargs)
A “Light” component illuminates objects in a scene. Light components must be added to an entity with a transform component to have a visible impact on the scene. Lights attached to entities with no mesh components act like point lights. Otherwise, lights attached to entities with meshes will act like mesh lights.
- static are_any_dirty()
- Return type
boolean
- Returns
True if any the light has been modified since the previous frame, and False otherwise
- static clear_all()
Clears any existing light components.
- clear_color_texture()
Disconnects the color texture, reverting back to any existing constant
light color
- static create(name)
Constructs a light with the given name.
- Parameters
name (string) – A unique name for this light
- Return type
Light
- Returns
a reference to a light component
- static create_from_rgb(name, color, intensity)
Constructs a light component which emits a given light color.
- Parameters
name (string) – A unique name for this light.
color (
vec3
) – An RGB color to emit. Values should range between 0 and 1.intensity (float) – How powerful the light source is in emitting light
- static create_from_temperature(name, kelvin, intensity)
Constructs a light component which emits a plausible light color based on standard temperature measurement.
- Parameters
name (string) – A unique name for this light
kelvin (float) – The temperature of the black body light. Typical values range from 1000K (very warm) to 12000K (very cold).
intensity (float) – How powerful the light source is in emitting light
- Return type
Light
- Returns
a reference to a light component
- static get(name)
- Parameters
name (string) – The name of the light to get
- Return type
Light
- Returns
a Light who’s name matches the given name
- get_color()
- Return type
- Returns
the constant vec3 color used by this light. If a color texture is set, this function should not be used.
- static get_count()
- Return type
int
- Returns
the number of allocated lights
- static get_edit_mutex()
For internal use. Returns the mutex used to lock entities for processing
by the renderer.
- get_exposure()
- Return type
float
- Returns
the constant exposure used by this light.
- get_falloff()
- Return type
float
- Returns
the distance falloff exponent used by this light.
- static get_front()
- Return type
Light
- Returns
a pointer to the table of light components
- static get_front_struct()
- Return type
LightStruct
- Returns
a pointer to the table of LightStructs required for rendering
- get_intensity()
- Return type
float
- Returns
the constant intensity used by this light.
- get_name()
- Return type
string
- Returns
the name of this component
- static get_name_to_id_map()
- Return type
std::map< std::string,uint32_t,std::less< std::string >,std::allocator< std::pair< std::string const,uint32_t > > >
- Returns
A map whose key is a light name and whose value is the ID for that light
- get_struct()
Returns the simplified struct used to represent the current component
- static initialize_factory(max_components)
Allocates the tables used to store all light components
- is_clean()
- Return type
boolean
- Returns
True if the light has not been modified since the previous frame, and False otherwise
- is_dirty()
- Return type
boolean
- Returns
True if this lightmaterial has been modified since the previous frame, and False otherwise
- static is_factory_initialized()
- Return type
boolean
- Returns
True if the tables used to store all light components have been allocated, and False otherwise
- is_initialized()
- Return type
boolean
- Returns
True the current light is a valid, initialized light, and False if the light was cleared or removed.
- mark_clean()
Tags the current component as being unmodified since the previous frame.
- mark_dirty()
Tags the current component as being modified since the previous frame.
- static remove(name)
- Parameters
name (string) – The name of the Light to remove
- set_color(color)
Sets the color which this light component will emit.
- Parameters
The – RGB color emitted that this light should emit.
- set_color_texture(texture)
Sets the color which this light component will emit. Texture is expected to be RGB. Overrides any existing constant light color.
- Parameters
texture (
Texture
) – An RGB texture component whose values range between 0 and 1. Alpha channel is ignored.
- set_exposure(exposure)
Modifies the intensity, or brightness, that this light component will emit it’s color by a power of 2. Increasing the exposure by 1 will double the energy emitted by the light. An exposure of 0 produces an unmodified intensity. An exposure of -1 cuts the intensity of the light in half. light_intensity = intensity * pow(2, exposureExposure)
- Parameters
exposure (float) – How powerful the light source is in emitting light.
- set_falloff(falloff)
Modifies the falloff exponent that this light component will use to reduce intensity due to distance. Physically realistic light transport uses an r^2 falloff, where the falloff exponent equals 2. Many video games instead use a linear falloff (falloff = 1). Distance falloff can be disabled in its entirety by setting falloff to 0.
- Parameters
falloff (float) – The distance falloff exponent to use.
- set_intensity(intensity)
Sets the intensity, or brightness, that this light component will emit it’s color.
- Parameters
intensity (float) – How powerful the light source is in emitting light
- set_temperature(kelvin)
Sets a realistic emission color via a temperature.
- Parameters
kelvin (float) – The temperature of the black body light. Typical values range from 1000K (very warm) to 12000K (very cold).
- property thisown
The membership flag
- to_string()
- Return type
string
- Returns
a json string representation of the current component
- static update_components()
Iterates through all light components, computing light metadata for
rendering purposes.
- use_surface_area(use)
Controls whether or not the surface area of the light should effect overall light intensity. :type use: boolean :param use: if True, allows the area of the light to affect intensity.