Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pgraph/light.cxx

Go to the documentation of this file.
00001 // Filename: light.cxx
00002 // Created by:  mike (09Jan97)
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 "light.h"
00020 #include "bamWriter.h"
00021 #include "bamReader.h"
00022 #include "datagram.h"
00023 #include "datagramIterator.h"
00024 
00025 TypeHandle Light::_type_handle;
00026 
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: Light::CData::make_copy
00030 //       Access: Public, Virtual
00031 //  Description:
00032 ////////////////////////////////////////////////////////////////////
00033 CycleData *Light::CData::
00034 make_copy() const {
00035   return new CData(*this);
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: Light::CData::write_datagram
00040 //       Access: Public, Virtual
00041 //  Description: Writes the contents of this object to the datagram
00042 //               for shipping out to a Bam file.
00043 ////////////////////////////////////////////////////////////////////
00044 void Light::CData::
00045 write_datagram(BamWriter *, Datagram &dg) const {
00046   _color.write_datagram(dg);
00047 }
00048 
00049 ////////////////////////////////////////////////////////////////////
00050 //     Function: Light::CData::fillin
00051 //       Access: Public, Virtual
00052 //  Description: This internal function is called by make_from_bam to
00053 //               read in all of the relevant data from the BamFile for
00054 //               the new Light.
00055 ////////////////////////////////////////////////////////////////////
00056 void Light::CData::
00057 fillin(DatagramIterator &scan, BamReader *) {
00058   _color.read_datagram(scan);
00059 }
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //     Function: Light::Destructor
00063 //       Access: Published, Virtual
00064 //  Description: 
00065 ////////////////////////////////////////////////////////////////////
00066 Light::
00067 ~Light() {
00068 }
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 //     Function: Light::get_viz
00072 //       Access: Public
00073 //  Description: Returns a GeomNode that may be rendered to visualize
00074 //               the Light.  This is used during the cull traversal to
00075 //               render the Lights that have been made visible.
00076 ////////////////////////////////////////////////////////////////////
00077 GeomNode *Light::
00078 get_viz() {
00079   CDReader cdata(_cycler);
00080   if (cdata->_viz_geom_stale) {
00081     CDWriter cdata_w(_cycler, cdata);
00082 
00083     cdata_w->_viz_geom = new GeomNode("viz");
00084     fill_viz_geom(cdata_w->_viz_geom);
00085     cdata_w->_viz_geom_stale = false;
00086   }
00087   return cdata->_viz_geom;
00088 }
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 //     Function: Light::fill_viz_geom
00092 //       Access: Protected, Virtual
00093 //  Description: Fills the indicated GeomNode up with Geoms suitable
00094 //               for rendering this light.
00095 ////////////////////////////////////////////////////////////////////
00096 void Light::
00097 fill_viz_geom(GeomNode *) {
00098 }
00099 
00100 ////////////////////////////////////////////////////////////////////
00101 //     Function: Light::write_datagram
00102 //       Access: Protected
00103 //  Description: Writes the contents of this object to the datagram
00104 //               for shipping out to a Bam file.
00105 ////////////////////////////////////////////////////////////////////
00106 void Light::
00107 write_datagram(BamWriter *manager, Datagram &dg) {
00108   manager->write_cdata(dg, _cycler);
00109 }
00110 
00111 ////////////////////////////////////////////////////////////////////
00112 //     Function: Light::fillin
00113 //       Access: Protected
00114 //  Description: This internal function is called by make_from_bam to
00115 //               read in all of the relevant data from the BamFile for
00116 //               the new Light.
00117 ////////////////////////////////////////////////////////////////////
00118 void Light::
00119 fillin(DatagramIterator &scan, BamReader *manager) {
00120   manager->read_cdata(scan, _cycler);
00121 }

Generated on Fri May 2 00:41:43 2003 for Panda by doxygen1.3