1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
public class Fenetre3D extends javax.swing.JPanel {
private SimpleUniverse simpleU;
private BranchGroup bg = new BranchGroup();
private Locale maLocale;
public Fenetre3D(int sizeX, int sizeY, Application fenetre) {
Canvas3D canvas = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
canvas.setSize(this.fen3DsizeX,this.fen3DsizeY);
this.simpleU = new SimpleUniverse(canvas);
this.simpleU.getViewingPlatform().setNominalViewingTransform();
this.add("Center",canvas);
this.bg.setCapability(bg.ALLOW_DETACH);
this.bg.compile();
this.simpleU.addBranchGraph(this.bg);
this.maLocale = this.simpleU.getLocale();
}
public void actualise(BranchGroup scene) {
try {
scene.setCapability(scene.ALLOW_DETACH);
scene.compile();
maLocale.replaceBranchGraph(this.bg,scene);
this.bg = scene;
} catch(CapabilityNotSetException e) {
System.out.println("probleme de Capacite");
} catch(RestrictedAccessException e) {
System.out.println("probleme d'Acces");
} catch(Exception e) {
System.out.println("probleme autre");
}
} |
Partager