Panda3D
 All Classes Functions Variables Enumerations
lightNode.cxx
1 // Filename: lightNode.cxx
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 #include "lightNode.h"
16 #include "bamWriter.h"
17 #include "bamReader.h"
18 #include "datagram.h"
19 #include "datagramIterator.h"
20 
21 TypeHandle LightNode::_type_handle;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: LightNode::Constructor
25 // Access: Published
26 // Description:
27 ////////////////////////////////////////////////////////////////////
28 LightNode::
29 LightNode(const string &name) :
30  PandaNode(name)
31 {
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: LightNode::Copy Constructor
36 // Access: Protected
37 // Description:
38 ////////////////////////////////////////////////////////////////////
39 LightNode::
40 LightNode(const LightNode &copy) :
41  Light(copy),
42  PandaNode(copy)
43 {
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: LightNode::as_node
48 // Access: Published, Virtual
49 // Description: Returns the Light object upcast to a PandaNode.
50 ////////////////////////////////////////////////////////////////////
53  return this;
54 }
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: LightNode::as_light
58 // Access: Public, Virtual
59 // Description: Cross-casts the node to a Light pointer, if it is one
60 // of the four kinds of Light nodes, or returns NULL if
61 // it is not.
62 ////////////////////////////////////////////////////////////////////
65  return this;
66 }
67 
68 ////////////////////////////////////////////////////////////////////
69 // Function: LightNode::output
70 // Access: Public, Virtual
71 // Description:
72 ////////////////////////////////////////////////////////////////////
73 void LightNode::
74 output(ostream &out) const {
75  PandaNode::output(out);
76 }
77 
78 ////////////////////////////////////////////////////////////////////
79 // Function: LightNode::write
80 // Access: Public, Virtual
81 // Description:
82 ////////////////////////////////////////////////////////////////////
83 void LightNode::
84 write(ostream &out, int indent_level) const {
85  PandaNode::write(out, indent_level);
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: LightNode::write_datagram
90 // Access: Public, Virtual
91 // Description: Writes the contents of this object to the datagram
92 // for shipping out to a Bam file.
93 ////////////////////////////////////////////////////////////////////
94 void LightNode::
96  PandaNode::write_datagram(manager, dg);
97  Light::write_datagram(manager, dg);
98 }
99 
100 ////////////////////////////////////////////////////////////////////
101 // Function: LightNode::fillin
102 // Access: Protected
103 // Description: This internal function is called by make_from_bam to
104 // read in all of the relevant data from the BamFile for
105 // the new LightNode.
106 ////////////////////////////////////////////////////////////////////
107 void LightNode::
108 fillin(DatagramIterator &scan, BamReader *manager) {
109  PandaNode::fillin(scan, manager);
110  Light::fillin(scan, manager);
111 }
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: lightNode.cxx:95
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
virtual PandaNode * as_node()
Returns the Light object upcast to a PandaNode.
Definition: lightNode.cxx:52
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
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: lightNode.cxx:64
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