66xform(
const LMatrix4 &mat) {
67 nassertv(!mat.is_nan());
69 if (mat.almost_equal(LMatrix4::ident_mat())) {
73 _position = _position * mat;
77 LVector3 radius_v = LVector3(_radius, 0.0f, 0.0f) * mat;
78 _radius = length(radius_v);
79 mark_internal_bounds_stale();
91 PN_stdfloat variation= 0.0;
98 if (_flicker_type == FRANDOM) {
100 variation = (rand()%100);
103 pgraph_cat.info() <<
"Random Variation: " << variation << std::endl;
104 }
else if (_flicker_type == FSIN) {
106 variation = sinf(now*_sin_freq);
108 pgraph_cat.info() <<
"Variation: " << variation << std::endl;
112 }
else if (_flicker_type == FCUSTOM) {
137 pgraph_cat.debug() <<
"Color R:" << r <<
"; G:" << g <<
"; B:" << b << std::endl;
138 return LColor(r,g,b,1.0);
155 if (_enabled != other._enabled) {
156 return _enabled ? 1 :-1;
159 if (_radius != other._radius) {
160 return _radius < other._radius ? -1 :1;
162 LVecBase3 position =
get_pos();
163 LVecBase3 other_position = other.
get_pos();
164 if (position != other_position) {
165 return position < other_position ? -1 :1;
170 if (color != other_color) {
171 return color < other_color ? -1 :1;
174 if (_attenuation_type != other._attenuation_type) {
175 return _attenuation_type < other._attenuation_type ? -1 :1;
178 if (_a0 != other._a0) {
179 return _a0 < other._a0 ? -1 :1;
182 if (_a1 != other._a1) {
183 return _a1 < other._a1 ? -1 :1;
186 if (_a2 != other._a2) {
187 return _a2 < other._a2 ? -1 :1;
190 if (_flickering != other._flickering) {
191 return _flickering ? 1 :-1;
194 if (_flicker_type != other._flicker_type) {
195 return _flicker_type < other._flicker_type ? -1 :1;
198 if (_offset != other._offset) {
199 return _offset < other._offset ? -1 :1;
202 if (_scale != other._scale) {
203 return _scale < other._scale ? -1 :1;
206 if (_step_size != other._step_size) {
207 return _step_size < other._step_size ? -1 :1;
210 if (_sin_freq != other._sin_freq) {
211 return _sin_freq < other._sin_freq ? -1 :1;
236 _position.write_datagram(dg);
238 color.set(_color[0], _color[1], _color[2]);
239 color.write_datagram(dg);
255 light->fillin(scan, manager);
266 PandaNode::fillin(scan, manager);
267 _position.read_datagram(scan);
269 color.read_datagram(scan);
280output(std::ostream &out)
const {
281 out << get_type() <<
":";
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,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
A class to retrieve the individual data elements previously stored in a Datagram.
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_stdfloat(PN_stdfloat value)
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
A basic node of the scene graph or data graph.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
LPoint3 get_pos() const
Returns position as a LPoint3.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
void set_pos(const LPoint3 &position)
Set this light's position.
PN_stdfloat get_radius() const
Get radius of the spherical light volume.
bool set_flicker_type(Flicker_Type type)
Flicker type can be FRANDOM or FSIN At a later point there might be a FCUSTOM Custom flicker will be ...
static void register_with_read_factory()
Tells the BamReader how to create objects of type PolylightNode.
LColor flicker() const
If flickering is on, the do_poly_light function in PolylightNodeEffect will compute this light's colo...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
LColor get_color() const
Returns the light's color as LColor.
PolylightNode(const std::string &name)
Use PolylightNode() to construct a new PolylightNode object.
bool set_attenuation(Attenuation_Type type)
Set ALINEAR or AQUADRATIC attenuation.
int compare_to(const PolylightNode &other) const
Returns a number less than zero if this PolylightNode sorts before the other one, greater than zero i...
void set_color(const LColor &color)
Set the light's color...
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this node by the indicated matrix, if it means anything to do so.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.