Hello!

I Try to load a 3DS-object but the object will not be visible at all.

I'm not so good at 3D-studio so I downloaded a object from the Internet so a
have something to test with.

That object can be found at:
http://medlem.spray.se/fredand44/questions/girl.3DS
I also have an other one that I have developed my self at:
http://medlem.spray.se/fredand44/questions/test.3DS
But my own object doesn't seems to have any Shape3Ds?

I use the Import3DS
from:http://www.j3d.org/utilities/loaders/3ds/mulder.html
to load my objects. So if you would like to test this I think you have to
download it.

So if any one could give me a hint I would be most thankfull!

Best regards
Fredrik Andersson

My code to test this is:


import java.applet.*;
import java.awt.*;
import java.awt.Frame;
import java.awt.event.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.behaviors.keyboard.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import javax.swing.*;
import com.sun.j3d.loaders.*;

import java.util.*;

import java3d.loaders.*;

public class TestLoad extends Applet
{
        BranchGroup branchGroup;


        public void init()
        {
                setLayout(new BorderLayout());
                GraphicsConfiguration config = 
SimpleUniverse.getPreferredConfiguration();
                Canvas3D canvas3D = new Canvas3D(config);
                add("Center", canvas3D);
                SimpleUniverse simpleUniverse = new SimpleUniverse(canvas3D);
                branchGroup = new BranchGroup();

                //Reference Cube
                ColorCube colorCube1 = new ColorCube(0.4);
                TransformGroup transformGroup1 = new TransformGroup();
                Transform3D transform3D1 = new Transform3D();
                transform3D1.set(new Vector3f(-2.0f, 0.0f, -20.0f));
                transformGroup1.setTransform(transform3D1);
                transformGroup1.addChild(colorCube1);
                branchGroup.addChild(transformGroup1);

                //TransformGroup for the loaded object
                TransformGroup transformGroup2 = loadTransformGroup();
                Transform3D transform3D2 = new Transform3D();
                transform3D2.set(new Vector3f(2.0f, 0.0f, -20.0f));
                transformGroup2.setTransform(transform3D2);
                branchGroup.addChild(transformGroup2);

                branchGroup.compile();
                simpleUniverse.addBranchGraph(branchGroup);
        }

        public TransformGroup loadTransformGroup()
        {
                TransformGroup transformGroup = null;
                try
                {
                        Loader loader = new ThreeDSLoader();
                        Scene scene = loader.load("girl.3ds");
                        BranchGroup branchGroup = scene.getSceneGroup();
                        transformGroup = new TransformGroup();

                        System.out.println();

                        Enumeration enumeration = branchGroup.getAllChildren();
                        int i =0;
                        while(enumeration.hasMoreElements())
                        {
                                i++;
                                Object obj = enumeration.nextElement();
                                Class cl = obj.getClass();
                                System.out.println(cl.getName());

                        }
                        System.out.println(i);
                        System.out.println();

                        transformGroup = (TransformGroup) branchGroup.getChild(1);
                        branchGroup.removeChild(1);

                        enumeration = transformGroup.getAllChildren();
                        i =0;
                        Appearance appearance = new Appearance();
                        ColoringAttributes coloringAttributes = new 
ColoringAttributes(new
Color3f(0.4f, 0.4f, 0.4f), ColoringAttributes.FASTEST);
                        appearance.setColoringAttributes(coloringAttributes);

                        while(enumeration.hasMoreElements())
                        {
                                i++;
                                Shape3D obj = (Shape3D)enumeration.nextElement();
                                Class cl = obj.getClass();
                                System.out.println(cl.getName());
                                obj.setAppearance(appearance);
                        }
                        System.out.println(i);
                }
                catch(Exception e)
                {
                        e.printStackTrace();
                }

                return transformGroup;
        }

        public static void main(String[] args)
        {
                Frame frame = new MainFrame(new TestLoad(), 600, 400);
    }
}

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