Thank you Morten

My problem stemmed from unfamiliarity with the links resulting in not
accessing the sharedGroup deeply enough compounded with then accessing
Shape3Ds which responded to getGeometry by returning null (but which
getAllGeometries returned two components, a null and then something real!)

        Alex



-----Original Message-----
From:   Morten Gustavsen [mailto:[EMAIL PROTECTED]]
Sent:   05 July 2001 15:21
To:     [EMAIL PROTECTED]
Subject:        Re: RE: [JAVA3D] setting capabilities on data loaded by VRML loader


ok, corrections again....

The previous method I sent you had an UserData Object as parameter in the
parseGroup method call ( inside the parseGroup method ), that should not be
there.

This will be the correct way to traverse the BranchGraph..

 public static void parseGroup(Group group)
 {
         setNodeProperties( group );
         for (int i=0;i<group.numChildren();i++)
         {
             Node node=group.getChild(i);
             if(node instanceof javax.media.j3d.Group)
             {
                 parseGroup((Group)node);
             }
             else if(node instanceof javax.media.j3d.Link)
             {
                 parseGroup((Group)((Link)node).getSharedGroup());
             }
             setNodeProperties(node);
         }
  }

     public static void setNodeProperties(Node node)
     {

         if(node instanceof javax.media.j3d.Group)
         {
         }
         if(node instanceof javax.media.j3d.Shape3D)
         {
             /* set capabilities here !!!!!!!!!!!!!!!!!!!!!!!!!!!! */
          }
         if(node instanceof javax.media.j3d.Link)
         {
         }
     }


Hope I didn't confuse too much with that one...

-Morten Gustavsen

----- Original Message -----
From: "Morten Gustavsen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 05, 2001 4:12 PM
Subject: Re: RE: [JAVA3D] setting capabilities on data loaded by VRML loader


>
> Ok, I understand....
>
> I think there is something wrong with the traversal
> of your scenegraph. I don't think you are visiting all nodes
> in your loaded object. Because the scene obviously must
> have shape3D objects to display something in
> the scene.
>
> One thing that might be worth trying is this
> method.
>
> public static void parseGroup(Group group)
>     {
>         setNodeProperties( group );
>         for (int i=0;i<group.numChildren();i++)
>         {
>             Node node=group.getChild(i);
>             if(node instanceof javax.media.j3d.Group)
>             {
>                 parseGroup((Group)node,userData);
>             }
>             else if(node instanceof javax.media.j3d.Link)
>             {
>                 parseGroup((Group)((Link)node).getSharedGroup(),userData);
>             }
>             setNodeProperties(node);
>         }
>     }
>
>     public static void setNodeProperties(Node node)
>     {
>
>         if(node instanceof javax.media.j3d.Group)
>         {
>         }
>         if(node instanceof javax.media.j3d.Shape3D)
>         {
>             file://Set capabilities here !!!!!!!!!!!!!!!!!!!!!!!!!!!!
>          }
>         if(node instanceof javax.media.j3d.Link)
>         {
>         }
>     }
>
>
> This is a recursive method that will visit all nodes in the branchgraph
from
> the group you  give as an input parameter and down.
>
> Ok, hope this one helps
> -Morten Gustavsen
>
> >
> > Thank you but...
> >
> > My problem isn't knowing how to set the capabilities.  It's finding the
> > Shape3D on which to set the capabilities in the first place.
> >
> > The BranchGroup that I get back from the VRML loader for a single object
> > looks something like
> >
> > javax.media.j3d.BranchGroup@60abf2
> >  child javax.media.j3d.BranchGroup@74bcf7
> > child javax.media.j3d.Link@22220f
> >  link->sharedGroup
> > javax.media.j3d.SharedGroup@6a3960
> > child javax.media.j3d.Group@5ccedd
> > child org.web3d.vrml.j3d.input.TimeScheduler@111540
> > child org.web3d.vrml.j3d.input.RouteBehavior@a4488
> >
> >
> > So where do I actually find the nodes that are Shape3Ds??  However when
I
> do
> > a
> > branchGroup.pickxxx(PickRay)
> > I do get back an element that's a shape3D (but then it's too late to set
> its
> > capabilities.
> >
> > Alex
> >
> >
> > -----Original Message-----
> > From: Morten Gustavsen [mailto:[EMAIL PROTECTED]]
> > Sent: 05 July 2001 13:54
> > To: [EMAIL PROTECTED]
> > Subject: Re:      [JAVA3D] setting capabilities on data loaded by VRML
> > loader
> >
> > Hi again!
> >
> > ok, i don't think I sent you the correct if statement. The correct
> > code should of course be :
> >
> >    if( node instanceof javax.media.j3d.Shape3D )
> >   {
> >           node.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
> >    }
> >
> > where node is the current node in your loop
> >
> > -Morten Gustavsen
> >
> > > Having loaded a VRML model I can pick it with
> > > BranchGroup.pickxxx(PickRay)
> > > but cannot use either
> > >
> > >         shape3D.intersect(PickRay, PickRay, Double[ ]);
> > >
> > > as ALLOW_INTERSECT isn't set.
> > >
> > > Similarly
> > >
> > >         PickResult result = pickCanvas.pickClosest();
> > > PickIntersection pickIntersection =
> > > result.getClosestIntersection((Point3d)eyePosition);
> > >
> > > Fails with ALLOW_GEOMETRY_READ not set.
> > >
> > >
> > > However the BranchGroup returned by the VRML loader is a pretty odd
> beast
> > > made of Links, Nodes, SharedGroups , ElasticBands and PaperClips and
it
> > > isn't obvious how to find the geometry in it all.
> > >
> > > So, a) can one tell the VRML loader in advance how to set the
> capabilities
> > > of what it loads or b) is there any methods or documentation on how to
> > walk
> > > the  result to find the Geometry??
> > >
> > > Any input much appreciated.
> > >
> > >         Thanks
> > >
> > >                 Alex Bowden
> > >
> > >
> >
>
===========================================================================
> > > 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".
> > >
> >
> >
> >
>

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

Reply via email to