public class Cinematic extends AbstractCinematicEvent implements AppState
, 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 handle the playback :
,
AbstractCinematicEvent.play()
,
AbstractCinematicEvent.pause()
,
A cinematic is itself a CinematicEvent, meaning you can embed several
Cinematics Embed cinematics must not be added to the stateManager though.
Cinematic has a way to handle several point of view by creating CameraNode
over a cam and activating them on schedule.
,
bindCamera(java.lang.String, com.jme3.renderer.Camera)
,
activateCamera(float, java.lang.String)
,
setActiveCamera(java.lang.String)
Modifier and Type | Field and Description |
---|---|
protected TimeLine |
timeLine |
initialDuration, listeners, loopMode, playState, resuming, speed, time
Modifier | Constructor and Description |
---|---|
protected |
Cinematic()
Used for serialization creates a cinematic, don't use this constructor
directly
|
|
Cinematic(float initialDuration) |
|
Cinematic(float initialDuration,
LoopMode loopMode) |
|
Cinematic(LoopMode loopMode) |
|
Cinematic(Node scene)
creates a cinematic
|
|
Cinematic(Node scene,
float initialDuration)
creates a cinematic
|
|
Cinematic(Node scene,
float initialDuration,
LoopMode loopMode)
creates a cinematic
|
|
Cinematic(Node scene,
LoopMode loopMode)
creates a cinematic
|
Modifier and Type | Method and Description |
---|---|
void |
activateCamera(float timeStamp,
java.lang.String cameraName)
schedule an event that will activate the camera at the given time
|
KeyFrame |
addCinematicEvent(float timeStamp,
CinematicEvent cinematicEvent)
Adds a cinematic event to this cinematic at the given timestamp.
|
CameraNode |
bindCamera(java.lang.String cameraName,
Camera cam)
Binds a camera to this cinematic, tagged by a unique name.
|
void |
cleanup()
called internally
|
void |
clear()
clear the cinematic of its events.
|
void |
dispose()
used internally to cleanup the cinematic.
|
float |
enqueueCinematicEvent(CinematicEvent cinematicEvent)
enqueue a cinematic event to a cinematic.
|
void |
fitDuration()
fits the duration of the cinematic to the duration of all its child
cinematic events
|
CameraNode |
getCamera(java.lang.String cameraName)
returns a cameraNode given its name
|
java.lang.Object |
getEventData(java.lang.String type,
java.lang.Object key)
used internally return and event data
|
java.lang.String |
getId()
Returns the unique ID for this AppState or null if it has no
unique ID.
|
Node |
getScene()
return the scene where the cinematic occur
|
void |
initialize(AppStateManager stateManager,
Application app)
used internally
|
boolean |
isEnabled()
return true if the cinematic appstate is enabled (the cinematic is
playing)
|
boolean |
isInitialized()
used internally
|
void |
onPause()
called internally
|
void |
onPlay()
called internally
|
void |
onStop()
called internally
|
void |
onUpdate(float tpf)
used internally, don't call this directly.
|
void |
postRender()
called internally
|
void |
putEventData(java.lang.String type,
java.lang.Object key,
java.lang.Object object)
used internally put an eventdata in the cinematic
|
void |
read(JmeImporter im)
used internally for serialization
|
boolean |
removeCinematicEvent(CinematicEvent cinematicEvent)
removes the first occurrence found of the given cinematicEvent.
|
boolean |
removeCinematicEvent(float timeStamp,
CinematicEvent cinematicEvent)
removes the first occurrence found of the given cinematicEvent for the
given time stamp.
|
boolean |
removeCinematicEvent(KeyFrame keyFrame,
CinematicEvent cinematicEvent)
removes the first occurrence found of the given cinematicEvent for the
given keyFrame
|
void |
removeEventData(java.lang.String type,
java.lang.Object key)
Used internally remove an eventData
|
void |
render(RenderManager rm)
called internally
|
void |
setActiveCamera(java.lang.String cameraName)
Sets the active camera instantly (use activateCamera if you want to
schedule that event)
|
void |
setEnabled(boolean enabled)
passing true has the same effect as play() you should use play(),
pause(), stop() to handle the cinematic playing state.
|
protected void |
setId(java.lang.String id)
Sets the unique ID of this app state.
|
void |
setScene(Node scene)
sets the scene to use for this cinematic it is expected that the scene is
added before adding events to the cinematic
|
void |
setSpeed(float speed)
sets the speed of the cinematic.
|
void |
setTime(float time)
This is used internally but can be called to shuffle through the
cinematic.
|
void |
stateAttached(AppStateManager stateManager)
called internally
|
void |
stateDetached(AppStateManager stateManager)
called internally
|
void |
update(float tpf)
called internally don't call it directly.
|
void |
write(JmeExporter ex)
used internally for serialization
|
addListener, forceStop, getDuration, getInitialDuration, getLoopMode, getPlayState, getSpeed, getTime, initEvent, internalUpdate, pause, play, removeListener, setInitialDuration, setLoopMode, stop
protected TimeLine timeLine
protected Cinematic()
public Cinematic(float initialDuration)
public Cinematic(LoopMode loopMode)
public Cinematic(float initialDuration, LoopMode loopMode)
public Cinematic(Node scene)
scene
- the scene in which the cinematic should take placepublic Cinematic(Node scene, float initialDuration)
scene
- the scene in which the cinematic should take placeinitialDuration
- the duration of the cinematic (without considering
the speed)public Cinematic(Node scene, LoopMode loopMode)
scene
- the scene in which the cinematic should take placeloopMode
- tells if this cinematic should be looped or notpublic Cinematic(Node scene, float initialDuration, LoopMode loopMode)
scene
- the scene in which the cinematic should take placeinitialDuration
- the duration of the cinematic (without considering
the speed)loopMode
- tells if this cinematic should be looped or notpublic void onPlay()
onPlay
in class AbstractCinematicEvent
public void onStop()
onStop
in class AbstractCinematicEvent
public void onPause()
onPause
in class AbstractCinematicEvent
public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
write
in class AbstractCinematicEvent
ex
- java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
read
in class AbstractCinematicEvent
im
- java.io.IOException
public void setSpeed(float speed)
setSpeed
in interface CinematicEvent
setSpeed
in class AbstractCinematicEvent
speed
- the speedpublic void initialize(AppStateManager stateManager, Application app)
initialize
in interface AppState
stateManager
- the state managerapp
- the applicationpublic boolean isInitialized()
isInitialized
in interface AppState
protected void setId(java.lang.String id)
public java.lang.String getId()
AppState
public void setEnabled(boolean enabled)
setEnabled
in interface AppState
enabled
- true or falsepublic boolean isEnabled()
isEnabled
in interface AppState
AppState.setEnabled(boolean)
public void stateAttached(AppStateManager stateManager)
stateAttached
in interface AppState
stateManager
- the state managerpublic void stateDetached(AppStateManager stateManager)
stateDetached
in interface AppState
stateManager
- the state managerpublic void update(float tpf)
public void onUpdate(float tpf)
onUpdate
in class AbstractCinematicEvent
tpf
- public void setTime(float time)
setTime
in interface CinematicEvent
setTime
in class AbstractCinematicEvent
time
- the time to shuffle to.public KeyFrame addCinematicEvent(float timeStamp, CinematicEvent cinematicEvent)
timeStamp
- the time when the event will start after the beginning
of the cinematiccinematicEvent
- the cinematic eventpublic float enqueueCinematicEvent(CinematicEvent cinematicEvent)
cinematicEvent
- the cinematic event to enqueuepublic boolean removeCinematicEvent(CinematicEvent cinematicEvent)
cinematicEvent
- the cinematicEvent to removepublic boolean removeCinematicEvent(float timeStamp, CinematicEvent cinematicEvent)
timeStamp
- the timestamp when the cinematicEvent has been addedcinematicEvent
- the cinematicEvent to removepublic boolean removeCinematicEvent(KeyFrame keyFrame, CinematicEvent cinematicEvent)
keyFrame
- the keyFrame returned by the addCinematicEvent method.cinematicEvent
- the cinematicEvent to removepublic void render(RenderManager rm)
render
in interface AppState
rm
- RenderManagerAppState.render(com.jme3.renderer.RenderManager)
public void postRender()
postRender
in interface AppState
AppState.postRender()
public void cleanup()
cleanup
in interface AppState
AppState.cleanup()
public void fitDuration()
public CameraNode bindCamera(java.lang.String cameraName, Camera cam)
cameraName
- the unique tag the camera should havecam
- the scene camera.public CameraNode getCamera(java.lang.String cameraName)
cameraName
- the camera name (as registered in
Cinematic#bindCamera())public void setActiveCamera(java.lang.String cameraName)
cameraName
- the camera name (as registered in
Cinematic#bindCamera())public void activateCamera(float timeStamp, java.lang.String cameraName)
timeStamp
- the time to activate the camcameraName
- the camera name (as registered in
Cinematic#bindCamera())public void putEventData(java.lang.String type, java.lang.Object key, java.lang.Object object)
type
- the type of datakey
- the keyobject
- the datapublic java.lang.Object getEventData(java.lang.String type, java.lang.Object key)
type
- the type of datakey
- the keypublic void removeEventData(java.lang.String type, java.lang.Object key)
type
- the type of datakey
- the key of the datapublic void setScene(Node scene)
scene
- the scene where the cinematic should take place.public Node getScene()
public void clear()
public void dispose()
dispose
in interface CinematicEvent
dispose
in class AbstractCinematicEvent