Skip to content

Instantly share code, notes, and snippets.

@Justin42
Created January 20, 2012 11:16
Show Gist options
  • Save Justin42/1646746 to your computer and use it in GitHub Desktop.
Save Justin42/1646746 to your computer and use it in GitHub Desktop.
Cube
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package client.state;
import com.jme3.app.Application;
import com.jme3.app.state.AppStateManager;
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;
/**
*
* @author Owner
*/
public class CubeState extends GameState {
private Geometry geom;
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
geom = new Geometry("Box", b);
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
rootNode.attachChild(geom);
this.app.setDisplayFps(true);
}
@Override
public void update(float tpf) {
geom.rotate(tpf, tpf, tpf);
}
@Override
public void render(RenderManager rm) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment