Panda3D
timedCycle.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file timedCycle.cxx
10 * @author jason
11 * @date 2000-08-01
12 */
13
14#include "timedCycle.h"
15
16#include "datagram.h"
17#include "datagramIterator.h"
18
19/**
20 * Writes the contents of this object to the datagram for shipping out to a
21 * Bam file.
22 */
25 me.add_stdfloat(_cycle_time);
26 me.add_uint16(_element_count);
27}
28
29/**
30 * This internal function is called by make_TimedCycle to read in all of the
31 * relevant data from the BamFile for the new TimedCycle.
32 */
35 _cycle_time = scan.get_stdfloat();
36 _element_count = scan.get_uint16();
37 _inv_cycle_time = 1. / _cycle_time;
38
39 _global_clock = ClockObject::get_global_clock();
40 _next_switch = _global_clock->get_real_time() + _cycle_time;
41 _current_child = 0;
42}
get_real_time
Returns the actual number of seconds elapsed since the ClockObject was created, or since it was last ...
Definition: clockObject.h:92
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
Definition: clockObject.I:215
A class to retrieve the individual data elements previously stored in a Datagram.
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
void add_stdfloat(PN_stdfloat value)
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
Definition: datagram.I:133
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
Definition: datagram.I:85
void write_datagram(Datagram &me)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: timedCycle.cxx:24
void fillin(DatagramIterator &scan)
This internal function is called by make_TimedCycle to read in all of the relevant data from the BamF...
Definition: timedCycle.cxx:34
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.