Panda3D
cLerpAnimEffectInterval.cxx
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.cxx
10  * @author drose
11  * @date 2002-08-27
12  */
13 
15 #include "lerp_helpers.h"
16 #include "partBundle.h"
17 
18 TypeHandle CLerpAnimEffectInterval::_type_handle;
19 
20 /**
21  * Advances the time on the interval. The time may either increase (the
22  * normal case) or decrease (e.g. if the interval is being played by a
23  * slider).
24  */
26 priv_step(double t) {
27  check_started(get_class_type(), "priv_step");
28  _state = S_started;
29  double d = compute_delta(t);
30 
31  Controls::iterator ci;
32  for (ci = _controls.begin(); ci != _controls.end(); ++ci) {
33  ControlDef &def = (*ci);
34  float effect;
35  lerp_value(effect, d, def._begin_effect, def._end_effect);
36  def._control->get_part()->set_control_effect(def._control, effect);
37  }
38 
39  _curr_t = t;
40 }
41 
42 /**
43  *
44  */
45 void CLerpAnimEffectInterval::
46 output(std::ostream &out) const {
47  out << get_name() << ": ";
48 
49  if (_controls.empty()) {
50  out << "(no controls)";
51  } else {
52  Controls::const_iterator ci;
53  ci = _controls.begin();
54  out << (*ci)._name;
55  ++ci;
56  while (ci != _controls.end()) {
57  out << ", " << (*ci)._name;
58  ++ci;
59  }
60  }
61 
62  out << " dur " << get_duration();
63 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void lerp_value(NumericType &current_value, double d, const NumericType &starting_value, const NumericType &ending_value)
Applies the linear lerp computation for a single parameter.
Definition: lerp_helpers.h:27
virtual void priv_step(double t)
Advances the time on the interval.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_duration
Returns the duration of the interval in seconds.
Definition: cInterval.h:124
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81