|
59 | 59 | import java.util.logging.Logger; |
60 | 60 |
|
61 | 61 | /** |
62 | | - * An AppState for composing and playing cutscenes in a game. |
| 62 | + * An appstate for composing and playing cutscenes in a game. The cinematic |
| 63 | + * schedules CinematicEvents over a timeline. Once the Cinematic created it has |
| 64 | + * to be attached to the stateManager. |
63 | 65 | * |
64 | | - * <p>A cinematic schedules and plays {@link CinematicEvent}s over a timeline. |
65 | | - * Once a Cinematic is created, you must attach it to the `AppStateManager` to |
66 | | - * run it. You can add various `CinematicEvent`s, see the `com.jme3.cinematic.events` |
67 | | - * package for built-in event types. |
| 66 | + * You can add various CinematicEvents to a Cinematic, see package |
| 67 | + * com.jme3.cinematic.events |
68 | 68 | * |
69 | | - * <p>Events can be added in two main ways: |
70 | | - * <ul> |
71 | | - * <li>{@link Cinematic#addCinematicEvent(float, CinematicEvent)} adds an event |
72 | | - * at a specific time from the cinematic's start.</li> |
73 | | - * <li>{@link Cinematic#enqueueCinematicEvent(CinematicEvent)} adds events |
74 | | - * one after another, with each starting at the end of the previous one.</li> |
75 | | - * </ul> |
| 69 | + * Two main methods can be used to add an event : |
76 | 70 | * |
77 | | - * <p>Playback can be controlled with methods like: |
78 | | - * <ul> |
79 | | - * <li>{@link Cinematic#play()}</li> |
80 | | - * <li>{@link Cinematic#pause()}</li> |
81 | | - * <li>{@link Cinematic#stop()}</li> |
82 | | - * </ul> |
| 71 | + * @see Cinematic#addCinematicEvent(float, |
| 72 | + * com.jme3.cinematic.events.CinematicEvent) , that adds an event at the given |
| 73 | + * time form the cinematic start. |
83 | 74 | * |
84 | | - * <p>Since `Cinematic` itself extends `CinematicEvent`, you can nest cinematics |
85 | | - * within each other. Nested cinematics should not be attached to the `AppStateManager`. |
| 75 | + * @see |
| 76 | + * Cinematic#enqueueCinematicEvent(com.jme3.cinematic.events.CinematicEvent) |
| 77 | + * that enqueue events one after the other according to their initialDuration |
86 | 78 | * |
87 | | - * <p>This class also handles multiple camera points of view by creating and |
88 | | - * activating camera nodes on a schedule. |
89 | | - * <ul> |
90 | | - * <li>{@link Cinematic#bindCamera(java.lang.String, com.jme3.renderer.Camera)}</li> |
91 | | - * <li>{@link Cinematic#activateCamera(float, java.lang.String)}</li> |
92 | | - * <li>{@link Cinematic#setActiveCamera(java.lang.String)}</li> |
93 | | - * </ul> |
| 79 | + * A Cinematic has convenient methods to manage playback: |
| 80 | + * @see Cinematic#play() |
| 81 | + * @see Cinematic#pause() |
| 82 | + * @see Cinematic#stop() |
| 83 | + * |
| 84 | + * A Cinematic is itself a CinematicEvent, meaning you can embed several |
| 85 | + * cinematics. Embedded cinematics must not be added to the stateManager though. |
| 86 | + * |
| 87 | + * Cinematic can handle several points of view by creating camera nodes |
| 88 | + * and activating them on schedule. |
| 89 | + * @see Cinematic#bindCamera(java.lang.String, com.jme3.renderer.Camera) |
| 90 | + * @see Cinematic#activateCamera(float, java.lang.String) |
| 91 | + * @see Cinematic#setActiveCamera(java.lang.String) |
94 | 92 | * |
95 | 93 | * @author Nehon |
96 | 94 | */ |
@@ -295,8 +293,8 @@ public void write(JmeExporter ex) throws IOException { |
295 | 293 |
|
296 | 294 | oc.write(cinematicEvents.toArray(new CinematicEvent[cinematicEvents.size()]), "cinematicEvents", |
297 | 295 | null); |
298 | | - oc.writeStringSavableMap(cameras, "cameras", null); |
299 | | - oc.write(timeLine, "timeLine", null); |
| 296 | + oc.writeStringSavableMap(cameras, "cameras", null); |
| 297 | + oc.write(timeLine, "timeLine", null); |
300 | 298 | } finally { |
301 | 299 | // unhack |
302 | 300 | for (CinematicEvent event : cinematicEvents) { |
@@ -353,8 +351,6 @@ public void setSpeed(float speed) { |
353 | 351 | public void initialize(AppStateManager stateManager, Application app) { |
354 | 352 | this.app = app; |
355 | 353 | initEvent(app, this); |
356 | | - |
357 | | - System.out.println("Initializing"); |
358 | 354 | for (CinematicEvent cinematicEvent : cinematicEvents) { |
359 | 355 | relinkAnimComposer(cinematicEvent); |
360 | 356 | relinkCinematic(cinematicEvent); |
@@ -503,7 +499,6 @@ public void stateDetached(AppStateManager stateManager) { |
503 | 499 | @Override |
504 | 500 | public void update(float tpf) { |
505 | 501 | if (isInitialized() && playState == PlayState.Playing) { |
506 | | - System.out.println("Updating cinematic at time " + cinematic); |
507 | 502 | internalUpdate(tpf); |
508 | 503 | } |
509 | 504 | } |
@@ -704,14 +699,14 @@ public void fitDuration() { |
704 | 699 | } |
705 | 700 |
|
706 | 701 | /** |
707 | | - * Binds a camera to this Cinematic, tagged by a unique name. This method creates and returns a CameraNode |
708 | | - * for the cam and attaches it to the scene. The control direction is set to SpatialToCamera. This camera |
709 | | - * Node can then be used in other events to handle the camera movements during playback. |
| 702 | + * Binds a camera to this Cinematic, tagged by a unique name. This method |
| 703 | + * creates and returns a CameraNode for the cam and attaches it to the scene. |
| 704 | + * The control direction is set to SpatialToCamera. This camera Node can |
| 705 | + * then be used in other events to handle the camera movements during |
| 706 | + * playback. |
710 | 707 | * |
711 | | - * @param cameraName |
712 | | - * the unique tag the camera should have |
713 | | - * @param cam |
714 | | - * the scene camera. |
| 708 | + * @param cameraName the unique tag the camera should have |
| 709 | + * @param cam the scene camera. |
715 | 710 | * @return the created CameraNode. |
716 | 711 | */ |
717 | 712 | public CameraNode bindCamera(String cameraName, Camera cam) { |
@@ -739,9 +734,9 @@ public CameraNode getCamera(String cameraName) { |
739 | 734 | } |
740 | 735 |
|
741 | 736 | /** |
742 | | - * Enables or disables the camera control of the cameraNode of the current cam. |
| 737 | + * enable/disable the camera control of the cameraNode of the current cam |
743 | 738 | * |
744 | | - * @param enabled `true` to enable, `false` to disable. |
| 739 | + * @param enabled |
745 | 740 | */ |
746 | 741 | private void setEnableCurrentCam(boolean enabled) { |
747 | 742 | if (currentCam != null) { |
@@ -866,14 +861,6 @@ public Node getScene() { |
866 | 861 | return scene; |
867 | 862 | } |
868 | 863 |
|
869 | | - /** |
870 | | - * Gets the application instance associated with this cinematic. |
871 | | - * |
872 | | - * @return The application. |
873 | | - */ |
874 | | - public Application getApplication() { |
875 | | - return app; |
876 | | - } |
877 | 864 |
|
878 | 865 | /** |
879 | 866 | * Remove all events from the Cinematic. |
|
0 commit comments