package a3test.a3gen;

import java.awt.Frame;
import java.awt.event.*;
import jp.sourceforge.acerola3d.a3.*;

public class A3Gen3 {
    static Frame frame;
    public static void main(String args[]) throws Exception {
        frame = new Frame("A3Gen3");
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent we) {
                frame.dispose();
                System.exit(0);
            }
        });
        A3Canvas canvas = A3Canvas.createA3Canvas(300,300);
        canvas.setCameraLocImmediately(0.0,0.0,5.0);
        frame.add(canvas);
        frame.pack();
        frame.setVisible(true);

        //A3Object a3 = new Action3D(d);
        A3InitData d = new A3InitData("jp.sourceforge.acerola3d.a3.VRML");
        d.setLoc(0.0,0.0,0.0);
        d.setRot(0.0,0.0,0.0);
        d.set("x-res:///adviser.wrl");
        A3Object a3 = A3Generator.generate(d);
        canvas.add(a3);
        A3UpdateData dd = new A3UpdateData();
        double theta = 0.0;
        while (true) {
            try{Thread.sleep(100);}catch(Exception e){;}
            dd.setLoc(Math.cos(theta),Math.sin(theta),Math.sin(theta));
            a3.update(dd);
            theta = theta + 0.1;
        }
    }
}
