In the previous chapters, you used a plain, unshaded material to create a simple blue cube. Look at the blue cube's code again. The cube's material is based on the Unshaded.j3md
material definition, and it has a Color
property that is set to ColorRGBA.Blue
.
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Blue);
Let's see what else this material can do:
Make a copy of
Main.java
and name the classMaterialsUnshaded.java
. Remember to also refactor the first line of themain()
method toMaterialsUnshaded app = new MaterialsUnshaded();
.Copy the provided image
assets/Interface/Monkey.png
into your project'sassets/Interface/
directory.Replace the blue cube code in
simpleInitApp()
with the following code:Sphere sphereMesh = new Sphere(16, 16, 1); Geometry sphereGeo = new Geometry("Unshaded textured sphere",sphereMesh); sphereGeo.move(-2f, 0f, 0f); sphereGeo.rotate(FastMath.DEG_TO_RAD * -90, FastMath...