---------------------------------------------------------------------------- remember that currenttime is 0 at the KeyTime of this key frame and 1 and the KeyTime of the next key frame. Hence, currenttime belongs to the interval [0,1).
| 17 | // and 1 and the KeyTime of the next key frame. Hence, |
| 18 | // currenttime belongs to the interval [0,1). |
| 19 | void vtkPVRampKeyFrame::UpdateValue(double currenttime, vtkPVAnimationCue* cue, vtkPVKeyFrame* next) |
| 20 | { |
| 21 | if (!next) |
| 22 | { |
| 23 | return; |
| 24 | } |
| 25 | |
| 26 | cue->BeginUpdateAnimationValues(); |
| 27 | int animated_element = cue->GetAnimatedElement(); |
| 28 | if (animated_element != -1) |
| 29 | { |
| 30 | double vmax = next->GetKeyValue(); |
| 31 | double vmin = this->GetKeyValue(); |
| 32 | double value = vmin + currenttime * (vmax - vmin); |
| 33 | cue->SetAnimationValue(animated_element, value); |
| 34 | } |
| 35 | else |
| 36 | { |
| 37 | unsigned int i; |
| 38 | unsigned int start_novalues = this->GetNumberOfKeyValues(); |
| 39 | unsigned int end_novalues = next->GetNumberOfKeyValues(); |
| 40 | unsigned int min = (start_novalues < end_novalues) ? start_novalues : end_novalues; |
| 41 | |
| 42 | // interpolate common indices. |
| 43 | for (i = 0; i < min; i++) |
| 44 | { |
| 45 | double vmax = next->GetKeyValue(i); |
| 46 | double vmin = this->GetKeyValue(i); |
| 47 | double value = vmin + currenttime * (vmax - vmin); |
| 48 | cue->SetAnimationValue(i, value); |
| 49 | } |
| 50 | |
| 51 | // add any additional indices in start key frame. |
| 52 | for (i = min; i < start_novalues; i++) |
| 53 | { |
| 54 | cue->SetAnimationValue(i, this->GetKeyValue(i)); |
| 55 | } |
| 56 | } |
| 57 | cue->EndUpdateAnimationValues(); |
| 58 | } |
| 59 | |
| 60 | //---------------------------------------------------------------------------- |
| 61 | void vtkPVRampKeyFrame::PrintSelf(ostream& os, vtkIndent indent) |
nothing calls this directly
no test coverage detected