|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xith3d.loop.UpdatingThread
org.xith3d.loop.RenderLoop
public class RenderLoop
This loop renders the scene in a separate thread. You can schedule operations to be done by the thread in the next loop iteration.
You can schedule animations to be done by the thread in the next loop iteration.,
You can get the fps count from this loop and set the maximum FPS.,
FPSListener| Nested Class Summary | |
|---|---|
static class |
RenderLoop.RunMode
You can start the RenderLoop in the same Thread as the app itself or in a separate one. |
static class |
RenderLoop.StopOperation
Use this enum for the setStopOperation() method. |
| Nested classes/interfaces inherited from class org.xith3d.loop.UpdatingThread |
|---|
UpdatingThread.TimingMode |
| Field Summary | |
|---|---|
static int |
PAUSE_RENDERING
|
| Fields inherited from class org.xith3d.loop.UpdatingThread |
|---|
PAUSE_NONE, PAUSE_TOTAL |
| Constructor Summary | |
|---|---|
RenderLoop()
Creates a new instance |
|
RenderLoop(float maxFPS)
Creates a new instance |
|
RenderLoop(Xith3DEnvironment x3dEnv)
Creates a new instance |
|
RenderLoop(Xith3DEnvironment x3dEnv,
float maxFPS)
Creates a new instance |
|
| Method Summary | |
|---|---|
void |
addFPSListener(FPSListener l)
Adds a new FPSListener to this loop to be notified periodically. |
void |
addRenderLoopListener(RenderLoopListener l)
Adds a new RenderLoopListener to this loop. |
void |
addUpdatable(Updatable updatable)
Adds a new Updatable instance to the list, that is worked each frame. |
void |
begin()
Starts this rendering-loop in the same Thread and with TimingMode.MICROSECONDS. |
void |
begin(RenderLoop.RunMode runMode)
Starts this rendering-loop with TimingMode.MICROSECONDS. |
void |
begin(RenderLoop.RunMode runMode,
UpdatingThread.TimingMode timingMode)
Starts this RenderLoop. |
void |
begin(UpdatingThread.TimingMode timingMode)
Starts this rendering-loop in the same Thread. |
protected void |
destroy()
This method is invoked, when the RenderLoop stopped and the StopOperation is set to DESTROY or DESTROY_AND_EXIT. |
protected void |
destroyAndExit()
This method is invoked, when the RenderLoop stopped and the StopOperation is set to DESTROY_AND_EXIT. |
void |
end()
|
protected void |
exit()
This method is invoked, when the RenderLoop stopped and the StopOperation is set to DESTROY_AND_EXIT. |
Animator |
getAnimator()
|
float |
getFPS()
|
long |
getFPSCalcInterval()
|
float |
getMaxFPS()
|
OperationScheduler |
getOperationScheduler()
|
RenderLoop.RunMode |
getRunMode()
|
RenderLoop.StopOperation |
getStopOperation()
|
java.lang.Thread |
getThread()
|
float |
getTotalAverageFPS()
|
Updater |
getUpdater()
|
Xith3DEnvironment |
getXith3DEnvironment()
|
protected void |
loop()
This method defines the main loop of the Thread. |
protected void |
loopIteration(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
This method is called each loop iteration. |
long |
nextFrame()
If the RenderLoop is currently running in RUN_IN_SEPARATE_THREAD_AND_WAIT RunMode the next iteration is allowed and executed asynchronously. -1 is returned as the frame time, because it is not defined at this time. |
protected long |
nextIteration(boolean force)
|
protected void |
onFPSCountIntervalHit(float fps)
This method is called by the render loop each counting interval |
protected void |
onRenderLoopPaused(long gameTime,
UpdatingThread.TimingMode timingMode,
int pauseMode)
This event is fired by the RenderLoop when the pauseMode has been increased. |
protected void |
onRenderLoopResumed(long gameTime,
UpdatingThread.TimingMode timingMode,
int pauseMode)
This event is fired by the RenderLoop when the pauseMode has been released. |
protected void |
onRenderLoopStarted()
This method is executed by the RenderLoop when the thread has been started. |
protected void |
onRenderLoopStopped(long gameTime,
UpdatingThread.TimingMode timingMode,
float averageFPS)
This method is executed by the RenderLoop when the thread has been stopped. |
void |
pauseRendering()
pauses rendering in this RenderLoop |
protected void |
prepareNextFrame(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
This method is called each loop iteration before the renderNextFrame() methiod. |
void |
removeFPSListener(FPSListener l)
Removes an FPSListener from this loop. |
void |
removeRenderLoopListener(RenderLoopListener l)
Removes a RenderLoopListener from this loop. |
void |
removeUpdatable(Updatable updatable)
Removes an Updatable instance from the list, that is worked each frame. |
protected void |
renderNextFrame(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
Just calls the render() method on the linked Xith3DEnvironment. |
void |
resumeRendering()
resumes rendering in this RenderLoop |
void |
run()
|
void |
setFPSCalcInterval(long micros)
Sets the interval in which the FPS are recalculated |
void |
setMaxFPS(float maxFPS)
Sets the maximum frames per second. |
void |
setOperationScheduler(OperationScheduler opScheder)
Sets the OperationScheduler to be used by this RenderLoop (can be null). |
void |
setStopOperation(RenderLoop.StopOperation operation)
Sets the StopOperation to invoke when the RenderLoop stops. |
void |
setUpdater(Updater updater)
Sets the Updater, that manages the Updatables. |
void |
setXith3DEnvironment(Xith3DEnvironment env)
Sets the Xith3DEnvironment to this RenderLoop to be updated
frame-by-frame. |
void |
update(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
Updates this Updatable object. |
| Methods inherited from class org.xith3d.loop.UpdatingThread |
|---|
begin, getFPSLimiter, getGameMicroTime, getGameMilliTime, getGameNanoTime, getGameTime, getIterationsCount, getLastFrameTime, getLastNanoFrameTime, getMinIterationTime, getPauseMode, getTimer, getTimingMode, isRunning, isStopping, setFPSLimiter, setMinIterationTime, setPauseMode, setTimer, setTimingMode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PAUSE_RENDERING
| Constructor Detail |
|---|
public RenderLoop(Xith3DEnvironment x3dEnv,
float maxFPS)
x3dEnv - the Xith3DEnvironment to be linked with this RenderLoop.maxFPS - the maximum FPS to render atpublic RenderLoop(float maxFPS)
maxFPS - the maximum FPS to render atpublic RenderLoop(Xith3DEnvironment x3dEnv)
x3dEnv - the Xith3DEnvironment to be linked with this RenderLoop.public RenderLoop()
| Method Detail |
|---|
public RenderLoop.RunMode getRunMode()
RenderLoop.RunModepublic void setStopOperation(RenderLoop.StopOperation operation)
operation - RenderLoop.StopOperationpublic RenderLoop.StopOperation getStopOperation()
RenderLoop.StopOperationpublic void setOperationScheduler(OperationScheduler opScheder)
opScheder - public final OperationScheduler getOperationScheduler()
public Animator getAnimator()
public void addFPSListener(FPSListener l)
l - the new FPSListenerpublic void removeFPSListener(FPSListener l)
l - the FPSListener to be removedpublic void setUpdater(Updater updater)
Updater, that manages the Updatables.
public final Updater getUpdater()
Updater, that manages the Updatables.public final void addUpdatable(Updatable updatable)
addUpdatable in interface Updaterpublic final void removeUpdatable(Updatable updatable)
removeUpdatable in interface Updaterpublic void addRenderLoopListener(RenderLoopListener l)
l - the new RenderLoopListenerpublic void removeRenderLoopListener(RenderLoopListener l)
l - the RenderLoopListener to be removedpublic void setXith3DEnvironment(Xith3DEnvironment env)
Xith3DEnvironment to this RenderLoop to be updated
frame-by-frame.
env - the Xith3DEnvironment to be updated by this looppublic final Xith3DEnvironment getXith3DEnvironment()
Xith3DEnvironment, which is linked to this RenderLoop.protected void onRenderLoopStarted()
protected void onRenderLoopStopped(long gameTime,
UpdatingThread.TimingMode timingMode,
float averageFPS)
gameTime - the current gameTimetimingMode - averageFPS - the average FPS over the time the loop was runningprotected void destroy()
RenderLoop.StopOperation,
setStopOperation(StopOperation),
end()protected void exit()
setStopOperation(StopOperation),
end()protected void destroyAndExit()
setStopOperation(StopOperation),
end()public void end()
end in class UpdatingThread
protected void onRenderLoopPaused(long gameTime,
UpdatingThread.TimingMode timingMode,
int pauseMode)
gameTime - the current gameTimetimingMode - pauseMode - the current pause-mode
protected void onRenderLoopResumed(long gameTime,
UpdatingThread.TimingMode timingMode,
int pauseMode)
gameTime - the current gameTimetimingMode - pauseMode - the current pause-modepublic void setMaxFPS(float maxFPS)
public float getMaxFPS()
public float getFPS()
public float getTotalAverageFPS()
public void setFPSCalcInterval(long micros)
micros - the new calculation intervalpublic long getFPSCalcInterval()
protected void prepareNextFrame(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
gameTime - the current game timeframeTime - time needed to render the last frametimingMode -
protected void renderNextFrame(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
gameTime - the current game timeframeTime - time needed to render one frametimingMode -
protected void loopIteration(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
gameTime - the current game timeframeTime - time needed to render one frametimingMode - protected void onFPSCountIntervalHit(float fps)
fps - the average frames count during the last interval
public void update(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
update in interface Updatableupdate in class UpdatingThreadgameTime - the gameTime in MillisecondsframeTime - the frameTime in Milliseconds (needed time for the last frame)timingMode - the TimingMode to use for frameTime.protected long nextIteration(boolean force)
nextIteration in class UpdatingThreadpublic long nextFrame()
nextFrame in interface RenderLoopControllerprotected void loop()
loop in class UpdatingThreadpublic java.lang.Thread getThread()
getThread in class UpdatingThreadpublic void run()
run in interface java.lang.Runnablerun in class UpdatingThread
public void begin(RenderLoop.RunMode runMode,
UpdatingThread.TimingMode timingMode)
runMode - the RunMode this RenderLoop will run intimingMode - the TimingMode to usepublic final void begin(RenderLoop.RunMode runMode)
runMode - the RunMode this RenderLoop will run inpublic final void begin(UpdatingThread.TimingMode timingMode)
timingMode - the TimingMode to usepublic final void begin()
public void pauseRendering()
public void resumeRendering()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||