Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 15 ■ 3D Gameplay UI CreatIon: UsInG the sphere prImItIve to Create a UI noDe

We will create these diffuse texture map digital image assets in the next section of the chapter using
GIMP. Open the createMaterials() method body and add the corresponding Shader21 through Shader25
object instantiation and configuration statements, which “wire up the Shaders” to reference the diffuse
texture map Image object assets.
If you like, you can also use copy and paste to accomplish this just like you did with the diffuse texture
map Image objects. The Java code creating the new shaders and referencing them to the diffuse texture
map Image object assets should look like the following Java code block of statements, shown highlighted in
Figure 15-3:


Shader21 = new PhongMaterial(Color.WHITE);
Shader21.setDiffuseMap(diffuse21);
Shader22 = new PhongMaterial(Color.WHITE);
Shader22.setDiffuseMap(diffuse22);
Shader23 = new PhongMaterial(Color.WHITE);
Shader23.setDiffuseMap(diffuse23);
Shader24 = new PhongMaterial(Color.WHITE);
Shader24.setDiffuseMap(diffuse24);
Shader25 = new PhongMaterial(Color.WHITE);
Shader25.setDiffuseMap(diffuse25);


Figure 15-2. Create five new diffuse image map objects in your loadImageAssets() method and configure
them for use

Free download pdf