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 | 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 |
Returns the basic color of the light. More... | |
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 |
Returns the priority associated with this light. More... | |
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... | |
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 (ostream &out) const =0 |
void | set_color (const LColor &color) |
Sets the basic color of the light. More... | |
void | set_priority (int priority) |
Changes the relative importance of this light relative to the other lights that are applied simultaneously. More... | |
virtual void | write (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 () |
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 |
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.
Definition at line 113 of file light.cxx.
Referenced by GraphicsStateGuardian::fetch_specified_part().
|
inline |
Returns the basic color of the light.
Definition at line 70 of file light.I.
Referenced by SpeedTreeNode::cull_callback(), and GraphicsStateGuardian::fetch_specified_part().
|
virtual |
For spotlights, returns the exponent that controls the amount of light falloff from the center of the spotlight.
For other kinds of lights, returns 0.
Reimplemented in Spotlight.
Definition at line 87 of file light.cxx.
Referenced by GraphicsStateGuardian::fetch_specified_part().
|
inline |
Returns the priority associated with this light.
See set_priority().
Definition at line 118 of file light.I.
Referenced by SpeedTreeNode::cull_callback().
|
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, and PointLight.
Definition at line 99 of file light.cxx.
Referenced by GraphicsStateGuardian::fetch_specified_part().
|
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 | ( | ) |
|
virtual |
Returns true if this is an AmbientLight, false if it is some other kind of light.
Reimplemented in AmbientLight.
|
inline |
|
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().