00001 // Filename: timedCycle.cxx 00002 // Created by: jason (01Aug00) 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 #include "pandabase.h" 00015 #include "timedCycle.h" 00016 00017 #include "datagram.h" 00018 #include "datagramIterator.h" 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: TimedCycle::write_object 00022 // Description: Writes the contents of this object to the datagram 00023 // for shipping out to a Bam file. 00024 //////////////////////////////////////////////////////////////////// 00025 void TimedCycle:: 00026 write_datagram(Datagram &me) { 00027 me.add_stdfloat(_cycle_time); 00028 me.add_uint16(_element_count); 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: TimedCycle::fillin 00033 // Access: Protected 00034 // Description: This internal function is called by make_TimedCycle to 00035 // read in all of the relevant data from the BamFile for 00036 // the new TimedCycle. 00037 //////////////////////////////////////////////////////////////////// 00038 void TimedCycle:: 00039 fillin(DatagramIterator &scan) { 00040 _cycle_time = scan.get_stdfloat(); 00041 _element_count = scan.get_uint16(); 00042 _inv_cycle_time = 1. / _cycle_time; 00043 00044 _global_clock = ClockObject::get_global_clock(); 00045 _next_switch = _global_clock->get_real_time() + _cycle_time; 00046 _current_child = 0; 00047 }