Hi Dominik,
I 'm also using 3DS loader from starfire.

I think the code below will help you, It captures all transformGroups and
shape3D's.
And then you should get the app. from shape3D.

Best Regards.

Ergun Guvenc.
Basari Telekom.
Turkey.

Code :


          System.out.println("decompose3DModels -BEGIN");
          BranchGroup bgDecom=null;

          TransformGroup bTg=null;
          BranchGroup xx = null;
          //Hashtable sceneObjTable=null;
          Shape3D sh3d = null;
          //Shape3D sh3dAll = new Shape3D();

          int counter=0;

          bgDecom = theScene.getSceneGroup();

          try{

          shared3D.sceneObjTable = theScene.getNamedObjects();
          Enumeration enx0 = shared3D.sceneObjTable.keys();

          while(enx0.hasMoreElements())
          {
          String objName = (String)enx0.nextElement();
          Node node = (Node)shared3D.sceneObjTable.get(objName);

          if(node instanceof TransformGroup)
          {
             bTg = (TransformGroup)node;
             bTg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
             bTg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
             bTg.setCapability(TransformGroup.ENABLE_PICK_REPORTING);
             System.out.println("==============Tg ok!...");

             shared3D.deCompTr.put(objectName,bTg);

          }

           Enumeration en = bTg.getAllChildren();

           //System.out.println(en.toString());
               while(en.hasMoreElements())
               {

                    node = (Node)en.nextElement();
                    if(node instanceof Shape3D)
                    {

                        System.out.println("Shape3D extracted -
decomp3DModels");
//                        System.out.println("Shape3DName :" + objName +
node.toString());
                        sh3d = (Shape3D)node;
//                        System.out.println(sh3d.toString());
                        Material m = null; // new Material();
                        Appearance app=null;

                        app = sh3d.getAppearance();
                        m = app.getMaterial();
                        m.setLightingEnable(true);
                     //   m.setEmissiveColor(Black);
                     //   m.setAmbientColor(White);
                        //m.setDiffuseColor(Blue);
                     //   m.setSpecularColor(White);
                     //   m.setShininess(100);
                        //TextureAttributes ta = app.getTextureAttributes();
                        //  System.out.println("Texture Mode :" +
Integer.toString(ta.getTextureMode()));
                        //ta.setTextureMode(5);  // .BLEND); //Texture
dolayisiyla Mat. ozellikleri calismiyor.
                        //  System.out.println("Texture Mode 2 :" +
Integer.toString(ta.getTextureMode()));
                        //app.setTextureAttributes(ta);
                        app.setMaterial(m);
                        sh3d.setAppearance(app);
                        shared3D.deCompSh.put(objectName,sh3d); //put
obj.into the database.

                    }// instance of

                    if(node instanceof TransformGroup)
                    {

                        System.out.println("Tr extracted2!...");
                    }
                    if(node instanceof BranchGroup)
                    {

                        System.out.println("Br extracted2!...");
                    }
               }

            } // end of outer while enx0
          }catch(Exception x){
                  System.out.println(" ShapeDecomp... " + x.toString());
                  System.out.println(Integer.toString(counter));
          }

          System.out.println("decompose3DModels -END");


          return bgDecom;



*********************************************************************






-----Original Message-----
From: Dominik Helleberg
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 1:06 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Get Shape3D from Loader


Hi All!

I got a simple question, and tell me if i'm stupid, but i can't find a
solution right now...

So, I'm using a 3ds-loader, that returns a Scene, that i converted to a
BranchGroup an added to my SceneGraph. So long, so good. Now I want to set
the Appearance of the loaded Objects but I've no idea how to do this.
How can i get the Shape3D Objects from the BranchGroup or the Scene, and
how can I set it's Appearance??

Thanks a lot for any help....

Dominik

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