This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > January 2004 > Cross-viewer compatability work-around - relative path naming for EXTERNPROTO





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 Cross-viewer compatability work-around - relative path naming for EXTERNPROTO
PrisNo6

2004-01-02, 9:29 pm

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
Holger Grahn

2004-01-03, 5:28 pm


Hi PrisNo

may be you check the VRML spec,
I think Cortona is wrong
and Contact & Cosmo is right.

url's in PROTO's should be resolved to the place where they
are instanced and not where they are defined I think.

Other wise something like

PROTO MyInline { url ...
]
{
Inline { url IS url }
}

would not work as expected.

Greetings

Holger



"PrisNo6" <fisherka@csolutions.net> schrieb im Newsbeitrag
news:9865fa0b.0401021653.4a26695@posting.google.com...
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




PrisNo6

2004-01-03, 9:29 pm

Herbert Stocker <hst-uzd-nospam@hersto.de> wrote in message news:<3FF6803C.5080901@hersto.de>...
quote:

> One solution, but not the most elegant one would be to put all
> files into the same directory. > Herbert



Thanks, that is the solution I am implementing now. - Kurt
PrisNo6

2004-01-03, 10:29 pm

"Holger Grahn" <spam@x79.net> wrote in message news:<bt38vh$gm7$1@news.eusc.inter.net>...[QUOTE]
> may be you check the VRML spec, I think Cortona is wrong and
> Contact & Cosmo is right. url's in PROTO's should be resolved
: to the place where they are instanced and not where they are defined
> I think.
[/QUOTEY

Thank you Holger.

I jelieve the specification is at the place where the PROTOs are
instanced, but I prefer Cortona's path resolution behavior. It is more
consistent with object oriented programming. If object_A invokes
object_B and object_B invokes object_C, object_A should not care where
object_C is.

Because of this incompatability between the major VRML viewers, I
decided to put everything in one path, so both CosmoPlayer and Cortona
could find all objects. The downside of supporting both brkwsers is
that it makes for a cluttered root directory.

- Regards Kurt
PrisNo6

2004-01-06, 12:29 am

muaddib <robmeyers@hotmail.com> wrote in message news:<3FF991E9.2060000@hotmail.com>...

Thank you. I am presently working with CosmoPlayer and Cortona and
will try this against Cosmo.
quote:

> 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.
> 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


PrisNo6

2004-01-06, 3:30 pm

muaddib <robmeyers@hotmail.com> wrote in message news:<3FF991E9.2060000@hotmail.com>...
quote:

> PrisNo6,
> I use relative referencing often and have no problems, perhaps you
> are doing something different. <snip>



Yes, I am doing something different from your description.

Your example, I believe, was:

<root>
-> lib
-> data

The difficulty I was having concerned a typical application hierarchy
like: :

<root>
-> lib
-> data
-> <other>

An example illustrating this is:

top.wrl (EXTERNPROTO "mid1/mid1.wrl#Bottom0")
-> mid1/mid1.wrl (EXTERNPROTO "EXTERNPROTO Bottom1 [ ]
"../mid2/mid2.wrl#Bottom")
-> mid2/mid2.wrl ( PROTO Bottom { Shape } )

In Cortona, the following statement works:

"EXTERNPROTO Bottom1 [ ] "../mid2/mid2.wrl#Bottom"

In Cosmo, the above syntax does not work. The following syntax works
in Cosmo but not Cortona:

"EXTERNPROTO Bottom1 [ ] "mid2/mid2.wrl#Bottom"

A test directory with example files can be downloaded from:

http://members.csolutions.net/fishe...rlds/RPTest.zip

or tested from:

http://members.csolutions.net/fishe...Cortona/top.wrl

http://members.csolutions.net/fishe...RPCosmo/top.wrl

The example wrl files contain:

=====================
File <root>top.wrl
=====================
#VRML V2.0 utf8

EXTERNPROTO Middle0 [] "mid1/mid1.wrl#Bottom0"
Middle0 { }

=====================
File mid1/mid1.wrl
=====================
#VRML V2.0 utf8

# Cortona compatiable
EXTERNPROTO Bottom1 [ ] "../mid2/mid2.wrl#Bottom"
# Cosmo compatiable
# EXTERNPROTO Bottom1 [ ] "mid2/mid2.wrl#Bottom"

PROTO Bottom0 [ ] { Bottom1 { } }

=====================
File mid2/mid2.wrl
=====================
#VRML V2.0 utf8

PROTO Bottom [ ] { Shape { geometry Box {} } }
Bottom { }

Regards, Kurt
PrisNo6

2004-01-07, 4:33 pm

muaddib <robmeyers@hotmail.com> wrote in message news:<3FFB2256.4030301@hotmail.com>...
quote:

> 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



Hopefully this will be resolved in the evolution of Xj3D and X3D. - Kurt
Joerg Scheurich aka MUFTI

2004-01-07, 4:33 pm

> url's in PROTO's should be resolved to the place where they
quote:

> are instanced and not where they are defined I think.



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 ?

so long
MUFTI
--
Aushilfsappart Anschluss
(Meldung Maxtron Maustreiber, Stichwort: auxillary)
Joerg Scheurich aka MUFTI

2004-01-07, 4:33 pm

> If you have run into this before, please let me know your work around.
quote:

> I came up with a temporary and inelegant solution to keep all three
> VRML viewers happy, but there has to be a better way.



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 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
{
}
}
]
}


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews