Panda3D
animBundle.h
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 animBundle.h
10  * @author drose
11  * @date 1999-02-21
12  */
13 
14 #ifndef ANIMBUNDLE_H
15 #define ANIMBUNDLE_H
16 
17 #include "pandabase.h"
18 
19 #include "animGroup.h"
20 #include "pointerTo.h"
21 
22 class FactoryParams;
23 
24 /**
25  * This is the root of an AnimChannel hierarchy. It knows the frame rate and
26  * number of frames of all the channels in the hierarchy (which must all
27  * match).
28  */
29 class EXPCL_PANDA_CHAN AnimBundle : public AnimGroup {
30 protected:
31  AnimBundle(AnimGroup *parent, const AnimBundle &copy);
32 
33 PUBLISHED:
34  INLINE explicit AnimBundle(const std::string &name, PN_stdfloat fps, int num_frames);
35 
36  PT(AnimBundle) copy_bundle() const;
37 
38  INLINE double get_base_frame_rate() const;
39  INLINE int get_num_frames() const;
40 
41  MAKE_PROPERTY(base_frame_rate, get_base_frame_rate);
42  MAKE_PROPERTY(num_frames, get_num_frames);
43 
44  virtual void output(std::ostream &out) const;
45 
46 protected:
47  INLINE AnimBundle();
48 
49  virtual AnimGroup *make_copy(AnimGroup *parent) const;
50 
51 private:
52  PN_stdfloat _fps;
53  int _num_frames;
54 
55 public:
56  static void register_with_read_factory();
57  virtual void write_datagram(BamWriter* manager, Datagram &me);
58 
59  static TypedWritable *make_AnimBundle(const FactoryParams &params);
60 
61 protected:
62  void fillin(DatagramIterator& scan, BamReader* manager);
63 
64 public:
65 
66  virtual TypeHandle get_type() const {
67  return get_class_type();
68  }
69  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
70  static TypeHandle get_class_type() {
71  return _type_handle;
72  }
73  static void init_type() {
74  AnimGroup::init_type();
75  register_type(_type_handle, "AnimBundle",
76  AnimGroup::get_class_type());
77  }
78 
79 private:
80  static TypeHandle _type_handle;
81 };
82 
83 inline std::ostream &operator <<(std::ostream &out, const AnimBundle &bundle) {
84  bundle.output(out);
85  return out;
86 }
87 
88 
89 #include "animBundle.I"
90 
91 #endif
virtual void output(std::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:110
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
Definition: animGroup.cxx:308
This is the root of an AnimChannel hierarchy.
Definition: animBundle.h:29
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:63
virtual void output(std::ostream &out) const
Writes a one-line description of the group.
Definition: animGroup.cxx:184
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:33
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38