Class BaseLoader
- All Implemented Interfaces:
org.j3d.renderer.aviatrix3d.loader.AVLoader
- Direct Known Subclasses:
VRML97Loader
,Web3DLoader
,X3DLoader
The loader considers sensor handling and routing to be behaviours. Some asynchronous loading of files for textures is performed. Sound file loading is performed if audio clips are asked for. For example, if behaviours are not requested then Inlines will not have their content loaded.
If the loader asks for no runtime, then we will still load nodes that need a runtime system to work, but will disable their use. For example, a LOD will still need to have all of the geometry loaded, just not shown or activated because the LOD's internal behavior is disabled. Scripts are considered to be behaviours, and they will not be loaded at all if runtime loading is disabled.
The implementation only makes use of two behaviours. One is a per-frame
behaviour for the event model evaluation. The other is a handler for
trapping user input events. If you disable behaviours, you loose both
of these. For content other than static geometry, such as animations,
turning off behaviours will result in no animations. However, every loaded
scene will be attempting to do work like navigation. This will become quite
CPU intensive because every model will be performing picking operations.
To cut down on this CPU usage, the navigation processing is turned off
by default. If you want the loaded code to also do the navigation of the
viewpoints, then you can call the setNavigationEnable() method.
The default setup for runtime activities is
ListsRouterFactory
and
MemCacheLoadManager
- Version:
- $Revision: 1.8 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.j3d.util.ErrorReporter
Class that represents the external reporterprotected boolean
Flag to say if the scene builder factory should only use VRML97Fields inherited from interface org.j3d.renderer.aviatrix3d.loader.AVLoader
BACKGROUNDS, FOGS, GEOMETRY, LAYERS, LIGHTS, LOAD_ALL, RUNTIMES, VIEWPOINTS
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Construct a default loader implementation with no flags set. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the current set collection of load flags.boolean
Get the currently set navigation state.boolean
Check to see whether the loader should be currently keeping the internal model.void
keepInternalModel
(boolean enable) Define whether this loader should also keep around it's internal representation of the file format, if it has one.org.j3d.renderer.aviatrix3d.loader.AVModel
Load a model from the given file.org.j3d.renderer.aviatrix3d.loader.AVModel
load
(InputStream stream) Load a model from the given input stream.org.j3d.renderer.aviatrix3d.loader.AVModel
Load a model from the given URL.void
registerURNLocation
(String prefix, String directory) Add a prefix and directory to the URN resolution system.void
setErrorReporter
(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.void
setLoadFlags
(int flags) Set the flags for which parts of the file that should be loaded.void
setNavigationEnabled
(boolean state) Enable or disable navigation processing sub-section of the user input processing.
-
Field Details
-
vrml97Only
protected boolean vrml97OnlyFlag to say if the scene builder factory should only use VRML97 -
errorReporter
protected org.j3d.util.ErrorReporter errorReporterClass that represents the external reporter
-
-
Constructor Details
-
BaseLoader
protected BaseLoader()Construct a default loader implementation with no flags set. When asked to load a file it will not produce anything unless flags have been set through thesetFlags()
method.
-
-
Method Details
-
load
Load a model from the given URL.- Specified by:
load
in interfaceorg.j3d.renderer.aviatrix3d.loader.AVLoader
- Parameters:
url
- The url to load the model from- Returns:
- A representation of the model at the URL
- Throws:
IOException
- something went wrong while reading the file
-
load
Load a model from the given input stream. If the file format would prefer to use aReader
interface, then use theInputStreamReader
to convert this stream to the desired type. The caller will be responsible for closing down the stream at the end of this process.- Specified by:
load
in interfaceorg.j3d.renderer.aviatrix3d.loader.AVLoader
- Parameters:
stream
- The stream to load the model from- Returns:
- A representation of the model from the stream contents
- Throws:
IOException
- something went wrong while reading the file
-
load
Load a model from the given file.- Specified by:
load
in interfaceorg.j3d.renderer.aviatrix3d.loader.AVLoader
- Parameters:
file
- The file instance to load the model from- Returns:
- A representation of the model in the file
- Throws:
IOException
- something went wrong while reading the file
-
setLoadFlags
public void setLoadFlags(int flags) Set the flags for which parts of the file that should be loaded. The flags are bit-fields, so can be bitwise OR'd together.- Specified by:
setLoadFlags
in interfaceorg.j3d.renderer.aviatrix3d.loader.AVLoader
- Parameters:
flags
- The collection of flags to use
-
getLoadFlags
public int getLoadFlags()Get the current set collection of load flags.- Specified by:
getLoadFlags
in interfaceorg.j3d.renderer.aviatrix3d.loader.AVLoader
- Returns:
- A bitmask of flags that are currently set
-
keepInternalModel
public void keepInternalModel(boolean enable) Define whether this loader should also keep around it's internal representation of the file format, if it has one. If kept, this can be retrieved through theAVModel.getRawModel()
method and cast to the appropriate class type.- Specified by:
keepInternalModel
in interfaceorg.j3d.renderer.aviatrix3d.loader.AVLoader
- Parameters:
enable
- true to enable keeping the raw model, false otherwise
-
isInternalModelKept
public boolean isInternalModelKept()Check to see whether the loader should be currently keeping the internal model.- Specified by:
isInternalModelKept
in interfaceorg.j3d.renderer.aviatrix3d.loader.AVLoader
- Returns:
- true when the internal model should be kept
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Parameters:
reporter
- The instance to use or null
-
registerURNLocation
Add a prefix and directory to the URN resolution system. Whenever the prefix is found under the web3d area, this directory will be searched.- Parameters:
prefix
- The subspace prefix to usedirectory
- The directory that GeoVRML is installed in- Throws:
IllegalArgumentException
- The directory is not valid
-