mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
lerp t now clamped at 1.0
This commit is contained in:
parent
cf031f570a
commit
8316aaa340
@ -66,14 +66,17 @@ Lerp& Lerp::operator=(const Lerp& c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Lerp::step(void) {
|
void Lerp::step(void) {
|
||||||
if (is_done())
|
|
||||||
return;
|
|
||||||
_t += _delta;
|
_t += _delta;
|
||||||
|
if (is_done()) {
|
||||||
|
(*_func)(1.0);
|
||||||
|
if (!_event.empty()) {
|
||||||
|
throw_event(_event);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
float t = scale_t(_t, _startt, _endt);
|
float t = scale_t(_t, _startt, _endt);
|
||||||
t = (_blend==(LerpBlendType*)0L)?t:(*_blend)(t);
|
t = (_blend==(LerpBlendType*)0L)?t:(*_blend)(t);
|
||||||
(*_func)(t);
|
(*_func)(t);
|
||||||
if (is_done() && !_event.empty())
|
}
|
||||||
throw_event(_event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lerp::set_step_size(float delta) {
|
void Lerp::set_step_size(float delta) {
|
||||||
@ -183,6 +186,8 @@ std::string AutonomousLerp::get_end_event(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AutonomousLerp::step(void) {
|
void AutonomousLerp::step(void) {
|
||||||
|
// Probably broken because it does not set the final value when t
|
||||||
|
// exceeds end_t. see fixed Lerp::step() above
|
||||||
if (is_done()) {
|
if (is_done()) {
|
||||||
stop();
|
stop();
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user