Hello,
I'm trying to use the Starfire 3DS Loader but not with success.
I'm writing an applet that load a 3ds file from an URL. I'm using the new
2.0 version of the loader.
When I test the applet with AppletViewer it works, but when I use the
Browser (IE 5) it doesn't work. I get the message "Start: applet not
initialized".
I'm using Java Plug In 1.3.
Can anyone help me?
Thanks in advance,
Nuno Pereira
Here is my code:
package pt.vwater;
import java.applet.Applet;
import java.awt.*;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.AmbientLight;
import javax.media.j3d.DirectionalLight;
import javax.media.j3d.Light;
import javax.vecmath.Matrix4d;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.mnstarfire.loaders3d.Inspector3DS;
public class Viewer extends Applet {
private java.net.URL filename;
public Viewer() {}
public void init()
{
// Construct the applet canvas
setLayout(new BorderLayout());
GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();
Canvas3D c = new Canvas3D(config);
add("Center", c);
// Create a basic universe setup and the root of the scene
SimpleUniverse u = new SimpleUniverse(c);
u.getViewingPlatform().setNominalViewingTransform();
BranchGroup sceneRoot = new BranchGroup();
// the path to the file for an applet
try
{
java.net.URL path = getCodeBase();
filename = new java.net.URL(path.toString() + "./D1.3ds");
}
catch (java.net.MalformedURLException ex)
{
System.out.println(ex.getMessage());
System.exit(1);
}
Inspector3DS loader = new Inspector3DS(filename);
loader.setURLBase(getCodeBase().toString());
loader.parseIt();
TransformGroup max = loader.getModel();
sceneRoot.addChild(max);
AmbientLight amblight = new AmbientLight();
amblight.setColor(new Color3f(0.0f, 0.325f, 0.494f));
amblight.setInfluencingBounds(new BoundingSphere(new Point3d(0, 0, 0),
100.0));
sceneRoot.addChild(amblight);
DirectionalLight dirlight = new DirectionalLight();
dirlight.setCapability(Light.ALLOW_STATE_WRITE);
dirlight.setColor(new Color3f(0.0f, 0.325f, 0.494f));
dirlight.setInfluencingBounds(new BoundingSphere(new Point3d(0, 0, 0),
100.0));
sceneRoot.addChild(dirlight);
u.addBranchGraph(sceneRoot);
}
}
===========================================================================
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".