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

panda/src/chan/animBundle.cxx

Go to the documentation of this file.
00001 // Filename: animBundle.cxx
00002 // Created by:  drose (21Feb99)
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 
00020 #include "animBundle.h"
00021 
00022 #include <indent.h>
00023 #include <datagram.h>
00024 #include <datagramIterator.h>
00025 #include <bamReader.h>
00026 #include <bamWriter.h>
00027 
00028 TypeHandle AnimBundle::_type_handle;
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: AnimBundle::output
00032 //       Access: Public, Virtual
00033 //  Description: Writes a one-line description of the bundle.
00034 ////////////////////////////////////////////////////////////////////
00035 void AnimBundle::
00036 output(ostream &out) const {
00037   out << get_type() << " " << get_name() << ", " << get_num_frames()
00038       << " frames at " << get_base_frame_rate() << " fps";
00039 }
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //     Function: AnimBundle::write_datagram
00043 //       Access: Public
00044 //  Description: Function to write the important information in
00045 //               the particular object to a Datagram
00046 ////////////////////////////////////////////////////////////////////
00047 void AnimBundle::
00048 write_datagram(BamWriter *manager, Datagram &me)
00049 {
00050   AnimGroup::write_datagram(manager, me);
00051   me.add_float32(_fps);
00052   me.add_uint16(_num_frames);
00053 }
00054 
00055 ////////////////////////////////////////////////////////////////////
00056 //     Function: AnimBundle::fillin
00057 //       Access: Protected
00058 //  Description: Function that reads out of the datagram (or asks
00059 //               manager to read) all of the data that is needed to
00060 //               re-create this object and stores it in the appropiate
00061 //               place
00062 ////////////////////////////////////////////////////////////////////
00063 void AnimBundle::
00064 fillin(DatagramIterator& scan, BamReader* manager)
00065 {
00066   AnimGroup::fillin(scan, manager);
00067   _fps = scan.get_float32();
00068   _num_frames = scan.get_uint16();
00069 }
00070 
00071 ////////////////////////////////////////////////////////////////////
00072 //     Function: AnimBundle::make_AnimBundle
00073 //       Access: Protected
00074 //  Description: Factory method to generate a AnimBundle object
00075 ////////////////////////////////////////////////////////////////////
00076 TypedWritable* AnimBundle::
00077 make_AnimBundle(const FactoryParams &params)
00078 {
00079   AnimBundle *me = new AnimBundle;
00080   DatagramIterator scan;
00081   BamReader *manager;
00082 
00083   parse_params(params, scan, manager);
00084   me->fillin(scan, manager);
00085   return me;
00086 }
00087 
00088 ////////////////////////////////////////////////////////////////////
00089 //     Function: AnimBundle::register_with_factory
00090 //       Access: Public, Static
00091 //  Description: Factory method to generate a AnimBundle object
00092 ////////////////////////////////////////////////////////////////////
00093 void AnimBundle::
00094 register_with_read_factory(void)
00095 {
00096   BamReader::get_factory()->register_factory(get_class_type(), make_AnimBundle);
00097 }
00098 

Generated on Fri May 2 00:34:53 2003 for Panda by doxygen1.3