Panda3D

modelRoot.cxx

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