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