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 * @since 1.10.0
27 */
28 class EXPCL_PANDA_PGRAPHNODES RectangleLight : public LightLensNode {
29 PUBLISHED:
30 explicit RectangleLight(const std::string &name);
31
32 protected:
33 RectangleLight(const RectangleLight &copy);
34
35 public:
36 virtual PandaNode *make_copy() const;
37 virtual void write(std::ostream &out, int indent_level) const;
38
39 PUBLISHED:
40 INLINE const LColor &get_specular_color() const final;
41
42 INLINE PN_stdfloat get_max_distance() const;
43 INLINE void set_max_distance(PN_stdfloat max_distance);
44 MAKE_PROPERTY(max_distance, get_max_distance, set_max_distance);
45
46 virtual int get_class_priority() const;
47
48 public:
49 virtual void bind(GraphicsStateGuardianBase *gsg, const NodePath &light,
50 int light_id);
51
52 private:
53 // This is the data that must be cycled between pipeline stages.
54 class EXPCL_PANDA_PGRAPHNODES CData : public CycleData {
55 public:
56 INLINE CData();
57 INLINE CData(const CData &copy);
58 virtual CycleData *make_copy() const;
59 virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
60 virtual void fillin(DatagramIterator &scan, BamReader *manager);
61 virtual TypeHandle get_parent_type() const {
62 return RectangleLight::get_class_type();
63 }
64
65 PN_stdfloat _max_distance;
66 };
67
68 PipelineCycler<CData> _cycler;
69 typedef CycleDataReader<CData> CDReader;
70 typedef CycleDataWriter<CData> CDWriter;
71
72 public:
73 static void register_with_read_factory();
74 virtual void write_datagram(BamWriter *manager, Datagram &dg);
75
76 protected:
77 static TypedWritable *make_from_bam(const FactoryParams &params);
78 void fillin(DatagramIterator &scan, BamReader *manager);
79
80 public:
81 static TypeHandle get_class_type() {
82 return _type_handle;
83 }
84 static void init_type() {
85 LightLensNode::init_type();
86 register_type(_type_handle, "RectangleLight",
87 LightLensNode::get_class_type());
88 }
89 virtual TypeHandle get_type() const {
90 return get_class_type();
91 }
92 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
93
94 private:
95 static TypeHandle _type_handle;
96 };
97
98 #include "rectangleLight.I"
99
100 #endif
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
BamWriter
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
Camera::make_copy
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
Definition: camera.cxx:69
Camera::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type Camera.
Definition: camera.cxx:262
CycleDataReader
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
Definition: cycleDataReader.h:35
CycleDataWriter
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
Definition: cycleDataWriter.h:34
CycleData
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:50
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition: datagramIterator.h:27
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
GraphicsStateGuardianBase
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
Definition: graphicsStateGuardianBase.h:110
LightLensNode
A derivative of Light and of Camera.
Definition: lightLensNode.h:33
LightLensNode::write_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.
Definition: lightLensNode.cxx:234
Light::get_specular_color
virtual const LColor & get_specular_color() const
Returns the color of specular highlights generated by the light.
Definition: light.cxx:146
NodePath
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:159
PandaNode
A basic node of the scene graph or data graph.
Definition: pandaNode.h:65
RectangleLight
This is a type of area light that is an axis aligned rectangle, pointing along the Y axis in the posi...
Definition: rectangleLight.h:28
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
TypedWritable
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
lightLensNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointLight.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
rectangleLight.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PipelineCycler< CData >