Panda3D
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
LightLensNode Class Reference

A derivative of Light and of Camera. More...

#include "lightLensNode.h"

Inheritance diagram for LightLensNode:
Light Camera ReferenceCount LensNode MemoryBase PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase DirectionalLight PointLight Spotlight

List of all members.

Public Member Functions

 LightLensNode (const string &name, Lens *lens=new PerspectiveLens())
virtual Lightas_light ()
 Cross-casts the node to a Light pointer, if it is one of the four kinds of Light nodes, or returns NULL if it is not.
virtual PandaNodeas_node ()
 Returns the Light object upcast to a PandaNode.
virtual TypeHandle force_init_type ()
virtual TypeHandle get_type () const
bool is_shadow_caster ()
 Returns whether this light is configured to cast shadows or not.
virtual void output (ostream &out) const
void set_shadow_caster (bool caster)
 Sets the flag indicating whether this light should cast shadows or not.
void set_shadow_caster (bool caster, int buffer_xsize, int buffer_ysize, int sort=-10)
 Sets the flag indicating whether this light should cast shadows or not.
virtual void write (ostream &out, int indent_level=0) const
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Protected Types

typedef pmap< PT(GraphicsStateGuardianBase),
PT(GraphicsOutputBase) > 
ShadowBuffers

Protected Member Functions

 LightLensNode (const LightLensNode &copy)
void clear_shadow_buffers ()
 Clears the shadow buffers, meaning they will be automatically recreated when the Shader Generator needs them.
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 LightLensNode.

Protected Attributes

int _sb_sort
int _sb_xsize
int _sb_ysize
ShadowBuffers _sbuffers
bool _shadow_caster

Friends

class GraphicsStateGuardian
class ShaderGenerator

Detailed Description

A derivative of Light and of Camera.

The name might be misleading: it does not directly derive from LensNode, but through the Camera class. The Camera serves no purpose unless shadows are enabled.

Definition at line 35 of file lightLensNode.h.


Member Function Documentation

Light * LightLensNode::as_light ( ) [virtual]

Cross-casts the node to a Light pointer, if it is one of the four kinds of Light nodes, or returns NULL if it is not.

Reimplemented from PandaNode.

Definition at line 109 of file lightLensNode.cxx.

Returns the Light object upcast to a PandaNode.

Implements Light.

Definition at line 97 of file lightLensNode.cxx.

Clears the shadow buffers, meaning they will be automatically recreated when the Shader Generator needs them.

Definition at line 83 of file lightLensNode.cxx.

Referenced by set_shadow_caster().

void LightLensNode::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new LightLensNode.

Reimplemented from Camera.

Reimplemented in Spotlight, DirectionalLight, and PointLight.

Definition at line 158 of file lightLensNode.cxx.

References DatagramIterator::get_bool(), DatagramIterator::get_int32(), and set_shadow_caster().

Referenced by PointLight::fillin().

Returns whether this light is configured to cast shadows or not.

Definition at line 22 of file lightLensNode.I.

void LightLensNode::set_shadow_caster ( bool  caster) [inline]

Sets the flag indicating whether this light should cast shadows or not.

This is the variant without buffer size, meaning that the current buffer size will be kept (512x512 is the default). Note that enabling shadows will require the shader generator to be enabled on the scene.

Definition at line 37 of file lightLensNode.I.

References clear_shadow_buffers(), and Camera::set_active().

Referenced by fillin().

void LightLensNode::set_shadow_caster ( bool  caster,
int  buffer_xsize,
int  buffer_ysize,
int  buffer_sort = -10 
) [inline]

Sets the flag indicating whether this light should cast shadows or not.

The xsize and ysize parameters specify the size of the shadow buffer that will be set up, the sort parameter specifies the sort. Note that enabling shadows will require the shader generator to be enabled on the scene.

Definition at line 56 of file lightLensNode.I.

References clear_shadow_buffers(), and Camera::set_active().

void LightLensNode::write_datagram ( BamWriter manager,
Datagram dg 
) [virtual]

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from Camera.

Reimplemented in Spotlight, DirectionalLight, and PointLight.

Definition at line 140 of file lightLensNode.cxx.

References Datagram::add_bool(), and Datagram::add_int32().

Referenced by PointLight::write_datagram().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations