15 #include "pointLight.h"
16 #include "graphicsStateGuardianBase.h"
17 #include "bamWriter.h"
18 #include "bamReader.h"
20 #include "datagramIterator.h"
31 return new CData(*
this);
40 void PointLight::CData::
42 _specular_color.write_datagram(dg);
43 _attenuation.write_datagram(dg);
44 _point.write_datagram(dg);
54 void PointLight::CData::
56 _specular_color.read_datagram(scan);
57 _attenuation.read_datagram(scan);
58 _point.read_datagram(scan);
67 PointLight(
const string &name) :
72 lens->set_view_vector(1, 0, 0, 0, 0, 1);
74 lens = new PerspectiveLens(90, 90);
75 lens->set_view_vector(-1, 0, 0, 0, 0, 1);
77 lens = new PerspectiveLens(90, 90);
78 lens->set_view_vector(0, 1, 0, 0, 0, 1);
80 lens = new PerspectiveLens(90, 90);
81 lens->set_view_vector(0, -1, 0, 0, 0, 1);
83 lens = new PerspectiveLens(90, 90);
84 lens->set_view_vector(0, 0, 1, 0, 0, 1);
86 lens = new PerspectiveLens(90, 90);
87 lens->set_view_vector(0, 0, -1, 0, 0, 1);
101 _cycler(copy._cycler)
104 lens = new PerspectiveLens(90, 90);
105 lens->set_view_vector(1, 0, 0, 0, 0, 1);
107 lens = new PerspectiveLens(90, 90);
108 lens->set_view_vector(-1, 0, 0, 0, 0, 1);
110 lens = new PerspectiveLens(90, 90);
111 lens->set_view_vector(0, 1, 0, 0, 0, 1);
113 lens = new PerspectiveLens(90, 90);
114 lens->set_view_vector(0, -1, 0, 0, 0, 1);
116 lens = new PerspectiveLens(90, 90);
117 lens->set_view_vector(0, 0, 1, 0, 0, 1);
119 lens = new PerspectiveLens(90, 90);
120 lens->set_view_vector(0, 0, -1, 0, 0, 1);
149 cdata->_point = cdata->_point * mat;
159 write(ostream &out,
int indent_level)
const {
160 indent(out, indent_level) << *
this <<
":\n";
161 indent(out, indent_level + 2)
162 <<
"color " << get_color() <<
"\n";
163 indent(out, indent_level + 2)
164 <<
"specular color " << get_specular_color() <<
"\n";
165 indent(out, indent_level + 2)
166 <<
"attenuation " << get_attenuation() <<
"\n";
190 LPoint3 point = cdata->_point * to_object_space;
192 result = point - from_object_point;
208 return (
int)CP_point_priority;
218 gsg->bind_light(
this, light, light_id);
258 parse_params(params, scan, manager);
259 node->fillin(scan, manager);
273 LightLensNode::fillin(scan, manager);
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.
A basic node of the scene graph or data graph.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so...
A base class for any number of different kinds of lenses, linear and otherwise.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
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.
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.
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 ...
This is a 4-by-4 transform matrix.
A perspective-type lens: a normal camera.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
static void register_with_read_factory()
Tells the BamReader how to create objects of type PointLight.
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.
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. ...
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 ...
virtual int get_class_priority() const
Returns the relative priority associated with all lights of this class.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
A light originating from a single point in space, and shining in all directions.