This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > VRML > January 2004 > Re: Cross-viewer compatability work-around - relative path naming
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Cross-viewer compatability work-around - relative path naming
|
|
| Herbert Stocker 2004-01-03, 5:28 am |
| Hi.
I think Contact searches paths in both directories - relative to
the main file and relative to the file where the URL comes from -
but i never tried this.
One solution, but not the most elegant one would be to put all
files into the same directory.
Herbert
PrisNo6 wrote:quote:
> I am attempting to conform a world I developed with Cortona viewer for
> cross-viewer compatability with CosmoPlayer and Blaxxun. The world
> works fine with Cortona under IE 6.0 and NN 7.0. Apparently,
> CosmoPlayer and Blaxxun implement relative path names to external
> proto files differently, as compared to Cortona.
>
> In Cortona, the following relative path names for external protos are
> valid:
>
> World.wrl refers to EXTERNPROTO
> --> "lib/SO_proto.wrl" which refers to EXTERNPROTO
> --> "Wire_Sphere_proto.wrl" also located in subdirectory
> lib/
>
> Cortona, correctly, determines the relative path to
> "Wire_Sphere_proto.wrl" is in subdirectory "lib/" (since
> "SO_proto.wrl" is in "lib/" when it is invoked).
>
> In CosmoPlayer and Blaxxun, the above relative referencing path is
> _invalid_. All relative path referencing must be with respect to the
> root of the world, e.g. -
>
> World.wrl refers to EXTERNPROTO
> --> "lib/SO_proto.wrl" which refers to EXTERNPROTO
> --> "lib/Wire_Sphere_proto.wrl" also located in subdirectory
> lib/
>
> The difference between the two syntaxes is:
>
> "Wire_Sphere_proto.wrl" vs. "lib/Wire_Sphere_proto.wrl"
>
> Now my problem and question is this - is there some relative path
> referencing syntax that all three viewers - Cortona, Blaxxun and
> CosmoPlayer - are happy with? "../lib/Wire_Sphere_proto.wrl" does not
> work.
>
> If you have run into this before, please let me know your work around.
>
> I came up with a temporary and inelegant solution to keep all three
> VRML viewers happy, but there has to be a better way.
>
> - Thanks Kurt
--
Herbert Stocker (aka hersto)
http://www.hersto.de
www.bitmanagement.de
| |
| muaddib 2004-01-05, 1:31 pm |
| PrisNo6,
I use relative referencing often and have no problems, perhaps you
are doing something different. I concocted an example similar to yours
that works in both Blaxxun and Cortona.quote:
> World.wrl refers to EXTERNPROTO
> --> "lib/SO_proto.wrl" which refers to EXTERNPROTO
> --> "Wire_Sphere_proto.wrl" also located in subdirectory
> lib/
My directory structure:
test --> subdirectory
test contains the file top.wrl, subdirectory contains the files
middle.wrl and bottom.wrl.
bottom.wrl
PROTO Bottom [] { Shape { geometry Box {} } }
middle.wrl
EXTERNPROTO Bottom [] "bottom.wrl"
PROTO Middle [] { Bottom{} }
top.wrl
EXTERNPROTO Middle [] "subdirectory/middle.wrl"
#Middle{}
PROTO Top [] { Middle {} }
Top {}
It also works if you uncomment the second line, and comment three and four.
From the annotated spec:
2.5.3 Relative URLs
Relative URLs are handled as described in [RURL]. The base document for
EXTERNPROTO statements or Anchor, AudioClip, ImageTexture, Inline,
MovieTexture, and Script node statements is:
The file in which the prototype is instantiated, if the statement is
part of a prototype definition.
The file containing the script code, if the statement is part of a
string passed to the createVrmlFromURL() or createVrmlFromString()
browser calls in a Script node.
Otherwise, the file from which the statement is read, in which case the
RURL information provides the data itself.
Take care,
Muaddib
--
-------------------------------------------------------
VRSpace - An open source, 3D, modular, cross-platform,
multi-user system with persistent shared objects.
Check out a demo at http://www.vrspace.org/demo.htm
-------------------------------------------------------
| |
| muaddib 2004-01-06, 5:30 pm |
| PrisNo6,
quote:
> Your example, I believe, was:
>
> <root>
> -> lib
> -> data
Not exactly, it was
<root> ( top )
-> lib ( middle and bottom )
Either way, though, I tried everything out (yours and mine) in Cosmo,
Cortona, Blaxxun 5.1, and 6.1. I differ from you though in that I only
found Cosmo to not work for yours and mine.
Thanks for your question. I hadn't realized this was an issue.
I am not sure how to interpret the spec here:
-----
The base document for EXTERNPROTO statements or Anchor, AudioClip,
ImageTexture, Inline, MovieTexture, and Script node statements is:
The file in which the prototype is instantiated, if the statement is
part of a prototype definition.
-----
Which file?
Cosmo seems to think - The file that made the first prototype
instantiation will be the base file for all further instantiations that
result.
The others - The base document is the one that literally contains the
EXTERNPROTO statement.
I read this as Cosmo being wrong. I am not really worried about Cosmo,
though, as I don't develop for it. I am more worried about Xj3D which
will surely be "spec compliant".
Muaddib
--
-------------------------------------------------------
VRSpace - An open source, 3D, modular, cross-platform,
multi-user system with persistent shared objects.
Check out a demo at http://www.vrspace.org/demo.htm
-------------------------------------------------------
| |
| Herbert Stocker 2004-01-07, 5:31 pm |
|
Joerg Scheurich aka MUFTI wrote:quote:
>
>
> http://www.web3d.org/technicalinfo/...epts.html#4.5.3
>
> | 4.5.3 Relative URLs
>
> | The base document for
> | EXTERNPROTO statements or nodes that contain URL fields is:
>
> | a.The VRML file in which the prototype is instantiated, if the statement
> | is part of a
> | prototype definition.
>
> For "instantiated", i get a "out of translation books" error 8-(
>
> Do someone have a (non mathematical) definition of this word ?
>
Let me try:
If you say
PROTO Something
[
field SFVec3f position 0 0 10
]
{
...
}
Then this is a definition. Or is it a declaration? i think a definition.
If you say
Something
{
position 1 2 3
}
This is an instantiation.
If you later say
Something
{
position 0 8 15
}
This is another instantiation.
Now you have two instances of the proto "Something".
Herbert
--
Herbert Stocker (aka hersto)
http://www.hersto.de
www.bitmanagement.de
| |
| Herbert Stocker 2004-01-07, 5:31 pm |
|
Joerg Scheurich aka MUFTI wrote:quote:
>
>
>
>
> url fields in VRML are always of type MFString, you so you can give
> 2 urls and the browser will try out them in order.
The (maybe little) drawback is that some Players will print an
error message if they don't find the file through the first URL.
quote:
> The following works, despite
>
> http://www.csv.ica.uni-stuttgart.de...ot_existing.jpg
>
> do not exist.
>
>
>
> #VRML V2.0 utf8
>
> Transform
> {
> children
> [
> Shape
> {
> appearance Appearance
> {
> material Material
> {
> }
> texture ImageTexture
> {
> url
> [
> "http://www.csv.ica.uni-stuttgart.de/vrml/not_existing.jpg"
> "http://www.csv.ica.uni-stuttgart.de/vrml/dune/_gfx/head_pic.jpg"
> ]
> repeatS FALSE
> }
> textureTransform TextureTransform
> {
> scale 0.359999 1
> }
> }
> geometry Box
> {
> }
> }
> ]
> }
>
>
--
Herbert Stocker (aka hersto)
http://www.hersto.de
www.bitmanagement.de
| |
| muaddib 2004-01-10, 12:29 pm |
| An update. Whereas I have found that EXTERNPROTO statements working
"correctly" in Cortona and Contact, I have found that url tags in, for
example, ImageTexture do not.
Contact 5.1 and 6.1: They are processed relative to the top level file
and not with respect to the file containing the PROTO in which they are
used.
Cortona: They are processed relative to the file containing the PROTO in
which they are used.
The problem is that putting all files in one directory is not a solution
if you desire any code reuse. If you are making a library for example,
then you are essentially going to have to put every file in the library
into every directory of every file that uses them. :(
Example Library
companyName/libraryName/
A partial solution:
For every url tag in your files, use absolute addressing:
url "/companyName/libraryName/"
What does this solve? If someone is planning on distributing files
using a library through a web server, then they would place the library
in that location under the web server root.
But this doesn't work for offline viewing of a file that uses the
library. For that situation, and Contact, use relative addressing of
the form: "companyName/libraryName" and expect the user to be executing
the file in a directory above companyName. For Cortona, use the typical
relative addressing. Terrible, I know, anyone have a better solutions?
If you can spare the bandwith, you may wish to have references to
your own site as well. A solution url:
url [ "/companyName/libraryName/...",# online
"companyName/libraryName/...", # offline contact
"...", # offline cortona
"http://www.companyName.com/companyName/libraryName/..." ]
Muaddib
--
-------------------------------------------------------
VRSpace - An open source, 3D, modular, cross-platform,
multi-user system with persistent shared objects.
Check out a demo at http://www.vrspace.org/demo.htm
-------------------------------------------------------
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|