Wire frame Shapes in jme3 - Java Game

Java examples for Game:JME3

Description

Wire frame Shapes in jme3

Demo Code

package other;//from   w  ww . j  av  a2s .  c  om

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;
import com.jme3.scene.shape.Sphere;

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

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

    @Override
    public void simpleInitApp() {
        //Box mesh = new Box(1, 1, 1);
        Sphere mesh = new Sphere(16, 16, 1.0f);
        Geometry geom = new Geometry("Shape", mesh);

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

        rootNode.attachChild(geom);
    }

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

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

Related Tutorials