Time for action – no frills, just color
First we create an illuminated sphere with a blue material, using a normal geometry with a material based on the Lighting.j3md
material definition:
- Make a copy of
Main.java
and name the classMaterialColor.java
. Remember to also refactor the first line of themain()
method toMaterialColor app = new MaterialColor ();
. - Replace the blue cube code in the
simpleInitApp()
method with the following:Sphere sphereMesh = new Sphere(32,32, 1f); Geometry sphereGeo = new Geometry("Colored lit sphere", sphereMesh); Material sphereMat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); sphereMat.setBoolean("UseMaterialColors", true); sphereMat.setColor("Diffuse", ColorRGBA.Blue ); sphereMat.setColor("Ambient", ...
Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.