Panda3D
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions
DirectionalLight Class Reference

A light shining from infinitely far away in a particular direction, like sunlight. More...

#include "directionalLight.h"

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

List of all members.

Classes

class  CData

Public Member Functions

 DirectionalLight (const string &name)
virtual void bind (GraphicsStateGuardianBase *gsg, const NodePath &light, int light_id)
virtual TypeHandle force_init_type ()
virtual int get_class_priority () const
 Returns the relative priority associated with all lights of this class.
const LVector3get_direction () const
 Returns the direction in which the light is aimed.
const LPoint3get_point () const
 Returns the point in space at which the light is located.
const LColorget_specular_color () const
 Returns the color of specular highlights generated by the 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.
virtual PandaNodemake_copy () const
 Returns a newly-allocated PandaNode that is a shallow copy of this one.
void set_direction (const LVector3 &direction)
 Sets the direction in which the light is aimed.
void set_point (const LPoint3 &point)
 Sets the point in space at which the light is located.
void set_specular_color (const LColor &color)
 Sets the color of specular highlights generated by the light.
virtual void write (ostream &out, int indent_level) 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 LMatrix4 &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 DirectionalLight.

Protected Member Functions

 DirectionalLight (const DirectionalLight &copy)
 Do not call the copy constructor directly; instead, use make_copy() or copy_subgraph() to make a copy of a node.
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 DirectionalLight.

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 DirectionalLight is encountered in the Bam file.

Detailed Description

A light shining from infinitely far away in a particular direction, like sunlight.

Definition at line 27 of file directionalLight.h.


Constructor & Destructor Documentation

DirectionalLight::DirectionalLight ( const DirectionalLight copy) [protected]

Do not call the copy constructor directly; instead, use make_copy() or copy_subgraph() to make a copy of a node.

Definition at line 81 of file directionalLight.cxx.


Member Function Documentation

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

Reimplemented from LightLensNode.

Definition at line 235 of file directionalLight.cxx.

References BamReader::read_cdata().

Referenced by make_from_bam().

int DirectionalLight::get_class_priority ( ) const [virtual]

Returns the relative priority associated with all lights of this class.

This priority is used to order lights whose instance priority (get_priority()) is the same--the idea is that other things being equal, AmbientLights (for instance) are less important than DirectionalLights.

Implements Light.

Definition at line 170 of file directionalLight.cxx.

const LVector3 & DirectionalLight::get_direction ( ) const [inline]

Returns the direction in which the light is aimed.

This is local to the coordinate space in which the light is assigned.

Definition at line 104 of file directionalLight.I.

Referenced by TinyGraphicsStateGuardian::bind_light(), DXGraphicsStateGuardian8::bind_light(), DXGraphicsStateGuardian9::bind_light(), and SpeedTreeNode::cull_callback().

const LPoint3 & DirectionalLight::get_point ( ) const [inline]

Returns the point in space at which the light is located.

This is local to the coordinate space in which the light is assigned.

This actually has no bearing on the visual effect of the light, since the light is rendered as if it were infinitely far away. This is only used to create a visible representation of the light.

Definition at line 79 of file directionalLight.I.

const LColor & DirectionalLight::get_specular_color ( ) const [inline]

Returns the color of specular highlights generated by the light.

Definition at line 49 of file directionalLight.I.

Referenced by TinyGraphicsStateGuardian::bind_light(), DXGraphicsStateGuardian8::bind_light(), and DXGraphicsStateGuardian9::bind_light().

bool DirectionalLight::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 from Light.

Definition at line 151 of file directionalLight.cxx.

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

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

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

Reimplemented from Camera.

Definition at line 97 of file directionalLight.cxx.

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

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

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

Reimplemented from Camera.

Definition at line 216 of file directionalLight.cxx.

References fillin().

Referenced by register_with_read_factory().

Tells the BamReader how to create objects of type DirectionalLight.

Reimplemented from Camera.

Definition at line 191 of file directionalLight.cxx.

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

void DirectionalLight::set_direction ( const LVector3 direction) [inline]

Sets the direction in which the light is aimed.

Definition at line 115 of file directionalLight.I.

References Light::mark_viz_stale().

void DirectionalLight::set_point ( const LPoint3 point) [inline]

Sets the point in space at which the light is located.

Definition at line 90 of file directionalLight.I.

References Light::mark_viz_stale().

void DirectionalLight::set_specular_color ( const LColor color) [inline]

Sets the color of specular highlights generated by the light.

Definition at line 61 of file directionalLight.I.

void DirectionalLight::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 LightLensNode.

Definition at line 202 of file directionalLight.cxx.

References BamWriter::write_cdata().

void DirectionalLight::xform ( const LMatrix4 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 LensNode.

Definition at line 109 of file directionalLight.cxx.

References Light::mark_viz_stale().


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