Well, it looks like i chased a bug in utils package. That is in
com.sun.j3d.loaders.objectfile.ObjectFile class. It concerns loading
model via URL. And it's in private void setBaseUrlFromUrl(URL url)
function. In the source code, url is parsed with the help of
StringTokenizer class with java.io.File.separator as a tokenazer. The
problem is that though it would be correct only in case of Unix systems,
it's not like that under Windows systems, where file separator is "\".
That's why the function throughs MalformedURLException when a new URL is
being constructed from the old one (url). To my mind the parsing that is
made there is not needed at all and the function could have been made
much more simpler. But this's actually the matter of taste unless it
doesn't cause problems. In this case it does, though not fatal ones. Due
to this error baseUrl is not set at all and theoretically when there
would be an .obj file that uses some external resources, it would fail
to find them. (I'm not familiar with 3D formats and since i hadn't any
.obj that uses some external resources (i wonder what resources 3D file
could need at all? Textures?) i couldn't _test_ this, but in theory...).
Moreover, setBaseUrl(URL url) function is again practically useless if
one loads 3D model via URL, since load(URL url) function would overwrite
baseUrl var via notorious setBaseUrlFromUrl function regardless of
fromUrl flag. Again, all the above doesn't cause any fatal errors and
model loads after a while, but the error is constantly displayed. And
coming back to setBaseUrlFromUrl function i would (and actually already
did) substitute it with the following few lines:
> private void setBaseUrlFromUrl(URL url){
> String urlStr = url.toString();
> String baseUrlStr = urlStr.substring(
> 0, urlStr.lastIndexOf(separator)+separator.length());
>
> try {
> baseUrl = new URL(baseUrlStr);
> }
> catch (MalformedURLException e) {
> System.err.println("Error setting base URL: " + e.getMessage());
> }
> } // End of setBaseUrlFromUrl
where separator is "/" that is used as a divider in URLs.
As far as i could understand you could be a guy from Sun. If u really
are, please, correct this a kind of mistake. And BTW, it looks like the
speed of loading/parsing are different when the model is loaded via URL
and as a File (via String). Definitely when i tried to load the model
via local URL (file: protocol) it was possibly more than twice slower
than in case of via-String loading.
Thank u, whoever u r, for your time and attention,
vladimir
--
-=V=-
>~~~~~~~<=============>~~~~~~~<
Join in Java community now!
http://javacafe.virtualave.net/
>~~~~~~~<=============>~~~~~~~<
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".