00001 // Filename: modelRoot.cxx 00002 // Created by: drose (16Mar02) 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 "modelRoot.h" 00020 00021 TypeHandle ModelRoot::_type_handle; 00022 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Function: ModelRoot::make_copy 00026 // Access: Public, Virtual 00027 // Description: Returns a newly-allocated Node that is a shallow copy 00028 // of this one. It will be a different Node pointer, 00029 // but its internal data may or may not be shared with 00030 // that of the original Node. 00031 //////////////////////////////////////////////////////////////////// 00032 PandaNode *ModelRoot:: 00033 make_copy() const { 00034 return new ModelRoot(*this); 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: ModelRoot::register_with_read_factory 00039 // Access: Public, Static 00040 // Description: Tells the BamReader how to create objects of type 00041 // ModelRoot. 00042 //////////////////////////////////////////////////////////////////// 00043 void ModelRoot:: 00044 register_with_read_factory() { 00045 BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: ModelRoot::write_datagram 00050 // Access: Public, Virtual 00051 // Description: Writes the contents of this object to the datagram 00052 // for shipping out to a Bam file. 00053 //////////////////////////////////////////////////////////////////// 00054 void ModelRoot:: 00055 write_datagram(BamWriter *manager, Datagram &dg) { 00056 ModelNode::write_datagram(manager, dg); 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: ModelRoot::make_from_bam 00061 // Access: Protected, Static 00062 // Description: This function is called by the BamReader's factory 00063 // when a new object of type ModelRoot is encountered 00064 // in the Bam file. It should create the ModelRoot 00065 // and extract its information from the file. 00066 //////////////////////////////////////////////////////////////////// 00067 TypedWritable *ModelRoot:: 00068 make_from_bam(const FactoryParams ¶ms) { 00069 ModelRoot *node = new ModelRoot(""); 00070 DatagramIterator scan; 00071 BamReader *manager; 00072 00073 parse_params(params, scan, manager); 00074 node->fillin(scan, manager); 00075 00076 return node; 00077 } 00078 00079 //////////////////////////////////////////////////////////////////// 00080 // Function: ModelRoot::fillin 00081 // Access: Protected 00082 // Description: This internal function is called by make_from_bam to 00083 // read in all of the relevant data from the BamFile for 00084 // the new ModelRoot. 00085 //////////////////////////////////////////////////////////////////// 00086 void ModelRoot:: 00087 fillin(DatagramIterator &scan, BamReader *manager) { 00088 ModelNode::fillin(scan, manager); 00089 }