Panda3D
geomVertexAnimationSpec.cxx
1 // Filename: geomVertexAnimationSpec.cxx
2 // Created by: drose (29Mar05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "geomVertexAnimationSpec.h"
16 #include "datagram.h"
17 #include "datagramIterator.h"
18 
19 ////////////////////////////////////////////////////////////////////
20 // Function: GeomVertexAnimationSpec::output
21 // Access: Published
22 // Description:
23 ////////////////////////////////////////////////////////////////////
24 void GeomVertexAnimationSpec::
25 output(ostream &out) const {
26  switch (_animation_type) {
27  case AT_none:
28  out << "none";
29  break;
30 
31  case AT_panda:
32  out << "panda";
33  break;
34 
35  case AT_hardware:
36  out << "hardware(" << _num_transforms << ", "
37  << _indexed_transforms << ")";
38  break;
39  }
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: GeomVertexAnimationSpec::write_datagram
44 // Access: Public
45 // Description: Writes the contents of this object to the datagram
46 // for shipping out to a Bam file.
47 ////////////////////////////////////////////////////////////////////
50  dg.add_uint8(_animation_type);
51  dg.add_uint16(_num_transforms);
52  dg.add_bool(_indexed_transforms);
53 }
54 
55 ////////////////////////////////////////////////////////////////////
56 // Function: GeomVertexAnimationSpec::fillin
57 // Access: Protected
58 // Description: This internal function is called by make_from_bam to
59 // read in all of the relevant data from the BamFile for
60 // the new GeomVertexAnimationSpec.
61 ////////////////////////////////////////////////////////////////////
64  _animation_type = (AnimationType)scan.get_uint8();
65  _num_transforms = scan.get_uint16();
66  _indexed_transforms = scan.get_bool();
67 }
void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
Definition: datagram.I:138
bool get_bool()
Extracts a boolean value.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
PN_uint16 get_uint16()
Extracts an unsigned 16-bit integer.
void add_bool(bool value)
Adds a boolean value to the datagram.
Definition: datagram.I:118
void add_uint16(PN_uint16 value)
Adds an unsigned 16-bit integer to the datagram.
Definition: datagram.I:181
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...
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:43