If anyone is working with the Obj file loader this may be of some interest.
In working with the com.sun.j3d.loaders.objectfile.ObjectFile class I've
noticed that the load(String filename) method is a *LOT* faster than the
load(URL url) method. Looking at the source I noticed that the String
version sends a BufferedReader to the load(Reader reader) method while the
URL version sends an InputStreamReader. By modifying the load(URL url)
method slightly to send a BufferedReader I was able to load files a lot
faster. (19 times faster on my system!) Here's what I did...
public Scene load(URL url) throws FileNotFoundException,
IncorrectFormatException,
ParsingErrorException
{
InputStreamReader isr; // renamed
BufferedReader reader; // new
setBaseUrlFromUrl(url);
try {
isr = new InputStreamReader(new
BufferedInputStream(url.openStream()));
reader = new BufferedReader(isr); // new
}
catch (IOException e) {
throw new FileNotFoundException();
}
fromUrl = true;
return load(reader);
} // End of load(URL)
Perhaps a change like this could be made to this class in the next version
of Java3D.
Cindy
__________________________________________
| |
| Cindy Ballreich |
|\ | Technical Director - 3D Visualization |
_/ .`-| Computer Associates International, Inc. | ,
\ .4 | [EMAIL PROTECTED] |\__//
`--'\| [EMAIL PROTECTED] |`--'
C|__________________________________________|
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/