Samstag, 4. Juni 2011

Java 3D engine

Today I am adding another facette to this blog. If you need a bit variety of not always hearing about EJB3 and JSF... here you are.

Ever wondered how a 3D game could be programmed in Java? The link of the day is The jMonkey engine is really a great project. It´s open source! It´s full of features like physics engine and others. It´s fun AND it´s well documented with a tutorial page. So the first steps are really easy to learn. You will learn, what assets, meshes, models and nodes are. Some example code will come soon.

Here a first hello world example from their documentation:

package jme3test.helloworld;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
/** Sample 1 - how to get started with the most simple JME 3 application.
* Display a blue 3D cube and view from all sides by
* moving the mouse and pressing the WASD keys. */
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);

Stay tuned and write a comment, if you want to hear more (and especially want to SEE CODE) ;)

Have fun trying.

Keine Kommentare:

Kommentar veröffentlichen

Hier kann jeder (auch unregistrierte) Leser seine Meinung kundtun...