Package worlds3d

Source Code of worlds3d.Application3D

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package worlds3d;

import xenon3d.Canvas3D;
import xenon3d.View3D;
import xenon3d.Xenon3D;

/**
* Basic application class for 3D rendering.
*/
public class Application3D {
   
    // <editor-fold defaultstate="collapsed" desc=" Private Fields ">
   
    /** The Xenon3D master window. */
    private Xenon3D xenon;
   
    /** The Canvas3D to render the scene into. */
    private Canvas3D canvas;

    /** The View3D which defines the view to the scene. */
    private View3D view;

    // </editor-fold>
   
    // <editor-fold defaultstate="collapsed" desc=" Initialization ">
   
    /**
     * Creates a new Application3D.
     */
    public Application3D() {
        xenon = new Xenon3D();
        view = new View3D();
        view.setViewModePolicy(View3D.ViewModePolicy.Trace);
        canvas = createCanvas3D();
        canvas.attachView(view);
        xenon.attachCanvas(canvas);
    }
   
    // </editor-fold>
   
    // <editor-fold defaultstate="collapsed" desc=" Local Canvas3D class ">
   
    /**
     * Returns a new customized Canvas3D object.
     * @return the new Canvas3D
     */
    private Canvas3D createCanvas3D() {
        return new Canvas3D() {
           
            @Override
            public void init() {
                System.out.println("Canvas3D.init()");
            }
           
            @Override
            public void reshape(int width, int height) {
                System.out.println("Canvas3D.reshape(" + width + ", " + height + ")");
            }
           
            @Override
            public void preRender() {
                System.out.println("Canvas3D.preRender()");
            }
           
            @Override
            public void render() {
                System.out.println("Canvas3D.render()");
            }
           
            @Override
            public void postRender() {
                System.out.println("Canvas3D.postRender()");
            }
           
            @Override
            public void dispose() {
                System.out.println("Canvas3D.dispose()");
            }
        };
 
    }
   
    // </editor-fold>

} // end class Application3D
TOP

Related Classes of worlds3d.Application3D

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.