Panda3D

Loading...
Searching...
No Matches
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 {
28PUBLISHED:
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
38PUBLISHED:
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
70INLINE 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
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition datagramIterator.h:30
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
LightNode
A derivative of Light and of PandaNode.
Definition lightNode.h:27
LightNode::as_node
virtual PandaNode * as_node()
Returns the Light object upcast to a PandaNode.
Definition lightNode.cxx:45
PandaNode::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 pandaNode.cxx:3602
PandaNode::as_light
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
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
lightNode.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
light.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandaNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
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