Java Reference
In-Depth Information
Specifying the Material of 3D Shapes
Now that we have covered the 3D shapes, both predefined and user-defined, the cameras, and the lights, in this
section, we deal with the last remaining topic in the JavaFX 3D graphics API. The material API consists of the Material
abstract class and its concrete subclass PhongMaterial . The Material class is an abstract base class without any
public methods. In all practical situations, it is the PhongMaterial class that is used. The material class describes the
physical properties of a 3D surface and how they interact with lights.
Understanding the PhongMaterial Class
The PhongMaterial class has the following constructors:
PhongMaterial()
PhongMaterial(Color diffuseColor)
PhongMaterial(Color diffuseColor, Image diffuseMap, Image specularMap, Image
bumpMap, Image selfIlluminationMap)
The default constructor creates a PhongMaterial with the default diffuseColor of Color.WHITE . The one-parameter
constructor creates a PhongMaterial with the specified diffuseColor . The third constructor creates a PhongMaterial
with the specified diffuseColor , diffuseMap , specularMap , bumpMap , and selfIlluminationMap . We discuss what these
parameters mean after we cover the properties of the PhongMaterial class.
The PhongMaterial class has the following public methods:
void setDiffuseColor(Color)
Color getDiffuseColor()
ObjectProperty<Color> diffuseColorProperty()
void setSpecularColor(Color)
Color getSpecularColor()
ObjectProperty<Color> specularColorProperty()
void setSpecularPower(double)
double getSpecularPower()
DoubleProperty specularPowerProperty()
void setDiffuseMap(Image)
Image getDiffuseMap()
ObjectProperty<Image> diffuseMapProperty()
void setSpecularMap(Image)
Image getSpecularMap()
ObjectProperty<Image> specularMapProperty()
void setBumpMap(Image)
Image getBumpMap()
ObjectProperty<Image> bumpMapProperty()
 
Search WWH ::




Custom Search