Panda3D
ambientLight.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 ambientLight.h
10  * @author mike
11  * @date 1997-01-09
12  */
13 
14 #ifndef AMBIENTLIGHT_H
15 #define AMBIENTLIGHT_H
16 
17 #include "pandabase.h"
18 
19 #include "lightNode.h"
20 
21 /**
22  * A light source that seems to illuminate all points in space at once. This
23  * kind of light need not actually be part of the scene graph, since it has no
24  * meaningful position.
25  */
26 class EXPCL_PANDA_PGRAPHNODES AmbientLight : public LightNode {
27 PUBLISHED:
28  explicit AmbientLight(const std::string &name);
29 
30 protected:
31  AmbientLight(const AmbientLight &copy);
32 
33 public:
34  virtual PandaNode *make_copy() const;
35  virtual void write(std::ostream &out, int indent_level) const;
36  virtual bool is_ambient_light() const final;
37 
38 PUBLISHED:
39  virtual int get_class_priority() const;
40 
41 public:
42  virtual void bind(GraphicsStateGuardianBase *gsg, const NodePath &light,
43  int light_id);
44 
45 public:
46  static void register_with_read_factory();
47  virtual void write_datagram(BamWriter *manager, Datagram &dg);
48 
49 protected:
50  static TypedWritable *make_from_bam(const FactoryParams &params);
51  void fillin(DatagramIterator &scan, BamReader *manager);
52 
53 public:
54  static TypeHandle get_class_type() {
55  return _type_handle;
56  }
57  static void init_type() {
58  LightNode::init_type();
59  register_type(_type_handle, "AmbientLight",
60  LightNode::get_class_type());
61  }
62  virtual TypeHandle get_type() const {
63  return get_class_type();
64  }
65  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
66 
67 private:
68  static TypeHandle _type_handle;
69 };
70 
71 INLINE std::ostream &operator << (std::ostream &out, const AmbientLight &light) {
72  light.output(out);
73  return out;
74 }
75 
76 #include "ambientLight.I"
77 
78 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
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: lightNode.cxx:79
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
A derivative of Light and of PandaNode.
Definition: lightNode.h:27
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(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A light source that seems to illuminate all points in space at once.
Definition: ambientLight.h:26
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
static void register_with_read_factory()
Tells the BamReader how to create objects of type PandaNode.
Definition: pandaNode.cxx:3580
virtual bool is_ambient_light() const
Returns true if this is an AmbientLight, false if it is some other kind of light.
Definition: light.cxx:63
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
Definition: pandaNode.cxx:487
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.