Go to the documentation of this file.
29 return new CData(*
this);
36 void DirectionalLight::CData::
38 _specular_color.write_datagram(dg);
39 _point.write_datagram(dg);
40 _direction.write_datagram(dg);
47 void DirectionalLight::CData::
49 _specular_color.read_datagram(scan);
50 _point.read_datagram(scan);
51 _direction.read_datagram(scan);
58 DirectionalLight(
const std::string &name) :
60 _lenses[0]._lens->set_interocular_distance(0);
89 xform(
const LMatrix4 &mat) {
92 cdata->_point = cdata->_point * mat;
93 cdata->_direction = cdata->_direction * mat;
100 void DirectionalLight::
101 write(std::ostream &out,
int indent_level)
const {
102 indent(out, indent_level) << *
this <<
":\n";
103 indent(out, indent_level + 2)
105 if (_has_specular_color) {
106 indent(out, indent_level + 2)
109 indent(out, indent_level + 2)
127 const LMatrix4 &to_object_space) {
129 result = -(cdata->_direction * to_object_space);
142 return (
int)CP_directional_priority;
148 void DirectionalLight::
150 gsg->bind_light(
this, light, light_id);
186 node->fillin(scan, manager);
195 void DirectionalLight::
197 LightLensNode::fillin(scan, manager);
200 _has_specular_color = scan.
get_bool();
202 _has_specular_color =
true;
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
A single page of data maintained by a PipelineCycler.
get_direction
Returns the direction in which the light is aimed.
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
A class to retrieve the individual data elements previously stored in a Datagram.
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.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
get_specular_color
Returns the color of specular highlights generated by the light.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being written.
TypeHandle is the identifier used to differentiate C++ class types.
bool get_bool()
Extracts a boolean value.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
void read_cdata(DatagramIterator &scan, PipelineCyclerBase &cycler)
Reads in the indicated CycleData object.
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...
virtual int get_class_priority() const
Returns the relative priority associated with all lights of this class.
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 template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
get_color
Returns the basic color of the light.
A light shining from infinitely far away in a particular direction, like sunlight.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
void write_cdata(Datagram &packet, const PipelineCyclerBase &cycler)
Writes out the indicated CycleData object.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
void add_bool(bool value)
Adds a boolean value to the datagram.
A derivative of Light and of Camera.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type DirectionalLight.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...