Fixed an issue with cinematic that was causing the first frame of the cinematic to not be rendered.

Also fix some static constant calls the non static way in MotionPath
experimental
Nehon 10 years ago
parent e15b86d0ba
commit 9cd1a514a6
  1. 12
      jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java
  2. 4
      jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java

@ -328,11 +328,6 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
*/ */
@Override @Override
public void onUpdate(float tpf) { public void onUpdate(float tpf) {
for (int i = 0; i < cinematicEvents.size(); i++) {
CinematicEvent ce = cinematicEvents.get(i);
ce.internalUpdate(tpf);
}
int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time); int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time);
//iterate to make sure every key frame is triggered //iterate to make sure every key frame is triggered
@ -343,6 +338,13 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
} }
} }
for (int i = 0; i < cinematicEvents.size(); i++) {
CinematicEvent ce = cinematicEvents.get(i);
ce.internalUpdate(tpf);
}
lastFetchedKeyFrame = keyFrameIndex; lastFetchedKeyFrame = keyFrameIndex;
} }

@ -171,10 +171,10 @@ public class MotionEvent extends AbstractCinematicEvent implements Control {
public void internalUpdate(float tpf) { public void internalUpdate(float tpf) {
if (playState == PlayState.Playing) { if (playState == PlayState.Playing) {
time = time + (tpf * speed); time = time + (tpf * speed);
if (loopMode == loopMode.Loop && time < 0) { if (loopMode == LoopMode.Loop && time < 0) {
time = initialDuration; time = initialDuration;
} }
if ((time >= initialDuration || time < 0) && loopMode == loopMode.DontLoop) { if ((time >= initialDuration || time < 0) && loopMode == LoopMode.DontLoop) {
if (time >= initialDuration) { if (time >= initialDuration) {
path.triggerWayPointReach(path.getNbWayPoints() - 1, this); path.triggerWayPointReach(path.getNbWayPoints() - 1, this);
} }

Loading…
Cancel
Save