Panda3D
lightNode.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 lightNode.h
10  * @author drose
11  * @date 2002-03-26
12  */
13 
14 #ifndef LIGHTNODE_H
15 #define LIGHTNODE_H
16 
17 #include "pandabase.h"
18 
19 #include "light.h"
20 #include "pandaNode.h"
21 
22 /**
23  * A derivative of Light and of PandaNode. All kinds of Light except
24  * Spotlight (which must inherit from LensNode instead) inherit from this
25  * class.
26  */
27 class EXPCL_PANDA_PGRAPHNODES LightNode : public Light, public PandaNode {
28 PUBLISHED:
29  explicit LightNode(const std::string &name);
30 
31 protected:
32  LightNode(const LightNode &copy);
33 
34 public:
35  virtual PandaNode *as_node();
36  virtual Light *as_light();
37 
38 PUBLISHED:
39  // We have to explicitly publish these because they resolve the multiple
40  // inheritance.
41  virtual void output(std::ostream &out) const;
42  virtual void write(std::ostream &out, int indent_level = 0) const;
43 
44 public:
45  virtual void write_datagram(BamWriter *manager, Datagram &dg);
46 
47 protected:
48  void fillin(DatagramIterator &scan, BamReader *manager);
49 
50 public:
51  static TypeHandle get_class_type() {
52  return _type_handle;
53  }
54  static void init_type() {
55  Light::init_type();
56  PandaNode::init_type();
57  register_type(_type_handle, "LightNode",
58  Light::get_class_type(),
59  PandaNode::get_class_type());
60  }
61  virtual TypeHandle get_type() const {
62  return get_class_type();
63  }
64  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
65 
66 private:
67  static TypeHandle _type_handle;
68 };
69 
70 INLINE std::ostream &operator << (std::ostream &out, const LightNode &light) {
71  light.output(out);
72  return out;
73 }
74 
75 #include "lightNode.I"
76 
77 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
A derivative of Light and of PandaNode.
Definition: lightNode.h:27
The abstract interface to all kinds of lights.
Definition: light.h:38
A basic node of the scene graph or data graph.
Definition: pandaNode.h:65
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: pandaNode.cxx:3583
virtual Light * as_light()
Cross-casts the node to a Light pointer, if it is one of the four kinds of Light nodes,...
Definition: pandaNode.cxx:2095
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
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.
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