Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Light Class Reference

The abstract interface to all kinds of lights. More...

#include <light.h>

Inheritance diagram for Light:

ReferenceCount LightLensNode LightNode Spotlight AmbientLight DirectionalLight PointLight List of all members.

Public Member Functions

 Light ()
 Light (const Light &copy)
virtual ~Light ()
virtual PandaNodeas_node ()=0
const Colorfget_color () const
 Returns the basic color of the light.

void set_color (const Colorf &color)
 Sets the basic color of the light.

virtual void output (ostream &out) const=0
virtual void write (ostream &out, int indent_level) const=0
virtual void bind (GraphicsStateGuardianBase *gsg, int light_id)=0
GeomNodeget_viz ()
 Returns a GeomNode that may be rendered to visualize the Light.

virtual TypeHandle get_type () const
int get_ref_count () const
 Returns the current reference count.

int ref () const
 Explicitly increments the reference count.

int unref () const
 Explicitly decrements the reference count.

void test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.


Static Public Member Functions

TypeHandle get_class_type ()
void init_type ()

Protected Member Functions

virtual void fill_viz_geom (GeomNode *viz_geom)
 Fills the indicated GeomNode up with Geoms suitable for rendering this 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.

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.


Private Types

typedef CycleDataReader< CDataCDReader
typedef CycleDataWriter< CDataCDWriter

Private Attributes

PipelineCycler< CData_cycler

Static Private Attributes

TypeHandle _type_handle

Detailed Description

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.

Definition at line 53 of file light.h.


Member Typedef Documentation

typedef CycleDataReader<CData> Light::CDReader [private]
 

Reimplemented in DirectionalLight, PointLight, and Spotlight.

Definition at line 96 of file light.h.

typedef CycleDataWriter<CData> Light::CDWriter [private]
 

Reimplemented in DirectionalLight, PointLight, and Spotlight.

Definition at line 97 of file light.h.


Constructor & Destructor Documentation

Light::Light  )  [inline]
 

Definition at line 61 of file light.I.

References _cycler.

Light::Light const Light &  copy  )  [inline]
 

Definition at line 73 of file light.I.

Light::~Light  )  [virtual]
 

Definition at line 84 of file light.cxx.


Member Function Documentation

virtual PandaNode* Light::as_node  )  [pure virtual]
 

Implemented in LightLensNode, and LightNode.

virtual void Light::bind GraphicsStateGuardianBase gsg,
int  light_id
[pure virtual]
 

Implemented in AmbientLight, DirectionalLight, PointLight, and Spotlight.

void Light::fill_viz_geom GeomNode viz_geom  )  [protected, virtual]
 

Fills the indicated GeomNode up with Geoms suitable for rendering this light.

Reimplemented in Spotlight.

Definition at line 123 of file light.cxx.

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 154 of file light.cxx.

Referenced by LightNode::write(), and LightLensNode::write().

TypeHandle Light::get_class_type void   )  [inline, static]
 

Reimplemented from ReferenceCount.

Reimplemented in AmbientLight, DirectionalLight, LightLensNode, LightNode, PointLight, and Spotlight.

Definition at line 104 of file light.h.

const Colorf & Light::get_color void   )  const [inline]
 

Returns the basic color of the light.

Definition at line 87 of file light.I.

References _cycler, and INLINE.

Referenced by GraphicsStateGuardian::begin_decal_nested(), GLGraphicsStateGuardian::issue_alpha_test(), CRGraphicsStateGuardian::issue_color_write(), GLGraphicsStateGuardian::issue_cull_face(), CRGraphicsStateGuardian::issue_depth_write(), and Spotlight::write().

int ReferenceCount::get_ref_count  )  const [inline, inherited]
 

Returns the current reference count.

Definition at line 183 of file referenceCount.I.

Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture().

virtual TypeHandle Light::get_type void   )  const [inline, virtual]
 

Reimplemented in AmbientLight, DirectionalLight, LightLensNode, LightNode, PointLight, and Spotlight.

Definition at line 112 of file light.h.

Referenced by GraphicsStateGuardian::begin_decal_nested().

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 100 of file light.cxx.

References _cycler, and BamWriter::write_cdata().

void Light::init_type void   )  [inline, static]
 

Reimplemented from ReferenceCount.

Reimplemented in AmbientLight, DirectionalLight, LightLensNode, LightNode, PointLight, and Spotlight.

Definition at line 107 of file light.h.

void Light::mark_viz_stale  )  [inline, protected]
 

Indicates that the internal visualization object will need to be updated.

Definition at line 118 of file light.I.

Referenced by DirectionalLight::DirectionalLight(), PointLight::PointLight(), and Spotlight::Spotlight().

virtual void Light::output ostream &  out  )  const [pure virtual]
 

Implemented in LightLensNode, and LightNode.

int ReferenceCount::ref  )  const [inline, inherited]
 

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 225 of file referenceCount.I.

Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering().

void Light::set_color const Colorf color  )  [inline]
 

Sets the basic color of the light.

Definition at line 101 of file light.I.

void ReferenceCount::test_ref_count_integrity  )  const [inline, inherited]
 

Does some easy checks to make sure that the reference count isn't completely bogus.

Definition at line 328 of file referenceCount.I.

References INLINE.

Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount().

int ReferenceCount::unref  )  const [inline, inherited]
 

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 293 of file referenceCount.I.

References INLINE.

Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds().

virtual void Light::write ostream &  out,
int  indent_level
const [pure virtual]
 

Implemented in AmbientLight, DirectionalLight, LightLensNode, LightNode, PointLight, and Spotlight.

void Light::write_datagram BamWriter manager,
Datagram dg
[protected]
 

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 137 of file light.cxx.

Referenced by LightNode::output(), and LightLensNode::output().


Member Data Documentation

PipelineCycler<CData> Light::_cycler [private]
 

Reimplemented in DirectionalLight, PointLight, and Spotlight.

Definition at line 95 of file light.h.

Referenced by get_color(), get_viz(), and Light().

TypeHandle Light::_type_handle [static, private]
 

Reimplemented from ReferenceCount.

Reimplemented in AmbientLight, DirectionalLight, LightLensNode, LightNode, PointLight, and Spotlight.

Definition at line 28 of file light.cxx.


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:51:42 2003 for Panda by doxygen1.3