Пример #1
0
 @Override
 void computeTangent(KeyFrame prev, KeyFrame next) {
   tgPVec = Vec.multiply(Vec.subtract(next.position(), prev.position()), 0.5f);
   tgQuat =
       Quat.squadTangent(
           (Quat) prev.orientation(), (Quat) orientation(), (Quat) next.orientation());
 }
Пример #2
0
 /**
  * Internal use. Calls {@link #invalidateValues()} if a keyFrame (frame) defining the path was
  * recently modified.
  */
 protected void checkValidity() {
   boolean flag = false;
   for (KeyFrame element : keyFrameList) {
     if (element.frame().lastUpdate() > lastUpdate()) {
       flag = true;
       break;
     }
   }
   if (flag) {
     this.invalidateValues();
     this.checked();
   }
 }
Пример #3
0
  protected void updateModifiedFrameValues() {
    KeyFrame kf;
    KeyFrame prev = keyFrameList.get(0);
    kf = keyFrameList.get(0);

    int index = 1;
    while (kf != null) {
      KeyFrame next = (index < keyFrameList.size()) ? keyFrameList.get(index) : null;
      index++;
      if (next != null) kf.computeTangent(prev, next);
      else kf.computeTangent(prev, kf);
      prev = kf;
      kf = next;
    }
    valuesAreValid = true;
  }
Пример #4
0
  protected KeyFrameInterpolator(KeyFrameInterpolator otherKFI) {
    this.gScene = otherKFI.gScene;
    this.path = new ArrayList<Frame>();
    ListIterator<Frame> frameIt = otherKFI.path.listIterator();
    while (frameIt.hasNext()) {
      this.path.add(frameIt.next().get());
    }

    this.setFrame(otherKFI.frame());

    this.period = otherKFI.period;
    this.interpolationTm = otherKFI.interpolationTm;
    this.interpolationSpd = otherKFI.interpolationSpd;
    this.interpolationStrt = otherKFI.interpolationStrt;
    this.lpInterpolation = otherKFI.lpInterpolation;
    this.pathIsValid = otherKFI.pathIsValid;
    this.valuesAreValid = otherKFI.valuesAreValid;
    this.currentFrmValid = otherKFI.currentFrmValid;

    this.keyFrameList = new ArrayList<KeyFrame>();

    for (KeyFrame element : otherKFI.keyFrameList) {
      KeyFrame kf = (KeyFrame) element.get();
      this.keyFrameList.add(kf);
    }

    this.currentFrame0 = keyFrameList.listIterator(otherKFI.currentFrame0.nextIndex());
    this.currentFrame1 = keyFrameList.listIterator(otherKFI.currentFrame1.nextIndex());
    this.currentFrame2 = keyFrameList.listIterator(otherKFI.currentFrame2.nextIndex());
    this.currentFrame3 = keyFrameList.listIterator(otherKFI.currentFrame3.nextIndex());

    this.interpolationTimerTask =
        new TimingTask() {
          public void execute() {
            update();
          }
        };
    gScene.registerTimingTask(interpolationTimerTask);

    this.invalidateValues();
  }
Пример #5
0
 @Override
 void computeTangent(KeyFrame prev, KeyFrame next) {
   tgPVec = Vec.multiply(Vec.subtract(next.position(), prev.position()), 0.5f);
 }