Panda3D
|
The abstract interface to all kinds of lights. More...
#include "light.h"
Classes | |
class | CData |
Public Member Functions | |
Light (const Light ©) | |
virtual PandaNode * | as_node ()=0 |
virtual void | bind (GraphicsStateGuardianBase *gsg, const NodePath &light, int light_id)=0 |
virtual int | get_class_priority () const =0 |
const LColor & | get_color () const |
Returns the basic color of the light. | |
int | get_priority () const |
Returns the priority associated with this light. | |
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. | |
GeomNode * | get_viz () |
Returns a GeomNode that may be rendered to visualize the Light. | |
virtual bool | is_ambient_light () const |
Returns true if this is an AmbientLight, false if it is some other kind of light. | |
virtual void | output (ostream &out) const =0 |
void | set_color (const LColor &color) |
Sets the basic color of the light. | |
void | set_priority (int priority) |
Changes the relative importance of this light relative to the other lights that are applied simultaneously. | |
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. | |
static void | init_type () |
Protected Types | |
enum | ClassPriority { CP_ambient_priority, CP_point_priority, CP_directional_priority, CP_spot_priority } |
Protected Member Functions | |
virtual void | fill_viz_geom (GeomNode *viz_geom) |
Fills the indicated GeomNode up with Geoms suitable for rendering this light. | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new Light. | |
void | mark_viz_stale () |
Indicates that the internal visualization object will need to be updated. | |
void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. |
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.
void Light::fill_viz_geom | ( | GeomNode * | viz_geom | ) | [protected, virtual] |
void Light::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected] |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new Light.
Reimplemented in AmbientLight, DirectionalLight, LightLensNode, LightNode, PointLight, and Spotlight.
Definition at line 151 of file light.cxx.
References DatagramIterator::get_int32(), and BamReader::read_cdata().
const LColor & Light::get_color | ( | ) | const [inline] |
Returns the basic color of the light.
Definition at line 70 of file light.I.
Referenced by SpeedTreeNode::cull_callback(), DXGraphicsStateGuardian9::get_light_color(), and DXGraphicsStateGuardian8::get_light_color().
int Light::get_priority | ( | ) | const [inline] |
Returns the priority associated with this light.
See set_priority().
Definition at line 118 of file light.I.
Referenced by SpeedTreeNode::cull_callback().
UpdateSeq Light::get_sort_seq | ( | ) | [inline, static] |
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.
bool Light::get_vector_to_light | ( | LVector3 & | result, |
const LPoint3 & | from_object_point, | ||
const LMatrix4 & | to_object_space | ||
) | [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 DirectionalLight, PointLight, and Spotlight.
GeomNode * Light::get_viz | ( | ) |
Returns a GeomNode that may be rendered to visualize the Light.
This is used during the cull traversal to render the Lights that have been made visible.
Definition at line 109 of file light.cxx.
References fill_viz_geom().
bool Light::is_ambient_light | ( | ) | const [virtual] |
Returns true if this is an AmbientLight, false if it is some other kind of light.
Reimplemented in AmbientLight.
void Light::mark_viz_stale | ( | ) | [inline, protected] |
Indicates that the internal visualization object will need to be updated.
Definition at line 143 of file light.I.
Referenced by set_color(), DirectionalLight::set_direction(), DirectionalLight::set_point(), PointLight::set_point(), Spotlight::xform(), and DirectionalLight::xform().
void Light::set_color | ( | const LColor & | color | ) | [inline] |
Sets the basic color of the light.
Definition at line 81 of file light.I.
References mark_viz_stale().
void Light::set_priority | ( | int | priority | ) | [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().
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented in AmbientLight, DirectionalLight, LightLensNode, LightNode, PointLight, and Spotlight.
Definition at line 138 of file light.cxx.
References Datagram::add_int32(), and BamWriter::write_cdata().