Panda3D
 All Classes Functions Variables Enumerations
cLerpAnimEffectInterval.cxx
00001 // Filename: cLerpAnimEffectInterval.cxx
00002 // Created by:  drose (27Aug02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "cLerpAnimEffectInterval.h"
00016 #include "lerp_helpers.h"
00017 #include "partBundle.h"
00018 
00019 TypeHandle CLerpAnimEffectInterval::_type_handle;
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: CLerpAnimEffectInterval::step
00023 //       Access: Published, Virtual
00024 //  Description: Advances the time on the interval.  The time may
00025 //               either increase (the normal case) or decrease
00026 //               (e.g. if the interval is being played by a slider).
00027 ////////////////////////////////////////////////////////////////////
00028 void CLerpAnimEffectInterval::
00029 priv_step(double t) {
00030   check_started(get_class_type(), "priv_step");
00031   _state = S_started;
00032   double d = compute_delta(t);
00033 
00034   Controls::iterator ci;
00035   for (ci = _controls.begin(); ci != _controls.end(); ++ci) {
00036     ControlDef &def = (*ci);
00037     float effect;
00038     lerp_value(effect, d, def._begin_effect, def._end_effect);
00039     def._control->get_part()->set_control_effect(def._control, effect);
00040   }
00041 
00042   _curr_t = t;
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: CLerpAnimEffectInterval::output
00047 //       Access: Published, Virtual
00048 //  Description: 
00049 ////////////////////////////////////////////////////////////////////
00050 void CLerpAnimEffectInterval::
00051 output(ostream &out) const {
00052   out << get_name() << ": ";
00053 
00054   if (_controls.empty()) {
00055     out << "(no controls)";
00056   } else {
00057     Controls::const_iterator ci;
00058     ci = _controls.begin();
00059     out << (*ci)._name;
00060     ++ci;
00061     while (ci != _controls.end()) {
00062       out << ", " << (*ci)._name;
00063       ++ci;
00064     }
00065   }
00066 
00067   out << " dur " << get_duration();
00068 }
 All Classes Functions Variables Enumerations