Panda3D
 All Classes Functions Variables Enumerations
cLerpAnimEffectInterval.cxx
1 // Filename: cLerpAnimEffectInterval.cxx
2 // Created by: drose (27Aug02)
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 #include "cLerpAnimEffectInterval.h"
16 #include "lerp_helpers.h"
17 #include "partBundle.h"
18 
19 TypeHandle CLerpAnimEffectInterval::_type_handle;
20 
21 ////////////////////////////////////////////////////////////////////
22 // Function: CLerpAnimEffectInterval::step
23 // Access: Published, Virtual
24 // Description: Advances the time on the interval. The time may
25 // either increase (the normal case) or decrease
26 // (e.g. if the interval is being played by a slider).
27 ////////////////////////////////////////////////////////////////////
29 priv_step(double t) {
30  check_started(get_class_type(), "priv_step");
31  _state = S_started;
32  double d = compute_delta(t);
33 
34  Controls::iterator ci;
35  for (ci = _controls.begin(); ci != _controls.end(); ++ci) {
36  ControlDef &def = (*ci);
37  float effect;
38  lerp_value(effect, d, def._begin_effect, def._end_effect);
39  def._control->get_part()->set_control_effect(def._control, effect);
40  }
41 
42  _curr_t = t;
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: CLerpAnimEffectInterval::output
47 // Access: Published, Virtual
48 // Description:
49 ////////////////////////////////////////////////////////////////////
50 void CLerpAnimEffectInterval::
51 output(ostream &out) const {
52  out << get_name() << ": ";
53 
54  if (_controls.empty()) {
55  out << "(no controls)";
56  } else {
57  Controls::const_iterator ci;
58  ci = _controls.begin();
59  out << (*ci)._name;
60  ++ci;
61  while (ci != _controls.end()) {
62  out << ", " << (*ci)._name;
63  ++ci;
64  }
65  }
66 
67  out << " dur " << get_duration();
68 }
const string & get_name() const
Returns the interval&#39;s name.
Definition: cInterval.I:22
double get_duration() const
Returns the duration of the interval in seconds.
Definition: cInterval.I:32
virtual void priv_step(double t)
Advances the time on the interval.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85