I load a VRML file and then access the geometry without using the node DEFS
with the following
VrmlLoader loader = new VrmlLoader();
Scene s = null;
try {
s = loader.load(reader);
}
catch (FileNotFoundException e) {
System.err.println(e);
System.exit(1);
}
catch (ParsingErrorException e) {
System.err.println(e);
System.exit(1);
}
catch (IncorrectFormatException e) {
System.err.println(e);
System.exit(1);
}
BranchGroup bg = new BranchGroup();
bg.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
bg = s.getSceneGroup();
Enumeration enum1 = bg.getAllChildren();
iterateLoop(enum1);
public void iterateLoop(Enumeration enum){
while (enum.hasMoreElements())
{
Object tmpObject = enum.nextElement();
if (tmpObject instanceof Shape3D)
{
createShape(tmpObject);
}
else if (tmpObject instanceof TransformGroup)
{
//System.out.println("What a transformgroup");
TransformGroup tmptransformGroup =
(TransformGroup) tmpObject;
Enumeration nextenum =
tmptransformGroup.getAllChildren();
iterateLoop(nextenum);
}
else if(tmpObject instanceof Group){
//System.out.println("What a group");
Group tmpGroup = (Group)
tmpObject;
Enumeration groupenum =
tmpGroup.getAllChildren();
iterateLoop(groupenum);
}
else{System.out.println("What is this thing?");
}
}
}
At 01:17 PM 6/14/00 +0200, you wrote:
>I want to load a VRML model, change the color of the VRML world (it
>is one single object that must change color as a whole) and
>transform it to the origo of my java 3d world.
>
>I can see that I can get the transformgroup of a DEF named VRML
>world in the java 3D faq (I dont have any DEF named shapes in
>my VRML files).
>
>Can anybody provide me with an example or some advice.
>
>Ole Vilmann
>Danish Maritime Institute
>
>===========================================================================
>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".
Jack S. Gundrum
Visualization Group
Center for Academic Computing
Penn State University
Email:[EMAIL PROTECTED]
Phone:(814)865-1863
===========================================================================
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".