Package com.jme3.cinematic
Class Cinematic
java.lang.Object
com.jme3.cinematic.events.AbstractCinematicEvent
com.jme3.cinematic.Cinematic
- All Implemented Interfaces:
- AppState,- CinematicEvent,- Savable
An appstate for composing and playing cutscenes in a game. The cinematic
 schedules CinematicEvents over a timeline. Once the Cinematic created it has
 to be attached to the stateManager.
 You can add various CinematicEvents to a Cinematic, see package
 com.jme3.cinematic.events
 Two main methods can be used to add an event :
- See Also:
- 
- , that adds an event at the given time form the cinematic start.
- that enqueue events one after the other according to their initialDuration A Cinematic has convenient methods to manage playback:
- AbstractCinematicEvent.play()
- AbstractCinematicEvent.pause()
- A Cinematic is itself a CinematicEvent, meaning you can embed several cinematics. Embedded cinematics must not be added to the stateManager though. Cinematic can handle several points of view by creating camera nodes and activating them on schedule.
- bindCamera(java.lang.String, com.jme3.renderer.Camera)
- activateCamera(float, java.lang.String)
- setActiveCamera(java.lang.String)
 
- 
Field SummaryFieldsFields inherited from class com.jme3.cinematic.events.AbstractCinematicEventinitialDuration, listeners, loopMode, playState, resuming, speed, time
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedUsed for serialization creates a cinematic, don't use this constructor directlyCinematic(float initialDuration) creates a cinematiccreates a cinematiccreates a cinematiccreates a cinematic
- 
Method SummaryModifier and TypeMethodDescriptionvoidactivateCamera(float timeStamp, String cameraName) schedule an event that will activate the camera at the given timeaddCinematicEvent(float timeStamp, CinematicEvent cinematicEvent) Adds a cinematic event to this cinematic at the given timestamp.bindCamera(String cameraName, Camera cam) Binds a camera to this Cinematic, tagged by a unique name.voidcleanup()called internallyvoidclear()Remove all events from the Cinematic.voiddispose()used internally to clean up the cinematic.floatenqueueCinematicEvent(CinematicEvent cinematicEvent) Enqueue a cinematic event to a Cinematic.voidfits the duration of the cinematic to the duration of all its child cinematic eventsreturns a cameraNode given its namegetEventData(String type, Object key) used internally return and event datagetId()Returns the unique ID for this AppState or null if it has no unique ID.getScene()return the scene where the cinematic occurvoidinitialize(AppStateManager stateManager, Application app) used internallybooleanreturn true if the cinematic appstate is enabled (the cinematic is playing)booleanused internallyvoidonPause()called internallyvoidonPlay()called internallyvoidonStop()called internallyvoidonUpdate(float tpf) used internally, don't call this directly.voidcalled internallyvoidputEventData(String type, Object key, Object object) used internally put an eventdata in the cinematicvoidread(JmeImporter im) used internally for serializationbooleanremoveCinematicEvent(float timeStamp, CinematicEvent cinematicEvent) removes the first occurrence found of the given cinematicEvent for the given time stamp.booleanremoveCinematicEvent(CinematicEvent cinematicEvent) removes the first occurrence found of the given cinematicEvent.booleanremoveCinematicEvent(KeyFrame keyFrame, CinematicEvent cinematicEvent) removes the first occurrence found of the given cinematicEvent for the given keyFramevoidremoveEventData(String type, Object key) Used internally remove an eventDatavoidrender(RenderManager rm) called internallyvoidsetActiveCamera(String cameraName) Sets the active camera instantly (use activateCamera if you want to schedule that event)voidsetEnabled(boolean enabled) passing true has the same effect as play() you should use play(), pause(), stop() to handle the cinematic playing state.protected voidSets the unique ID of this app state.voidsets the scene to use for this cinematic it is expected that the scene is added before adding events to the cinematicvoidsetSpeed(float speed) sets the speed of the cinematic.voidsetTime(float time) This is used internally but can be called to shuffle through the cinematic.voidstateAttached(AppStateManager stateManager) called internallyvoidstateDetached(AppStateManager stateManager) called internallyvoidupdate(float tpf) called internally don't call it directly.voidwrite(JmeExporter ex) used internally for serializationMethods inherited from class com.jme3.cinematic.events.AbstractCinematicEventaddListener, forceStop, getDuration, getInitialDuration, getLoopMode, getPlayState, getSpeed, getTime, initEvent, internalUpdate, pause, play, removeListener, setInitialDuration, setLoopMode, stop
- 
Field Details- 
timeLine
 
- 
- 
Constructor Details- 
Cinematicprotected Cinematic()Used for serialization creates a cinematic, don't use this constructor directly
- 
Cinematicpublic Cinematic(float initialDuration) 
- 
Cinematic
- 
Cinematic
- 
Cinematiccreates a cinematic- Parameters:
- scene- the scene in which the cinematic should take place
 
- 
Cinematiccreates a cinematic- Parameters:
- scene- the scene in which the cinematic should take place
- initialDuration- the duration of the cinematic (without considering the speed)
 
- 
Cinematiccreates a cinematic- Parameters:
- scene- the scene in which the cinematic should take place
- loopMode- tells if this cinematic should be looped or not
 
- 
Cinematiccreates a cinematic- Parameters:
- scene- the scene in which the cinematic should take place
- initialDuration- the duration of the cinematic (without considering the speed)
- loopMode- tells if this cinematic should be looped or not
 
 
- 
- 
Method Details- 
onPlaypublic void onPlay()called internally- Specified by:
- onPlayin class- AbstractCinematicEvent
 
- 
onStoppublic void onStop()called internally- Specified by:
- onStopin class- AbstractCinematicEvent
 
- 
onPausepublic void onPause()called internally- Specified by:
- onPausein class- AbstractCinematicEvent
 
- 
writeused internally for serialization- Specified by:
- writein interface- Savable
- Overrides:
- writein class- AbstractCinematicEvent
- Parameters:
- ex- the exporter (not null)
- Throws:
- IOException- from the exporter
 
- 
readused internally for serialization- Specified by:
- readin interface- Savable
- Overrides:
- readin class- AbstractCinematicEvent
- Parameters:
- im- the importer (not null)
- Throws:
- IOException- from the importer
 
- 
setSpeedpublic void setSpeed(float speed) sets the speed of the cinematic. Note that it will set the speed of all events in the cinematic. 1 is normal speed. use 0.5f to make the cinematic twice slower, use 2 to make it twice faster- Specified by:
- setSpeedin interface- CinematicEvent
- Overrides:
- setSpeedin class- AbstractCinematicEvent
- Parameters:
- speed- the speed
 
- 
initializeused internally- Specified by:
- initializein interface- AppState
- Parameters:
- stateManager- the state manager
- app- the application
 
- 
isInitializedpublic boolean isInitialized()used internally- Specified by:
- isInitializedin interface- AppState
- Returns:
- true if initialized, otherwise false
 
- 
setIdSets the unique ID of this app state. Note: that setting this while an app state is attached to the state manager will have no effect on ID-based lookups.- Parameters:
- id- the desired ID
 
- 
getIdDescription copied from interface:AppStateReturns the unique ID for this AppState or null if it has no unique ID.
- 
setEnabledpublic void setEnabled(boolean enabled) passing true has the same effect as play() you should use play(), pause(), stop() to handle the cinematic playing state.- Specified by:
- setEnabledin interface- AppState
- Parameters:
- enabled- true or false
 
- 
isEnabledpublic boolean isEnabled()return true if the cinematic appstate is enabled (the cinematic is playing)
- 
stateAttachedcalled internally- Specified by:
- stateAttachedin interface- AppState
- Parameters:
- stateManager- the state manager
 
- 
stateDetachedcalled internally- Specified by:
- stateDetachedin interface- AppState
- Parameters:
- stateManager- the state manager
 
- 
updatepublic void update(float tpf) called internally don't call it directly.
- 
onUpdatepublic void onUpdate(float tpf) used internally, don't call this directly.- Specified by:
- onUpdatein class- AbstractCinematicEvent
- Parameters:
- tpf- time per frame (in seconds)
 
- 
setTimepublic void setTime(float time) This is used internally but can be called to shuffle through the cinematic.- Specified by:
- setTimein interface- CinematicEvent
- Overrides:
- setTimein class- AbstractCinematicEvent
- Parameters:
- time- the time to shuffle to.
 
- 
addCinematicEventAdds a cinematic event to this cinematic at the given timestamp. This operation returns a keyFrame- Parameters:
- timeStamp- the time when the event will start after the beginning of the cinematic
- cinematicEvent- the cinematic event
- Returns:
- the keyFrame for that event.
 
- 
enqueueCinematicEventEnqueue a cinematic event to a Cinematic. This is handy when you want to chain events without knowing their durations.- Parameters:
- cinematicEvent- the cinematic event to enqueue
- Returns:
- the timestamp the event was scheduled.
 
- 
removeCinematicEventremoves the first occurrence found of the given cinematicEvent.- Parameters:
- cinematicEvent- the cinematicEvent to remove
- Returns:
- true if the element has been removed
 
- 
removeCinematicEventremoves the first occurrence found of the given cinematicEvent for the given time stamp.- Parameters:
- timeStamp- the timestamp when the cinematicEvent has been added
- cinematicEvent- the cinematicEvent to remove
- Returns:
- true if the element has been removed
 
- 
removeCinematicEventremoves the first occurrence found of the given cinematicEvent for the given keyFrame- Parameters:
- keyFrame- the keyFrame returned by the addCinematicEvent method.
- cinematicEvent- the cinematicEvent to remove
- Returns:
- true if the element has been removed
 
- 
rendercalled internally
- 
postRenderpublic void postRender()called internally- Specified by:
- postRenderin interface- AppState
- See Also:
 
- 
cleanuppublic void cleanup()called internally
- 
fitDurationpublic void fitDuration()fits the duration of the cinematic to the duration of all its child cinematic events
- 
bindCameraBinds a camera to this Cinematic, tagged by a unique name. This method creates and returns a CameraNode for the cam and attaches it to the scene. The control direction is set to SpatialToCamera. This camera Node can then be used in other events to handle the camera movements during playback.- Parameters:
- cameraName- the unique tag the camera should have
- cam- the scene camera.
- Returns:
- the created CameraNode.
 
- 
getCamerareturns a cameraNode given its name- Parameters:
- cameraName- the camera name (as registered in Cinematic#bindCamera())
- Returns:
- the cameraNode for this name
 
- 
setActiveCameraSets the active camera instantly (use activateCamera if you want to schedule that event)- Parameters:
- cameraName- the camera name (as registered in Cinematic#bindCamera())
 
- 
activateCameraschedule an event that will activate the camera at the given time- Parameters:
- timeStamp- the time to activate the cam
- cameraName- the camera name (as registered in Cinematic#bindCamera())
 
- 
putEventDataused internally put an eventdata in the cinematic- Parameters:
- type- the type of data
- key- the key
- object- the data
 
- 
getEventDataused internally return and event data- Parameters:
- type- the type of data
- key- the key
- Returns:
- the pre-existing object, or null
 
- 
removeEventDataUsed internally remove an eventData- Parameters:
- type- the type of data
- key- the key of the data
 
- 
setScenesets the scene to use for this cinematic it is expected that the scene is added before adding events to the cinematic- Parameters:
- scene- the scene where the cinematic should take place.
 
- 
getScenereturn the scene where the cinematic occur- Returns:
- the scene
 
- 
clearpublic void clear()Remove all events from the Cinematic.
- 
disposepublic void dispose()used internally to clean up the cinematic. Called when the clear() method is called- Specified by:
- disposein interface- CinematicEvent
- Overrides:
- disposein class- AbstractCinematicEvent
 
 
-