Panda3D
cLerpInterval.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 cLerpInterval.h
10  * @author drose
11  * @date 2002-08-27
12  */
13 
14 #ifndef CLERPINTERVAL_H
15 #define CLERPINTERVAL_H
16 
17 #include "directbase.h"
18 #include "cInterval.h"
19 
20 /**
21  * The base class for a family of intervals that linearly interpolate one or
22  * more numeric values over time.
23  */
24 class EXPCL_DIRECT_INTERVAL CLerpInterval : public CInterval {
25 PUBLISHED:
26  enum BlendType {
27  BT_no_blend,
28  BT_ease_in,
29  BT_ease_out,
30  BT_ease_in_out,
31  BT_invalid
32  };
33 
34 public:
35  INLINE CLerpInterval(const std::string &name, double duration,
36  BlendType blend_type);
37 
38 PUBLISHED:
39  INLINE BlendType get_blend_type() const;
40 
41  static BlendType string_blend_type(const std::string &blend_type);
42 
43 protected:
44  double compute_delta(double t) const;
45 
46 private:
47  BlendType _blend_type;
48 
49 
50 public:
51  static TypeHandle get_class_type() {
52  return _type_handle;
53  }
54  static void init_type() {
55  CInterval::init_type();
56  register_type(_type_handle, "CLerpInterval",
57  CInterval::get_class_type());
58  }
59  virtual TypeHandle get_type() const {
60  return get_class_type();
61  }
62  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
63 
64 private:
65  static TypeHandle _type_handle;
66 };
67 
68 #include "cLerpInterval.I"
69 
70 #endif
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
The base class for timeline components.
Definition: cInterval.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
The base class for a family of intervals that linearly interpolate one or more numeric values over ti...
Definition: cLerpInterval.h:24
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.