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


Next, add your .setMaterial() method calls for your other three quadrant Box primitives and reference
your correct Shader22 through Shader24 PhongMaterial objects in the method call parameter list.
The wiring of the Shader objects to the Box primitives should look like the following Java code, shown
highlighted in yellow in Figure 15-10, once you are finished:


q1 = new Box(300, 5, 300);
q1.setMaterial(Shader21);
q1.setTranslateX(225);
q1.setTranslateZ(225);
q2 = new Box(300, 5, 300);
q2.setMaterial(Shader22);
q2.setTranslateX(225);
q2.setTranslateZ(525);
q3 = new Box(300, 5, 300);
q3.setMaterial(Shader23);
q3.setTranslateX(525);
q3.setTranslateZ(525);
q4 = new Box(300, 5, 300);
q4.setMaterial(Shader24);
q4.setTranslateX(525);
q4.setTranslateZ(225);


Figure 15-10. Complete the Shader object wiring to Box primitives for all quadrants so we can see the finished
gameboard

Free download pdf