15 #include "directionalLight.h"
16 #include "orthographicLens.h"
17 #include "graphicsStateGuardianBase.h"
18 #include "bamWriter.h"
19 #include "bamReader.h"
21 #include "datagramIterator.h"
32 return new CData(*
this);
41 void DirectionalLight::CData::
43 _specular_color.write_datagram(dg);
44 _point.write_datagram(dg);
45 _direction.write_datagram(dg);
55 void DirectionalLight::CData::
57 _specular_color.read_datagram(scan);
58 _point.read_datagram(scan);
59 _direction.read_datagram(scan);
68 DirectionalLight(
const string &name) :
112 cdata->_point = cdata->_point * mat;
113 cdata->_direction = cdata->_direction * mat;
122 void DirectionalLight::
123 write(ostream &out,
int indent_level)
const {
124 indent(out, indent_level) << *
this <<
":\n";
125 indent(out, indent_level + 2)
127 indent(out, indent_level + 2)
129 indent(out, indent_level + 2)
154 result = -(cdata->_direction * to_object_space);
171 return (
int)CP_directional_priority;
179 void DirectionalLight::
181 gsg->bind_light(
this, light, light_id);
221 parse_params(params, scan, manager);
222 node->fillin(scan, manager);
234 void DirectionalLight::
236 LightLensNode::fillin(scan, manager);
A light shining from infinitely far away in a particular direction, like sunlight.
A basic node of the scene graph or data graph.
static void register_with_read_factory()
Tells the BamReader how to create objects of type DirectionalLight.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void read_cdata(DatagramIterator &scan, PipelineCyclerBase &cycler)
Reads in the indicated CycleData object.
virtual int get_class_priority() const
Returns the relative priority associated with all lights of this class.
A single page of data maintained by a PipelineCycler.
Base class for objects that can be written to and read from Bam files.
void write_cdata(Datagram &packet, const PipelineCyclerBase &cycler)
Writes out the indicated CycleData object.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so...
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
const LColor & get_specular_color() const FINAL
Returns the color of specular highlights generated by the light.
This is a 4-by-4 transform matrix.
const LVector3 & get_direction() const
Returns the direction in which the light is aimed.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so...
A derivative of Light and of Camera.
const LColor & get_color() const
Returns the basic color of the light.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
A class to retrieve the individual data elements previously stored in a Datagram. ...
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 PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
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.