Panda3D
geomVertexAnimationSpec.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 geomVertexAnimationSpec.cxx
10  * @author drose
11  * @date 2005-03-29
12  */
13 
15 #include "datagram.h"
16 #include "datagramIterator.h"
17 
18 /**
19  *
20  */
21 void GeomVertexAnimationSpec::
22 output(std::ostream &out) const {
23  switch (_animation_type) {
24  case AT_none:
25  out << "none";
26  break;
27 
28  case AT_panda:
29  out << "panda";
30  break;
31 
32  case AT_hardware:
33  out << "hardware(" << _num_transforms << ", "
34  << _indexed_transforms << ")";
35  break;
36  }
37 }
38 
39 /**
40  * Writes the contents of this object to the datagram for shipping out to a
41  * Bam file.
42  */
45  dg.add_uint8(_animation_type);
46  dg.add_uint16(_num_transforms);
47  dg.add_bool(_indexed_transforms);
48 }
49 
50 /**
51  * This internal function is called by make_from_bam to read in all of the
52  * relevant data from the BamFile for the new GeomVertexAnimationSpec.
53  */
56  _animation_type = (AnimationType)scan.get_uint8();
57  _num_transforms = scan.get_uint16();
58  _indexed_transforms = scan.get_bool();
59 }
void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
bool get_bool()
Extracts a boolean value.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
Definition: datagram.I:85
void add_bool(bool value)
Adds a boolean value to the datagram.
Definition: datagram.I:34
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is called by make_from_bam to read in all of the relevant data from the BamFil...
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
Definition: datagram.I:50
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38