A node that contains a Lens. More...

#include "lensNode.h"

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

List of all members.

Classes

class  LensSlot

Public Member Functions

 LensNode (const string &name, Lens *lens=NULL)
bool activate_lens (int index)
 An alternate way to call set_lens_active(index, true).
virtual int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
void copy_lens (const Lens &lens)
 Sets up the LensNode using a copy of the indicated Lens.
void copy_lens (int index, const Lens &lens)
 Copies the indicated lens into the specified slot.
bool deactivate_lens (int index)
 An alternate way to call set_lens_active(index, false).
virtual TypeHandle force_init_type ()
Lensget_lens (int index=0) const
 Returns a pointer to the particular Lens associated with this LensNode, or NULL if there is not yet a Lens associated.
bool get_lens_active (int index) const
 Returns the active flag for the nth lens.
virtual TypeHandle get_type () const
void hide_frustum ()
 Disables the drawing of the lens's frustum to aid in visualization.
bool is_in_view (int index, const LPoint3f &pos)
 Returns true if the given point is within the bounds of the lens of the LensNode (i.e.
bool is_in_view (const LPoint3f &pos)
 Returns true if the given point is within the bounds of the lens of the LensNode (i.e.
virtual PandaNodemake_copy () const
 Returns a newly-allocated Node that is a shallow copy of this one.
virtual void output (ostream &out) const
 Outputs the Namable.
void set_lens (Lens *lens)
 Sets up the LensNode using this particular Lens pointer.
void set_lens (int index, Lens *lens)
 Sets the indicated lens.
bool set_lens_active (int index, bool active)
 Sets the active flag for the nth lens.
void show_frustum ()
 Enables the drawing of the lens's frustum to aid in visualization.
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.
virtual void xform (const LMatrix4f &mat)
 Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type LensNode.

Protected Types

typedef pvector< LensSlotLenses

Protected Member Functions

 LensNode (const LensNode &copy)
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 LensNode.
 PT (PandaNode) _shown_frustum

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type LensNode is encountered in the Bam file.

Protected Attributes

Lenses _lenses

Detailed Description

A node that contains a Lens.

The most important example of this kind of node is a Camera, but other kinds of nodes also contain a lens (for instance, a Spotlight).

Definition at line 32 of file lensNode.h.


Member Function Documentation

bool LensNode::activate_lens ( int  index) [inline]

An alternate way to call set_lens_active(index, true).

Definition at line 91 of file lensNode.I.

References set_lens_active().

int LensNode::complete_pointers ( TypedWritable **  p_list,
BamReader manager 
) [virtual]

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

Reimplemented from TypedWritable.

Definition at line 271 of file lensNode.cxx.

References set_lens().

void LensNode::copy_lens ( const Lens lens) [inline]

Sets up the LensNode using a copy of the indicated Lens.

If the original Lens is changed or destroyed, this LensNode is not affected.

Definition at line 25 of file lensNode.I.

void LensNode::copy_lens ( int  index,
const Lens lens 
) [inline]

Copies the indicated lens into the specified slot.

Definition at line 35 of file lensNode.I.

References set_lens().

bool LensNode::deactivate_lens ( int  index) [inline]

An alternate way to call set_lens_active(index, false).

Definition at line 102 of file lensNode.I.

References set_lens_active().

void LensNode::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 LensNode.

Reimplemented from PandaNode.

Reimplemented in Camera, DirectionalLight, LightLensNode, PointLight, and Spotlight.

Definition at line 305 of file lensNode.cxx.

References BamReader::read_pointer().

Referenced by make_from_bam().

Lens * LensNode::get_lens ( int  index = 0) const [inline]

Returns a pointer to the particular Lens associated with this LensNode, or NULL if there is not yet a Lens associated.

If an index number is specified, returns the nth lens.

Definition at line 60 of file lensNode.I.

Referenced by TinyGraphicsStateGuardian::bind_light(), DXGraphicsStateGuardian9::bind_light(), DXGraphicsStateGuardian8::bind_light(), Spotlight::fill_viz_geom(), is_in_view(), CollisionSegment::set_from_lens(), CollisionRay::set_from_lens(), and write_datagram().

bool LensNode::get_lens_active ( int  index) const [inline]

Returns the active flag for the nth lens.

Definition at line 75 of file lensNode.I.

void LensNode::hide_frustum ( )

Disables the drawing of the lens's frustum to aid in visualization.

Definition at line 190 of file lensNode.cxx.

References PandaNode::remove_child().

Referenced by show_frustum().

bool LensNode::is_in_view ( const LPoint3f pos) [inline]

Returns true if the given point is within the bounds of the lens of the LensNode (i.e.

if the camera can see the point).

Definition at line 114 of file lensNode.I.

bool LensNode::is_in_view ( int  index,
const LPoint3f pos 
)

Returns true if the given point is within the bounds of the lens of the LensNode (i.e.

if the camera can see the point).

Definition at line 146 of file lensNode.cxx.

References GeometricBoundingVolume::contains(), and get_lens().

PandaNode * LensNode::make_copy ( ) const [virtual]

Returns a newly-allocated Node that is a shallow copy of this one.

It will be a different Node pointer, but its internal data may or may not be shared with that of the original Node.

Reimplemented from PandaNode.

Reimplemented in Camera, DirectionalLight, PointLight, and Spotlight.

Definition at line 75 of file lensNode.cxx.

TypedWritable * LensNode::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type LensNode is encountered in the Bam file.

It should create the LensNode and extract its information from the file.

Reimplemented from PandaNode.

Reimplemented in Camera, DirectionalLight, PointLight, and Spotlight.

Definition at line 286 of file lensNode.cxx.

References fillin().

Referenced by register_with_read_factory().

void LensNode::output ( ostream &  out) const [virtual]

Outputs the Namable.

This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

Reimplemented from PandaNode.

Definition at line 203 of file lensNode.cxx.

void LensNode::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type LensNode.

Reimplemented from PandaNode.

Reimplemented in Camera, DirectionalLight, PointLight, and Spotlight.

Definition at line 243 of file lensNode.cxx.

References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().

void LensNode::set_lens ( int  index,
Lens lens 
)

Sets the indicated lens.

Although a LensNode normally holds only one lens, it may optionally include multiple lenses, each with a different index number. The different lenses may be referenced by index number on the DisplayRegion. Adding a new lens automatically makes it active.

Definition at line 90 of file lensNode.cxx.

References show_frustum().

void LensNode::set_lens ( Lens lens) [inline]

Sets up the LensNode using this particular Lens pointer.

If the lens is subsequently modified, the LensNode properties immediately reflect the change.

Definition at line 47 of file lensNode.I.

References set_lens().

Referenced by complete_pointers(), copy_lens(), and set_lens().

bool LensNode::set_lens_active ( int  index,
bool  flag 
)

Sets the active flag for the nth lens.

When a lens is inactive, it is not used for rendering, and any DisplayRegions associated with it are implicitly inactive as well. Returns true if the flag is changed, false if it already had this value.

Definition at line 117 of file lensNode.cxx.

References show_frustum().

Referenced by activate_lens(), and deactivate_lens().

void LensNode::show_frustum ( )

Enables the drawing of the lens's frustum to aid in visualization.

This actually creates a GeomNode which is parented to the LensNode.

Definition at line 166 of file lensNode.cxx.

References PandaNode::add_child(), and hide_frustum().

Referenced by set_lens(), and set_lens_active().

void LensNode::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 PandaNode.

Reimplemented in Camera, DirectionalLight, LightLensNode, PointLight, and Spotlight.

Definition at line 254 of file lensNode.cxx.

References get_lens(), and BamWriter::write_pointer().

void LensNode::xform ( const LMatrix4f mat) [virtual]

Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.

For most kinds of PandaNodes, this does nothing.

Reimplemented from PandaNode.

Reimplemented in DirectionalLight, PointLight, and Spotlight.

Definition at line 61 of file lensNode.cxx.

Referenced by PointLight::xform().


The documentation for this class was generated from the following files: