Game Development Reference
In-Depth Information
age. Sometimes, the edges between the image components of these two (or more) im-
age layers will need to be smoothed . Smoothing (antialiasing) is required so that a fi-
nal composite looks like it is one seamless image, which is the intention of the artist or
game designer. Interestingly, you are already implementing the JavaFX “layer engine”
in your InvinciBagel application, using the StackPane class ( panes are layers ). The
“layer stack” image-compositing approach is common in games as well as in software,
such as Photoshop and GIMP.
The SceneAntialiasing class offers antialiasing processing (algorithm) to 3D
scenes so that they can be composited over your 2D scene background, whether that is
the default, Color.WHITE , or any other color value; a 2D image (creating a hybrid
2D-3D application); or anything else, for that matter. The SceneAntialiasing class al-
lows you to set the static SceneAntialiasing data field to a value of DISABLED (turn
antialiasing off) or BALANCED (turn antialiasing on). The balanced option gives a
balance of quality and performance, which simply means that the more processing
power the device's hardware brings to the table, the more antialiasing quality will be
processed.
Next, let's explore the SnapshotParameters class (object), which is used to set up
(contain) a rendering attribute parameter that will be used by the SnapshotResult class
(object). The parameters include the type of Camera (parallel or perspective) object to
be used; whether the depthBuffer (used for 3D) is on (true for 3D) or off (false for
2D); a Paint object, used to contain the image data; a Transform object, used to con-
tain any transform data; and a Rectangle2D object, used to define the viewport area to
be rendered (i.e., the snapshot dimensions).
You will be looking at all these javafx.scene subpackage classes and concepts in
this chapter as well as using many of them over the course of this topic. Much of the
functionality that you will be tapping into for your Java 8 game development will be
found in these JavaFX 8.0 subpackages.
The SnapshotResult class (and, more important, the object created using this class)
contains your resulting snapshot image data, the parameters that generated it, and the
source node in the scene graph that it was generated from. For this reason, the three
methods supported by the class should be obvious: the .getImage() method will get a
snapshot image, the .getSource() method gets the source node information, and the
.getSnapshotParameters() method will get the SnapshotParameters object contents.
Search WWH ::




Custom Search