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 Construct
The construct instance to loadprotected org.j3d.util.ErrorReporter
The error reporting mechanismprotected Map
<String[], LoadRequest> Map of in progress loader tasksprotected LoaderThreadPool
Manager of the loader threadsprotected boolean
Synchronization variable, indicating that loader threads are activeprotected boolean
The completion status of the load, true for success, false otherwise.protected ContentLoadQueue
Shared queue of load tasksprotected ScenePreprocessor
The preprocessor to invoke after the scene is loaded, and before the scene is set to the Constructprotected InputSource
The source to load from -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Notification that the rendering of the event model is complete and that rendering is about to begin.void
Ignored.void
browserInitialized
(VRMLScene scene) The browser has been initialised with new content.void
Ignored.boolean
Return whether loading threads are activeboolean
load
(InputSource source) Load the world from the specified source, return when all the loading threads have returned to the idle state.void
run()
Thread that handles the initial world loadvoid
setScenePreprocessor
(ScenePreprocessor preprocessor) Set the preprocessor modulevoid
urlLoadFailed
(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:
browserInitialized
in 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:
urlLoadFailed
in 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:
browserShutdown
in interfaceBrowserCoreListener
-
browserDisposed
public void browserDisposed()Ignored. The browser has been disposed, all resources may be freed.- Specified by:
browserDisposed
in interfaceBrowserCoreListener
-
allEventsComplete
public void allEventsComplete()Description copied from interface:FrameStateListener
Notification 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:
allEventsComplete
in 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.
-