Panda3D
rectangleLight.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file rectangleLight.h
10  * @author rdb
11  * @date 2016-12-19
12  */
13 
14 #ifndef RECTANGLELIGHT_H
15 #define RECTANGLELIGHT_H
16 
17 #include "pandabase.h"
18 
19 #include "lightLensNode.h"
20 #include "pointLight.h"
21 
22 /**
23  * This is a type of area light that is an axis aligned rectangle, pointing
24  * along the Y axis in the positive direction.
25  */
26 class EXPCL_PANDA_PGRAPHNODES RectangleLight : public LightLensNode {
27 PUBLISHED:
28  explicit RectangleLight(const std::string &name);
29 
30 protected:
31  RectangleLight(const RectangleLight &copy);
32 
33 public:
34  virtual PandaNode *make_copy() const;
35  virtual void write(std::ostream &out, int indent_level) const;
36 
37 PUBLISHED:
38  INLINE const LColor &get_specular_color() const final;
39 
40  INLINE PN_stdfloat get_max_distance() const;
41  INLINE void set_max_distance(PN_stdfloat max_distance);
42  MAKE_PROPERTY(max_distance, get_max_distance, set_max_distance);
43 
44  virtual int get_class_priority() const;
45 
46 public:
47  virtual void bind(GraphicsStateGuardianBase *gsg, const NodePath &light,
48  int light_id);
49 
50 private:
51  // This is the data that must be cycled between pipeline stages.
52  class EXPCL_PANDA_PGRAPHNODES CData : public CycleData {
53  public:
54  INLINE CData();
55  INLINE CData(const CData &copy);
56  virtual CycleData *make_copy() const;
57  virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
58  virtual void fillin(DatagramIterator &scan, BamReader *manager);
59  virtual TypeHandle get_parent_type() const {
60  return RectangleLight::get_class_type();
61  }
62 
63  PN_stdfloat _max_distance;
64  };
65 
66  PipelineCycler<CData> _cycler;
67  typedef CycleDataReader<CData> CDReader;
68  typedef CycleDataWriter<CData> CDWriter;
69 
70 public:
71  static void register_with_read_factory();
72  virtual void write_datagram(BamWriter *manager, Datagram &dg);
73 
74 protected:
75  static TypedWritable *make_from_bam(const FactoryParams &params);
76  void fillin(DatagramIterator &scan, BamReader *manager);
77 
78 public:
79  static TypeHandle get_class_type() {
80  return _type_handle;
81  }
82  static void init_type() {
83  LightLensNode::init_type();
84  register_type(_type_handle, "RectangleLight",
85  LightLensNode::get_class_type());
86  }
87  virtual TypeHandle get_type() const {
88  return get_class_type();
89  }
90  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
91 
92 private:
93  static TypeHandle _type_handle;
94 };
95 
96 #include "rectangleLight.I"
97 
98 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
virtual const LColor & get_specular_color() const
Returns the color of specular highlights generated by the light.
Definition: light.cxx:144
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:47
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(), along with zero to four record_derivation()s.
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual TypeHandle get_parent_type() const
Returns the type of the container that owns the CycleData.
Definition: cycleData.cxx:76
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
Definition: camera.cxx:69
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
virtual void write_datagram(BamWriter *, Datagram &) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: cycleData.cxx:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class&#39;s make_from_bam() method to read in all...
Definition: cycleData.cxx:58
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A derivative of Light and of Camera.
Definition: lightLensNode.h:33
A class to retrieve the individual data elements previously stored in a Datagram. ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
This is a type of area light that is an axis aligned rectangle, pointing along the Y axis in the posi...