Panda3D
 All Classes Functions Variables Enumerations
animChannelFixed.h
1 // Filename: animChannelFixed.h
2 // Created by: drose (24Feb99)
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 ANIMCHANNELFIXED_H
16 #define ANIMCHANNELFIXED_H
17 
18 #include "pandabase.h"
19 
20 #include "animChannel.h"
21 
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : AnimChannelFixed
25 // Description : This template class is a special kind of AnimChannel
26 // that always returns just one fixed value. It is a
27 // special channel, in that it need not be assigned
28 // within a hierarchy. It may stand alone, so that it
29 // may be created on-the-fly for parts that need default
30 // anims to bind against.
31 ////////////////////////////////////////////////////////////////////
32 template<class SwitchType>
33 class AnimChannelFixed : public AnimChannel<SwitchType> {
34 public:
35  typedef TYPENAME AnimChannel<SwitchType>::ValueType ValueType;
36 
37 protected:
38  INLINE AnimChannelFixed(AnimGroup *parent, const AnimChannelFixed<SwitchType> &copy);
39 
40 public:
41  INLINE AnimChannelFixed(const string &name, const ValueType &value);
42 
43  virtual bool has_changed(int last_frame, double last_frac,
44  int this_frame, double this_frac);
45  virtual void get_value(int frame, ValueType &value);
46 
47  virtual void output(ostream &out) const;
48 
49  ValueType _value;
50 
51 public:
52  virtual TypeHandle get_type() const {
53  return get_class_type();
54  }
55  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
56  static TypeHandle get_class_type() {
57  return _type_handle;
58  }
59  static void init_type() {
61  register_type(_type_handle, SwitchType::get_fixed_channel_type_name(),
63  }
64 
65 private:
66  static TypeHandle _type_handle;
67 };
68 
69 
70 #include "animChannelFixed.I"
71 
72 #endif
virtual void output(ostream &out) const
Writes a one-line description of the group.
This template class is the parent class for all kinds of AnimChannels that return different values...
Definition: animChannel.h:30
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:36
This template class is a special kind of AnimChannel that always returns just one fixed value...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual bool has_changed(int last_frame, double last_frac, int this_frame, double this_frac)
Returns true if the value has changed since the last call to has_changed().