The abstract interface to all kinds of lights. More...
#include "light.h"
Public Member Functions | |
Light (const Light ©) | |
virtual PandaNode * | as_node ()=0 |
virtual void | attrib_ref () |
This is called when the light is added to a LightAttrib. More... | |
virtual void | attrib_unref () |
This is called when the light is removed from a LightAttrib. More... | |
virtual void | bind (GraphicsStateGuardianBase *gsg, const NodePath &light, int light_id)=0 |
virtual const LVecBase3 & | get_attenuation () const |
Returns the terms of the attenuation equation for the light. More... | |
virtual int | get_class_priority () const =0 |
const LColor & | get_color () const |
PN_stdfloat | get_color_temperature () const |
virtual PN_stdfloat | get_exponent () const |
For spotlights, returns the exponent that controls the amount of light falloff from the center of the spotlight. More... | |
int | get_priority () const |
virtual const LColor & | get_specular_color () const |
Returns the color of specular highlights generated by the light. More... | |
virtual TypeHandle | get_type () const |
virtual bool | get_vector_to_light (LVector3 &result, const LPoint3 &from_object_point, const LMatrix4 &to_object_space) |
Computes the vector from a particular vertex to this light. More... | |
GeomNode * | get_viz () |
Returns a GeomNode that may be rendered to visualize the Light. More... | |
bool | has_color_temperature () const |
Returns true if the color was specified as a temperature in kelvins, and get_color_temperature is defined. More... | |
virtual bool | is_ambient_light () const |
Returns true if this is an AmbientLight, false if it is some other kind of light. More... | |
virtual void | output (std::ostream &out) const =0 |
void | set_color (const LColor &color) |
void | set_color_temperature (PN_stdfloat temperature) |
void | set_priority (int priority) |
virtual void | write (std::ostream &out, int indent_level) const =0 |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static UpdateSeq | get_sort_seq () |
Returns a global sequence number that is incremented any time any Light in the world changes sort or priority. More... | |
static void | init_type () |
Public Attributes | |
get_color | |
Returns the basic color of the light. More... | |
get_color_temperature | |
Returns the basic color temperature of the light, assuming has_color_temperature() returns true. More... | |
get_priority | |
Returns the priority associated with this light. More... | |
set_color | |
Sets the basic color of the light. More... | |
set_color_temperature | |
Sets the color temperature of the light in kelvins. More... | |
set_priority | |
Changes the relative importance of this light relative to the other lights that are applied simultaneously. More... | |
The abstract interface to all kinds of lights.
The actual light objects also inherit from PandaNode, and can therefore be added to the scene graph at some arbitrary point to define the coordinate system of effect.
|
virtual |
This is called when the light is added to a LightAttrib.
Reimplemented in LightLensNode.
|
virtual |
This is called when the light is removed from a LightAttrib.
Reimplemented in LightLensNode.
Definition at line 173 of file light.cxx.
Referenced by LightAttrib::~LightAttrib().
|
virtual |
Returns the terms of the attenuation equation for the light.
These are, in order, the constant, linear, and quadratic terms based on the distance from the point to the vertex.
Reimplemented in Spotlight, and PointLight.
|
virtual |
|
inlinestatic |
Returns a global sequence number that is incremented any time any Light in the world changes sort or priority.
This is used by LightAttrib to determine when it is necessary to re-sort its internal array of stages.
|
virtual |
Returns the color of specular highlights generated by the light.
This value is meaningless for ambient lights.
Reimplemented in Spotlight, DirectionalLight, PointLight, and RectangleLight.
|
virtual |
Computes the vector from a particular vertex to this light.
The exact vector depends on the type of light (e.g. point lights return a different result than directional lights).
The input parameters are the vertex position in question, expressed in object space, and the matrix which converts from light space to object space. The result is expressed in object space.
The return value is true if the result is successful, or false if it cannot be computed (e.g. for an ambient light).
Reimplemented in Spotlight, DirectionalLight, and PointLight.
GeomNode * Light::get_viz | ( | ) |
|
inline |
|
virtual |
Returns true if this is an AmbientLight, false if it is some other kind of light.
Reimplemented in AmbientLight.
|
inline |
Returns the basic color of the light.
Definition at line 49 of file light.h.
Referenced by RectangleLight::get_specular_color().
|
inline |
Returns the basic color temperature of the light, assuming has_color_temperature() returns true.
|
inline |
Returns the priority associated with this light.
See set_priority().
|
inline |
void Light::set_color_temperature |
|
inline |
Changes the relative importance of this light relative to the other lights that are applied simultaneously.
The priority number is used to decide which of the requested lights are to be selected for rendering when more lights are requested than the hardware will support. The highest-priority n lights are selected for rendering.
This is similar to TextureStage::set_priority().