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