00001 // Filename: lightNode.cxx 00002 // Created by: drose (26Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "lightNode.h" 00020 #include "bamWriter.h" 00021 #include "bamReader.h" 00022 #include "datagram.h" 00023 #include "datagramIterator.h" 00024 00025 TypeHandle LightNode::_type_handle; 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: LightNode::Constructor 00029 // Access: Published 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 LightNode:: 00033 LightNode(const string &name) : 00034 PandaNode(name) 00035 { 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: LightNode::Copy Constructor 00040 // Access: Protected 00041 // Description: 00042 //////////////////////////////////////////////////////////////////// 00043 LightNode:: 00044 LightNode(const LightNode ©) : 00045 Light(copy), 00046 PandaNode(copy) 00047 { 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: LightNode::as_node 00052 // Access: Published, Virtual 00053 // Description: Returns the Light object upcast to a PandaNode. 00054 //////////////////////////////////////////////////////////////////// 00055 PandaNode *LightNode:: 00056 as_node() { 00057 return this; 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: LightNode::as_light 00062 // Access: Public, Virtual 00063 // Description: Cross-casts the node to a Light pointer, if it is one 00064 // of the four kinds of Light nodes, or returns NULL if 00065 // it is not. 00066 //////////////////////////////////////////////////////////////////// 00067 Light *LightNode:: 00068 as_light() { 00069 return this; 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: LightNode::output 00074 // Access: Public, Virtual 00075 // Description: 00076 //////////////////////////////////////////////////////////////////// 00077 void LightNode:: 00078 output(ostream &out) const { 00079 PandaNode::output(out); 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: LightNode::write 00084 // Access: Public, Virtual 00085 // Description: 00086 //////////////////////////////////////////////////////////////////// 00087 void LightNode:: 00088 write(ostream &out, int indent_level) const { 00089 PandaNode::write(out, indent_level); 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: LightNode::write_datagram 00094 // Access: Public, Virtual 00095 // Description: Writes the contents of this object to the datagram 00096 // for shipping out to a Bam file. 00097 //////////////////////////////////////////////////////////////////// 00098 void LightNode:: 00099 write_datagram(BamWriter *manager, Datagram &dg) { 00100 PandaNode::write_datagram(manager, dg); 00101 Light::write_datagram(manager, dg); 00102 } 00103 00104 //////////////////////////////////////////////////////////////////// 00105 // Function: LightNode::fillin 00106 // Access: Protected 00107 // Description: This internal function is called by make_from_bam to 00108 // read in all of the relevant data from the BamFile for 00109 // the new LightNode. 00110 //////////////////////////////////////////////////////////////////// 00111 void LightNode:: 00112 fillin(DatagramIterator &scan, BamReader *manager) { 00113 PandaNode::fillin(scan, manager); 00114 Light::fillin(scan, manager); 00115 }