import com.sun.j3d.utils.applet.MainFrame;
import javax.swing.*;
import java.awt.*;
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.*;
import java.applet.Applet;
public class cubo3 extends Applet
{
public BranchGroup createSceneGraph()
{
BranchGroup objro=new BranchGroup();
TransformGroup objs=new TransformGroup();
objs.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objro.addChild(objs);
objs.addChild(new ColorCube(0.5));
Alpha rotar=new Alpha(-1,9000);//girar constante el -1 retraso 3000
RotationInterpolator rotar2=new RotationInterpolator(rotar,objs);
BoundingSphere bonos=new BoundingSphere();
rotar2.setSchedulingBounds(bonos);
objs.addChild(rotar2);
return objro;
}//fin del metodo
public cubo3()
{
setLayout(new BorderLayout());
GraphicsConfiguration config=SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas=new Canvas3D(config);
add("Center",canvas);
BranchGroup escena=createSceneGraph();
SimpleUniverse su=new SimpleUniverse(canvas);
su.getViewingPlatform().setNominalViewingTransform();
su.addBranchGraph(escena);
}//fin del constructor
public static void main(String args[])
{
Frame frame=new MainFrame(new cubo3(),700,700);
}
}
sábado, 26 de marzo de 2011
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario