jme3 Geometry - Java Game

Java examples for Game:JME3

Description

jme3 Geometry

Demo Code

package gui;/*from w  w  w. ja v a 2 s . c o m*/

import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;

/**
 * test
 *
 * @author normenhansen
 */
public class a3d2dModel extends SimpleApplication {

    public static void main(String[] args) {
        a3d2dModel app = new a3d2dModel();
        app.start();
    }

    @Override
    public void simpleInitApp() {
        Box b = new Box(1, 1, 1);
        Geometry geom = new Geometry("Box", b);

        Material mat = new Material(assetManager,
                "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Blue);
        geom.setMaterial(mat);

        rootNode.attachChild(geom);
        geom.setLocalTranslation(settings.getWidth() / 2,
                settings.getHeight() / 2, 0); // center the box
        geom.scale(10f); // scale the box
        guiNode.attachChild(geom);
    }

    @Override
    public void simpleUpdate(float tpf) {
        //TODO: add update code
    }

    @Override
    public void simpleRender(RenderManager rm) {
        //TODO: add render code
    }
}

Related Tutorials