001: /*
002: *
003: * Copyright (c) 2000-2001 Silvere Martin-Michiellot All Rights Reserved.
004: *
005: * Silvere Martin-Michiellot grants you ("Licensee") a non-exclusive,
006: * royalty free, license to use, modify but not to redistribute this
007: * software in source and binary code form,
008: * provided that i) this copyright notice and license appear on all copies of
009: * the software; and ii) Licensee does not utilize the software in a manner
010: * which is disparaging to Silvere Martin-Michiellot.
011: *
012: * This software is provided "AS IS," without a warranty of any kind. ALL
013: * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
014: * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
015: * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silvere Martin-Michiellot
016: * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
017: * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
018: * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
019: * Silvere Martin-Michiellot OR ITS LICENSORS BE LIABLE
020: * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
021: * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
022: * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
023: * OR INABILITY TO USE SOFTWARE, EVEN IF Silvere Martin-Michiellot HAS BEEN
024: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
025: *
026: * This software is not designed or intended for use in on-line control of
027: * aircraft, air traffic, aircraft navigation or aircraft communications; or in
028: * the design, construction, operation or maintenance of any nuclear
029: * facility. Licensee represents and warrants that it will not use or
030: * redistribute the Software for such purposes.
031: *
032: * @Author: Silvere Martin-Michiellot
033: *
034: */
035:
036: package com.db.loaders;
037:
038: import java.net.URL;
039: import java.io.Reader;
040: import java.io.FileNotFoundException;
041:
042: /**
043: * The Loader interface is used to specify the location
044: * and elements of a file format to load.
045: * The interface is used to give loaders of various
046: * file formats a common public interface. Ideally
047: * the Scene interface will be implemented to give
048: * the user a consistent interface to extract the
049: * data.
050: *
051: * @see com.db.loaders.Scene
052: */
053: public interface Loader {
054:
055: /* These are the values to be used in constructing the
056: * load flags for the loader. Users should OR the selected
057: * values together to construct an aggregate flag integer
058: * (see the setFlags() method). Users wishing to load all
059: * data in a file should use the LOAD_ALL specifier.
060: */
061:
062: /** This flag enables the loading of light objects into the scene.*/
063: public static final int LOAD_LIGHT_NODES = 1;
064:
065: /** This flag enables the loading of fog objects into the scene.*/
066: public static final int LOAD_FOG_NODES = 2;
067:
068: /** This flag enables the loading of background objects into the scene.*/
069: public static final int LOAD_BACKGROUND_NODES = 4;
070:
071: /** This flag enables the loading of behaviors into the scene.*/
072: public static final int LOAD_BEHAVIOR_NODES = 8;
073:
074: /** This flag enables the loading of view (camera) objects into
075: * the scene.*/
076: public static final int LOAD_VIEW_GROUPS = 16;
077:
078: /** This flag enables the loading of sound objects into the scene.*/
079: public static final int LOAD_SOUND_NODES = 32;
080:
081: /** This flag enables the loading of all objects into the scene.*/
082: public static final int LOAD_ALL = 0xffffffff;
083:
084: // Loading methods
085:
086: /**
087: * This method loads the named file and returns the Scene
088: * containing the scene. Any data files referenced by this
089: * file should be located in the same place as the named file;
090: * otherwise users should specify an alternate base path with
091: * the setBasePath(String) method.
092: */
093: public Scene load(String fileName) throws FileNotFoundException,
094: IncorrectFormatException, ParsingErrorException;
095:
096: /**
097: * This method loads the named file and returns the Scene
098: * containing the scene. Any data files referenced by the Reader
099: * should be located in the same place as the named file; otherwise,
100: * users should specify an alternate base path with the setBaseUrl(URL)
101: * method.
102: */
103: public Scene load(URL url) throws FileNotFoundException,
104: IncorrectFormatException, ParsingErrorException;
105:
106: /**
107: * This method loads the Reader and returns the Scene
108: * containing the scene. Any data files referenced by the Reader should
109: * be located in the user's current working directory.
110: */
111: public Scene load(Reader reader) throws FileNotFoundException,
112: IncorrectFormatException, ParsingErrorException;
113:
114: // Variable get/set methods
115:
116: /**
117: * This method sets the base URL name for data files associated with
118: * the file passed into the load(URL) method.
119: * The basePath should be null by default, which is an indicator
120: * to the loader that it should look for any associated files starting
121: * from the same directory as the file passed into the load(URL) method.
122: */
123: public void setBaseUrl(URL url);
124:
125: /**
126: * This method sets the base path name for data files associated with
127: * the file passed into the load(String) method.
128: * The basePath should be null by default, which is an indicator
129: * to the loader that it should look for any associated files starting
130: * from the same directory as the file passed into the load(String)
131: * method.
132: */
133: public void setBasePath(String pathName);
134:
135: /**
136: * Returns the current base URL setting. By default this is null,
137: * implying the loader should look for associated files starting
138: * from the same directory as the file passed into the load(URL) method.
139: */
140: public URL getBaseUrl();
141:
142: /**
143: * Returns the current base path setting. By default this is null,
144: * implying the loader should look for associated files starting
145: * from the same directory as the file passed into the load(String)
146: * method.
147: */
148: public String getBasePath();
149:
150: /**
151: * This method sets the load flags for the file. The flags should
152: * equal 0 by default (which tells the loader to only load geometry).
153: * To enable the loading of any particular scene elements, pass
154: * in a logical OR of the LOAD values specified above.
155: */
156: public void setFlags(int flags);
157:
158: /**
159: * Returns the current loading flags setting.
160: */
161: public int getFlags();
162:
163: }
|