Panda3D
cLerpAnimEffectInterval.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 cLerpAnimEffectInterval.h
10  * @author drose
11  * @date 2002-08-27
12  */
13 
14 #ifndef CLERPANIMEFFECTINTERVAL_H
15 #define CLERPANIMEFFECTINTERVAL_H
16 
17 #include "directbase.h"
18 #include "cLerpInterval.h"
19 #include "animControl.h"
20 #include "pointerTo.h"
21 #include "pvector.h"
22 
23 /**
24  * This interval lerps between different amounts of control effects for
25  * various AnimControls that might be playing on an actor. It's used to
26  * change the blending amount between multiple animations.
27  *
28  * The idea is to start all the animations playing first, then use a
29  * CLerpAnimEffectInterval to adjust the degree to which each animation
30  * affects the actor.
31  */
32 class EXPCL_DIRECT_INTERVAL CLerpAnimEffectInterval : public CLerpInterval {
33 PUBLISHED:
34  INLINE explicit CLerpAnimEffectInterval(const std::string &name, double duration,
35  BlendType blend_type);
36 
37  INLINE void add_control(AnimControl *control, const std::string &name,
38  float begin_effect, float end_effect);
39 
40  virtual void priv_step(double t);
41 
42  virtual void output(std::ostream &out) const;
43 
44 private:
45  class ControlDef {
46  public:
47  INLINE ControlDef(AnimControl *control, const std::string &name,
48  float begin_effect, float end_effect);
49  PT(AnimControl) _control;
50  std::string _name;
51  float _begin_effect;
52  float _end_effect;
53  };
54 
56  Controls _controls;
57 
58 
59 public:
60  static TypeHandle get_class_type() {
61  return _type_handle;
62  }
63  static void init_type() {
64  CLerpInterval::init_type();
65  register_type(_type_handle, "CLerpAnimEffectInterval",
66  CLerpInterval::get_class_type());
67  }
68  virtual TypeHandle get_type() const {
69  return get_class_type();
70  }
71  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
72 
73 private:
74  static TypeHandle _type_handle;
75 };
76 
78 
79 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Controls the timing of a character animation.
Definition: animControl.h:38
virtual void priv_step(double t)
Advances the time on the interval.
Definition: cInterval.cxx:357
This interval lerps between different amounts of control effects for various AnimControls that might ...
The base class for a family of intervals that linearly interpolate one or more numeric values over ti...
Definition: cLerpInterval.h:24
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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