Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 11 ■ 3D SCene Configuration: uSing the perSpeCtiveCamera anD pointLight

Figure 11-18. Add the sphere to the gameBoard branch of the root Node so the primitive is added to your
scenegraph.


Use your Run ➤ Project work process, and make sure that all of these code upgrades and additions that
we have accomplished during this chapter are working properly and giving you the end result that should be
expected at this early stage of your pro Java 9 game development.
Make sure the three (middle) Game Rules, Disclaimers, and Game Credits buttons have been restored
to full working capacity (now have a white background fill again). In addition, the High Scores Button should
still print out a text message to the Output Console in NetBeans 9, and the Start Game should now remove
the StackPane uiLayout overlay panel and show the 3D Scene.
Inside of that 3D Scene should be a 3D Sphere object primitive, which we will be learning about during
the next chapter on 3D objects in your 3D Scene, called Models, Geometry, Mesh, and Primitives in the 3D
industry. Since the 3D primitive has no texture mapping or color value yet and since the PointLight object is
set to Color.WHITE, this should be a light gray sphere lit with white light.
As you can see in Figure 11-19, the Start Game Button Control now hides the entire 2D compositing
pipeline for the splash screen, UI design, Button controls, and TextFlow and Text elements and formatting
with one simple Java statement of uiLayout.setVisible(false); and because of the StackPane parent
Node and VBox, ImageView, and TextFlow child hierarchy that we have set up thus far in the book. Once
the pipeline is hidden from view, we see the 3D Scene, to which we’ve temporarily added a Sphere object
primitive in order to test the PerspectiveCamera and PointLight objects.

Free download pdf