Panda3D
animBundle.h
1 // Filename: animBundle.h
2 // Created by: drose (21Feb99)
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 #ifndef ANIMBUNDLE_H
16 #define ANIMBUNDLE_H
17 
18 #include "pandabase.h"
19 
20 #include "animGroup.h"
21 #include "pointerTo.h"
22 
23 class FactoryParams;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : AnimBundle
27 // Description : This is the root of an AnimChannel hierarchy. It
28 // knows the frame rate and number of frames of all the
29 // channels in the hierarchy (which must all match).
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDA_CHAN AnimBundle : public AnimGroup {
32 protected:
33  AnimBundle(AnimGroup *parent, const AnimBundle &copy);
34 
35 PUBLISHED:
36  INLINE AnimBundle(const string &name, PN_stdfloat fps, int num_frames);
37 
38  PT(AnimBundle) copy_bundle() const;
39 
40  INLINE double get_base_frame_rate() const;
41  INLINE int get_num_frames() const;
42 
43  virtual void output(ostream &out) const;
44 
45 protected:
46  INLINE AnimBundle();
47 
48  virtual AnimGroup *make_copy(AnimGroup *parent) const;
49 
50 private:
51  PN_stdfloat _fps;
52  int _num_frames;
53 
54 public:
55  static void register_with_read_factory();
56  virtual void write_datagram(BamWriter* manager, Datagram &me);
57 
58  static TypedWritable *make_AnimBundle(const FactoryParams &params);
59 
60 protected:
61  void fillin(DatagramIterator& scan, BamReader* manager);
62 
63 public:
64 
65  virtual TypeHandle get_type() const {
66  return get_class_type();
67  }
68  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
69  static TypeHandle get_class_type() {
70  return _type_handle;
71  }
72  static void init_type() {
73  AnimGroup::init_type();
74  register_type(_type_handle, "AnimBundle",
75  AnimGroup::get_class_type());
76  }
77 
78 private:
79  static TypeHandle _type_handle;
80 };
81 
82 inline ostream &operator <<(ostream &out, const AnimBundle &bundle) {
83  bundle.output(out);
84  return out;
85 }
86 
87 
88 #include "animBundle.I"
89 
90 #endif
virtual void output(ostream &out) const
Writes a one-line description of the group.
Definition: animGroup.cxx:214
virtual void output(ostream &out) const
Writes a one-line description of the group.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
Definition: animGroup.cxx:362
This is the root of an AnimChannel hierarchy.
Definition: animBundle.h:31
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
virtual void write_datagram(BamWriter *manager, Datagram &me)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:36
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43