protected void updateCurrentKeyFrameForTime(float time) { // Assertion: times are sorted in monotone order. // Assertion: keyFrame_ is not empty // TODO: Special case for loops when closed path is implemented !! if (!currentFrmValid) // Recompute everything from scratch currentFrame1 = keyFrameList.listIterator(); // currentFrame_[1]->peekNext() <---> keyFr.get(currentFrame1.nextIndex()); while (keyFrameList.get(currentFrame1.nextIndex()).time() > time) { currentFrmValid = false; if (!currentFrame1.hasPrevious()) break; currentFrame1.previous(); } if (!currentFrmValid) currentFrame2 = keyFrameList.listIterator(currentFrame1.nextIndex()); while (keyFrameList.get(currentFrame2.nextIndex()).time() < time) { currentFrmValid = false; if (!currentFrame2.hasNext()) break; currentFrame2.next(); } if (!currentFrmValid) { currentFrame1 = keyFrameList.listIterator(currentFrame2.nextIndex()); if ((currentFrame1.hasPrevious()) && (time < keyFrameList.get(currentFrame2.nextIndex()).time())) currentFrame1.previous(); currentFrame0 = keyFrameList.listIterator(currentFrame1.nextIndex()); if (currentFrame0.hasPrevious()) currentFrame0.previous(); currentFrame3 = keyFrameList.listIterator(currentFrame2.nextIndex()); if (currentFrame3.hasNext()) currentFrame3.next(); currentFrmValid = true; splineCacheIsValid = false; } }