Skip to main content

trying to load multiple .wrl (VRML) files at the same time

3 replies [Last post]
neil1988
Offline
Joined: 2010-09-13
Points: 0

Hi all,
I need to load four components of a coffee table into the virtual universe, the four components are top, base, left leg and right leg. In this way when I change the size of this furniture, I can make the thickness of the edges fixed, which is a must. The four parts form a coffee table correctly in the design software TopSolid, but when I load the four .wrl files seperately, they cannot compose a coffee table correctly. I guess the reason is the four components have been resized and translated automatically in the VRML loader. I have reviewed the source code of the VRML loader and some related source code but not be able to find where the auto resize code is.
I have used four Wavefront .obj files instead to do another technical demonstration, if I disable the ObjectFile.RESIZE flag, and just scale the four parts by myself using the same scale factor, I can get a perfect coffee table, with every part in correct location. But my supervisor insist on using VRML .wrl files in our project.
I hope someone can give me some kind instructions or advises on how to do it in VRML97 loader (https://j3d-vrml97.dev.java.net/).
Any help is highly appreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
interactivemesh
Offline
Joined: 2006-06-07
Points: 0

Hi,

the VRML97 loader doesn't change the coordinates of your objects. The geometry data will be loaded as they are. To countercheck this create an assembly wrl file for your table parts like this one:

CoffeeTable.wrl

 #VRML V2.0 utf8<br />
Inline {url [&quot;Top.wrl&quot;]}<br />
Inline {url [&quot;Base.wrl&quot;]}<br />
Inline {url [&quot;LegLeft.wrl&quot;]}<br />
Inline {url [&quot;LegRight.wrl&quot;]}<br />
<br />
and load 'CoffeeTable.wrl' into any VRML browser of your choice. The parts should be located as if loaded with the VRML97 loader.

Are the parts positioned correctly when you export the table into a single wrl file? Does this file include Transform nodes?

In case of obj export the coordinates might be transformed because an obj file doesn't provide any transformations.

August

neil1988
Offline
Joined: 2010-09-13
Points: 0

Another thing, I don't know how to mark your reply be helpful since the forum has been changed a lot.
;-(

neil1988
Offline
Joined: 2010-09-13
Points: 0

Hi August,
Thank you for your reply. That's really helpful.
Use one .wrl file to represent the coffee table, and then traverse the branchgroup to get 4 shape3d objects, put them in different transformgroup, problem solved.
;-)