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
14 #include "geomVertexAnimationSpec.h"
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 */
43 void GeomVertexAnimationSpec::
44 write_datagram(BamWriter *, Datagram &dg) {
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 */
54 void GeomVertexAnimationSpec::
55 fillin(DatagramIterator &scan, BamReader *) {
56 _animation_type = (AnimationType)scan.get_uint8();
57 _num_transforms = scan.get_uint16();
58 _indexed_transforms = scan.get_bool();
59 }
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
BamWriter
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition: datagramIterator.h:27
DatagramIterator::get_uint8
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
Definition: datagramIterator.I:72
DatagramIterator::get_uint16
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
Definition: datagramIterator.I:145
DatagramIterator::get_bool
bool get_bool()
Extracts a boolean value.
Definition: datagramIterator.I:48
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
Datagram::add_uint8
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
Definition: datagram.I:50
Datagram::add_bool
void add_bool(bool value)
Adds a boolean value to the datagram.
Definition: datagram.I:34
Datagram::add_uint16
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
Definition: datagram.I:85
GeomVertexAnimationSpec::fillin
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...
Definition: geomVertexAnimationSpec.cxx:55
GeomVertexAnimationSpec::write_datagram
void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: geomVertexAnimationSpec.cxx:44
datagramIterator.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
datagram.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geomVertexAnimationSpec.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.