Package org.xj3d.ui.construct
Class BlockingWorldLoader
java.lang.Object
org.xj3d.ui.construct.BlockingWorldLoader
- All Implemented Interfaces:
Runnable,BrowserCoreListener,FrameStateListener
public class BlockingWorldLoader
extends Object
implements Runnable, BrowserCoreListener, FrameStateListener
A function module that handles world loading and blocks until the
world is loaded and all the content loader threads return to their
idle state. Additionally this loader reduces the frame rate while
loading is in process to prevent unnecessary CPU time being spent
on rendering.
- Version:
- $Revision: 1.2 $
- Author:
- Rex Melton
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConstructThe construct instance to loadprotected org.j3d.util.ErrorReporterThe error reporting mechanismprotected Map<String[], LoadRequest> Map of in progress loader tasksprotected LoaderThreadPoolManager of the loader threadsprotected booleanSynchronization variable, indicating that loader threads are activeprotected booleanThe completion status of the load, true for success, false otherwise.protected ContentLoadQueueShared queue of load tasksprotected ScenePreprocessorThe preprocessor to invoke after the scene is loaded, and before the scene is set to the Constructprotected InputSourceThe source to load from -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNotification that the rendering of the event model is complete and that rendering is about to begin.voidIgnored.voidbrowserInitialized(VRMLScene scene) The browser has been initialised with new content.voidIgnored.booleanReturn whether loading threads are activebooleanload(InputSource source) Load the world from the specified source, return when all the loading threads have returned to the idle state.voidrun()Thread that handles the initial world loadvoidsetScenePreprocessor(ScenePreprocessor preprocessor) Set the preprocessor modulevoidurlLoadFailed(String msg) Ignored.
-
Field Details
-
construct
The construct instance to load -
preprocessor
The preprocessor to invoke after the scene is loaded, and before the scene is set to the Construct -
errorReporter
protected org.j3d.util.ErrorReporter errorReporterThe error reporting mechanism -
source
The source to load from -
loadStatus
protected boolean loadStatusThe completion status of the load, true for success, false otherwise. -
loadInProgress
protected boolean loadInProgressSynchronization variable, indicating that loader threads are active -
loaderPool
Manager of the loader threads -
pending
Shared queue of load tasks -
inProgress
Map of in progress loader tasks
-
-
Constructor Details
-
BlockingWorldLoader
Constructor- Parameters:
construct- The Construct instance to load to
-
-
Method Details
-
run
-
browserInitialized
The browser has been initialised with new content. The content given is found in the accompanying scene and description.- Specified by:
browserInitializedin interfaceBrowserCoreListener- Parameters:
scene- The scene of the new content
-
urlLoadFailed
Ignored. The tried to load a URL and failed. It is typically because none of the URLs resolved to anything valid or there were network failures.- Specified by:
urlLoadFailedin interfaceBrowserCoreListener- Parameters:
msg- An error message to go with the failure
-
browserShutdown
public void browserShutdown()Ignored. The browser has been shut down and the previous content is no longer valid.- Specified by:
browserShutdownin interfaceBrowserCoreListener
-
browserDisposed
public void browserDisposed()Ignored. The browser has been disposed, all resources may be freed.- Specified by:
browserDisposedin interfaceBrowserCoreListener
-
allEventsComplete
public void allEventsComplete()Description copied from interface:FrameStateListenerNotification that the rendering of the event model is complete and that rendering is about to begin. If the node needs to update itself for this frame, it should do so now before the render pass takes place.- Specified by:
allEventsCompletein interfaceFrameStateListener
-
load
Load the world from the specified source, return when all the loading threads have returned to the idle state.- Parameters:
source- The source to load- Returns:
- a flag indicating load success of failure
-
isLoadingInProgress
public boolean isLoadingInProgress()Return whether loading threads are active- Returns:
- whether loading threads are active. true if there are loading threads active, false if the loading threads are idle.
-
setScenePreprocessor
Set the preprocessor module- Parameters:
preprocessor- The ScenePreprocessor module. If null, this clears any previous preprocessor module.
-