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

A light originating from a single point in space, and shining in all directions. More...

#include "pointLight.h"

Inheritance diagram for PointLight:
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

 PointLight (const string &name)
virtual void bind (GraphicsStateGuardianBase *gsg, const NodePath &light, int light_id)
virtual TypeHandle force_init_type ()
const LVecBase3get_attenuation () const
 Returns the terms of the attenuation equation for the light.
virtual int get_class_priority () const
 Returns the relative priority associated with all lights of this class.
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_attenuation (const LVecBase3 &attenuation)
 Sets the terms of the attenuation equation for the light.
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 PointLight.

Protected Member Functions

 PointLight (const PointLight &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 PointLight.

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

Detailed Description

A light originating from a single point in space, and shining in all directions.

Definition at line 27 of file pointLight.h.


Constructor & Destructor Documentation

PointLight::PointLight ( const PointLight 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 99 of file pointLight.cxx.

References Lens::set_view_vector().


Member Function Documentation

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

Reimplemented from LightLensNode.

Definition at line 272 of file pointLight.cxx.

References LightLensNode::fillin(), and BamReader::read_cdata().

Referenced by make_from_bam().

const LVecBase3 & PointLight::get_attenuation ( ) const [inline]

Returns the terms of the attenuation equation for the light.

These are, in order, the constant, linear, and quadratic terms based on the distance from the point to the vertex.

Definition at line 75 of file pointLight.I.

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

int PointLight::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 207 of file pointLight.cxx.

const LPoint3 & PointLight::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.

Definition at line 102 of file pointLight.I.

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

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

Returns the color of specular highlights generated by the light.

Definition at line 49 of file pointLight.I.

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

bool PointLight::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 187 of file pointLight.cxx.

PandaNode * PointLight::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 134 of file pointLight.cxx.

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

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

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

Reimplemented from Camera.

Definition at line 253 of file pointLight.cxx.

References fillin().

Tells the BamReader how to create objects of type PointLight.

Reimplemented from Camera.

Definition at line 228 of file pointLight.cxx.

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

void PointLight::set_attenuation ( const LVecBase3 attenuation) [inline]

Sets the terms of the attenuation equation for the light.

These are, in order, the constant, linear, and quadratic terms based on the distance from the point to the vertex.

Definition at line 89 of file pointLight.I.

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

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

Definition at line 113 of file pointLight.I.

References Light::mark_viz_stale().

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

Sets the color of specular highlights generated by the light.

Definition at line 61 of file pointLight.I.

void PointLight::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 239 of file pointLight.cxx.

References BamWriter::write_cdata(), and LightLensNode::write_datagram().

void PointLight::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 146 of file pointLight.cxx.

References LensNode::xform().


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