00001 // Filename: geomVertexAnimationSpec.cxx 00002 // Created by: drose (29Mar05) 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 "geomVertexAnimationSpec.h" 00016 #include "datagram.h" 00017 #include "datagramIterator.h" 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function: GeomVertexAnimationSpec::output 00021 // Access: Published 00022 // Description: 00023 //////////////////////////////////////////////////////////////////// 00024 void GeomVertexAnimationSpec:: 00025 output(ostream &out) const { 00026 switch (_animation_type) { 00027 case AT_none: 00028 out << "none"; 00029 break; 00030 00031 case AT_panda: 00032 out << "panda"; 00033 break; 00034 00035 case AT_hardware: 00036 out << "hardware(" << _num_transforms << ", " 00037 << _indexed_transforms << ")"; 00038 break; 00039 } 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: GeomVertexAnimationSpec::write_datagram 00044 // Access: Public 00045 // Description: Writes the contents of this object to the datagram 00046 // for shipping out to a Bam file. 00047 //////////////////////////////////////////////////////////////////// 00048 void GeomVertexAnimationSpec:: 00049 write_datagram(BamWriter *, Datagram &dg) { 00050 dg.add_uint8(_animation_type); 00051 dg.add_uint16(_num_transforms); 00052 dg.add_bool(_indexed_transforms); 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function: GeomVertexAnimationSpec::fillin 00057 // Access: Protected 00058 // Description: This internal function is called by make_from_bam to 00059 // read in all of the relevant data from the BamFile for 00060 // the new GeomVertexAnimationSpec. 00061 //////////////////////////////////////////////////////////////////// 00062 void GeomVertexAnimationSpec:: 00063 fillin(DatagramIterator &scan, BamReader *) { 00064 _animation_type = (AnimationType)scan.get_uint8(); 00065 _num_transforms = scan.get_uint16(); 00066 _indexed_transforms = scan.get_bool(); 00067 }