Panda3D
|
00001 // Filename: cfCommand.cxx 00002 // Created by: drose (19Feb09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "cfCommand.h" 00016 00017 TypeHandle CFCommand::_type_handle; 00018 TypeHandle CFDoCullCommand::_type_handle; 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: CFCommand::Destructor 00022 // Access: Published, Virtual 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 CFCommand:: 00026 ~CFCommand() { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: CFDoCullCommand::register_with_read_factory 00031 // Access: Public, Static 00032 // Description: Tells the BamReader how to create objects of type 00033 // CFDoCullCommand. 00034 //////////////////////////////////////////////////////////////////// 00035 void CFDoCullCommand:: 00036 register_with_read_factory() { 00037 BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: CFDoCullCommand::write_datagram 00042 // Access: Public, Virtual 00043 // Description: Writes the contents of this object to the datagram 00044 // for shipping out to a Bam file. 00045 //////////////////////////////////////////////////////////////////// 00046 void CFDoCullCommand:: 00047 write_datagram(BamWriter *manager, Datagram &dg) { 00048 TypedWritable::write_datagram(manager, dg); 00049 manager->write_pointer(dg, _scene); 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: CFDoCullCommand::update_bam_nested 00054 // Access: Public, Virtual 00055 // Description: Called by the BamWriter when this object has not 00056 // itself been modified recently, but it should check 00057 // its nested objects for updates. 00058 //////////////////////////////////////////////////////////////////// 00059 void CFDoCullCommand:: 00060 update_bam_nested(BamWriter *manager) { 00061 manager->consider_update(_scene); 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: CFDoCullCommand::complete_pointers 00066 // Access: Public, Virtual 00067 // Description: Receives an array of pointers, one for each time 00068 // manager->read_pointer() was called in fillin(). 00069 // Returns the number of pointers processed. 00070 //////////////////////////////////////////////////////////////////// 00071 int CFDoCullCommand:: 00072 complete_pointers(TypedWritable **p_list, BamReader *manager) { 00073 int pi = TypedWritable::complete_pointers(p_list, manager); 00074 00075 PandaNode *scene; 00076 DCAST_INTO_R(scene, p_list[pi++], pi); 00077 _scene = scene; 00078 00079 return pi; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: CFDoCullCommand::make_from_bam 00084 // Access: Protected, Static 00085 // Description: This function is called by the BamReader's factory 00086 // when a new object of type CFDoCullCommand is encountered 00087 // in the Bam file. It should create the CFDoCullCommand 00088 // and extract its information from the file. 00089 //////////////////////////////////////////////////////////////////// 00090 TypedWritable *CFDoCullCommand:: 00091 make_from_bam(const FactoryParams ¶ms) { 00092 CFDoCullCommand *node = new CFDoCullCommand; 00093 DatagramIterator scan; 00094 BamReader *manager; 00095 00096 parse_params(params, scan, manager); 00097 node->fillin(scan, manager); 00098 00099 return node; 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: CFDoCullCommand::fillin 00104 // Access: Protected 00105 // Description: This internal function is called by make_from_bam to 00106 // read in all of the relevant data from the BamFile for 00107 // the new CFDoCullCommand. 00108 //////////////////////////////////////////////////////////////////// 00109 void CFDoCullCommand:: 00110 fillin(DatagramIterator &scan, BamReader *manager) { 00111 TypedWritable::fillin(scan, manager); 00112 manager->read_pointer(scan); 00113 }