Panda3D
lightNode.h
1 // Filename: lightNode.h
2 // Created by: drose (26Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef LIGHTNODE_H
16 #define LIGHTNODE_H
17 
18 #include "pandabase.h"
19 
20 #include "light.h"
21 #include "pandaNode.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : LightNode
25 // Description : A derivative of Light and of PandaNode. All kinds of
26 // Light except Spotlight (which must inherit from
27 // LensNode instead) inherit from this class.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_PANDA_PGRAPHNODES LightNode : public Light, public PandaNode {
30 PUBLISHED:
31  LightNode(const string &name);
32 
33 protected:
34  LightNode(const LightNode &copy);
35 
36 public:
37  virtual PandaNode *as_node();
38  virtual Light *as_light();
39 
40 PUBLISHED:
41  // We have to explicitly publish these because they resolve the
42  // multiple inheritance.
43  virtual void output(ostream &out) const;
44  virtual void write(ostream &out, int indent_level = 0) const;
45 
46 public:
47  virtual void write_datagram(BamWriter *manager, Datagram &dg);
48 
49 protected:
50  void fillin(DatagramIterator &scan, BamReader *manager);
51 
52 public:
53  static TypeHandle get_class_type() {
54  return _type_handle;
55  }
56  static void init_type() {
57  Light::init_type();
58  PandaNode::init_type();
59  register_type(_type_handle, "LightNode",
60  Light::get_class_type(),
61  PandaNode::get_class_type());
62  }
63  virtual TypeHandle get_type() const {
64  return get_class_type();
65  }
66  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
67 
68 private:
69  static TypeHandle _type_handle;
70 };
71 
72 INLINE ostream &operator << (ostream &out, const LightNode &light) {
73  light.output(out);
74  return out;
75 }
76 
77 #include "lightNode.I"
78 
79 #endif
virtual Light * as_light()
Cross-casts the node to a Light pointer, if it is one of the four kinds of Light nodes, or returns NULL if it is not.
Definition: pandaNode.cxx:2528
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
The abstract interface to all kinds of lights.
Definition: light.h:42
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:4164
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
A derivative of Light and of PandaNode.
Definition: lightNode.h:29
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
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:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43