- java.lang.Object
-
- javafx.scene.paint.Material
-
- javafx.scene.paint.PhongMaterial
-
public class PhongMaterial extends Material
ThePhongMaterial
class provides definitions of properties that represent a Phong shaded material. It describes the interaction of light with the surface of theMesh
it is applied to. ThePhongMaterial
reflects light in terms of a diffuse and specular component together with an ambient and a self illumination term. The color of a point on a geometric surface is mathematical function of these four components.The color is computed by the following equation:
wherefor each ambient light source i { ambient += lightColor[i] } for each point light source i { diffuse += (L[i] . N) * lightColor[i] specular += ((R[i] . V) ^ (specularPower * intensity(specularMap))) * lightColor[i] } color = (ambient + diffuse) * diffuseColor * diffuseMap + specular * specularColor * specularMap + selfIlluminationMap
lightColor[i]
is the color of light source i,
L[i]
is the vector from the surface to light source i,
N
is the normal vector (taking into the account the bumpMap if present),
R[i]
is the normalized reflection vector for L[i] about the surface normal,
andV
is the normalized view vector.- Since:
- JavaFX 8.0
- See Also:
AmbientLight
,PointLight
-
-
Property Summary
Properties Type Property Description ObjectProperty<Image>
bumpMap
The bump map of thisPhongMaterial
, which is a normal map stored as a RGBImage
.ObjectProperty<Color>
diffuseColor
The diffuse color of thisPhongMaterial
.ObjectProperty<Image>
diffuseMap
The diffuse map of thisPhongMaterial
.ObjectProperty<Image>
selfIlluminationMap
The self illumination map of thisPhongMaterial
.ObjectProperty<Color>
specularColor
The specular color of thisPhongMaterial
.ObjectProperty<Image>
specularMap
The specular map of thisPhongMaterial
.DoubleProperty
specularPower
The specular power of thisPhongMaterial
.
-
Constructor Summary
Constructors Constructor Description PhongMaterial()
Creates a new instance ofPhongMaterial
class with a default Color.WHITEdiffuseColor
property.PhongMaterial(Color diffuseColor)
Creates a new instance ofPhongMaterial
class using the specified color for itsdiffuseColor
property.PhongMaterial(Color diffuseColor, Image diffuseMap, Image specularMap, Image bumpMap, Image selfIlluminationMap)
Creates a new instance ofPhongMaterial
class using the specified colors and images for itsdiffuseColor
properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectProperty<Image>
bumpMapProperty()
The bump map of thisPhongMaterial
, which is a normal map stored as a RGBImage
.ObjectProperty<Color>
diffuseColorProperty()
The diffuse color of thisPhongMaterial
.ObjectProperty<Image>
diffuseMapProperty()
The diffuse map of thisPhongMaterial
.Image
getBumpMap()
Gets the value of the property bumpMap.Color
getDiffuseColor()
Gets the value of the property diffuseColor.Image
getDiffuseMap()
Gets the value of the property diffuseMap.Image
getSelfIlluminationMap()
Gets the value of the property selfIlluminationMap.Color
getSpecularColor()
Gets the value of the property specularColor.Image
getSpecularMap()
Gets the value of the property specularMap.double
getSpecularPower()
Gets the value of the property specularPower.ObjectProperty<Image>
selfIlluminationMapProperty()
The self illumination map of thisPhongMaterial
.void
setBumpMap(Image value)
Sets the value of the property bumpMap.void
setDiffuseColor(Color value)
Sets the value of the property diffuseColor.void
setDiffuseMap(Image value)
Sets the value of the property diffuseMap.void
setSelfIlluminationMap(Image value)
Sets the value of the property selfIlluminationMap.void
setSpecularColor(Color value)
Sets the value of the property specularColor.void
setSpecularMap(Image value)
Sets the value of the property specularMap.void
setSpecularPower(double value)
Sets the value of the property specularPower.ObjectProperty<Color>
specularColorProperty()
The specular color of thisPhongMaterial
.ObjectProperty<Image>
specularMapProperty()
The specular map of thisPhongMaterial
.DoubleProperty
specularPowerProperty()
The specular power of thisPhongMaterial
.String
toString()
-
-
-
Property Detail
-
diffuseColor
public final ObjectProperty<Color> diffuseColorProperty
The diffuse color of thisPhongMaterial
.- Default value:
- Color.WHITE
- See Also:
getDiffuseColor()
,setDiffuseColor(Color)
-
specularColor
public final ObjectProperty<Color> specularColorProperty
The specular color of thisPhongMaterial
.- Default value:
- null
- See Also:
getSpecularColor()
,setSpecularColor(Color)
-
specularPower
public final DoubleProperty specularPowerProperty
The specular power of thisPhongMaterial
.- Default value:
- 32.0
- See Also:
getSpecularPower()
,setSpecularPower(double)
-
diffuseMap
public final ObjectProperty<Image> diffuseMapProperty
The diffuse map of thisPhongMaterial
.- Default value:
- null
- See Also:
getDiffuseMap()
,setDiffuseMap(Image)
-
specularMap
public final ObjectProperty<Image> specularMapProperty
The specular map of thisPhongMaterial
.- Default value:
- null
- See Also:
getSpecularMap()
,setSpecularMap(Image)
-
bumpMap
public final ObjectProperty<Image> bumpMapProperty
The bump map of thisPhongMaterial
, which is a normal map stored as a RGBImage
.- Default value:
- null
- See Also:
getBumpMap()
,setBumpMap(Image)
-
selfIlluminationMap
public final ObjectProperty<Image> selfIlluminationMapProperty
The self illumination map of thisPhongMaterial
.- Default value:
- null
- See Also:
getSelfIlluminationMap()
,setSelfIlluminationMap(Image)
-
-
Constructor Detail
-
PhongMaterial
public PhongMaterial()
Creates a new instance ofPhongMaterial
class with a default Color.WHITEdiffuseColor
property.
-
PhongMaterial
public PhongMaterial(Color diffuseColor)
Creates a new instance ofPhongMaterial
class using the specified color for itsdiffuseColor
property.- Parameters:
diffuseColor
- the color of the diffuseColor property
-
PhongMaterial
public PhongMaterial(Color diffuseColor, Image diffuseMap, Image specularMap, Image bumpMap, Image selfIlluminationMap)
Creates a new instance ofPhongMaterial
class using the specified colors and images for itsdiffuseColor
properties.- Parameters:
diffuseColor
- the color of the diffuseColor propertydiffuseMap
- the image of the diffuseMap propertyspecularMap
- the image of the specularMap propertybumpMap
- the image of the bumpMap propertyselfIlluminationMap
- the image of the selfIlluminationMap property
-
-
Method Detail
-
setDiffuseColor
public final void setDiffuseColor(Color value)
Sets the value of the property diffuseColor.- Property description:
- The diffuse color of this
PhongMaterial
. - Default value:
- Color.WHITE
-
getDiffuseColor
public final Color getDiffuseColor()
Gets the value of the property diffuseColor.- Property description:
- The diffuse color of this
PhongMaterial
. - Default value:
- Color.WHITE
-
diffuseColorProperty
public final ObjectProperty<Color> diffuseColorProperty()
The diffuse color of thisPhongMaterial
.- Default value:
- Color.WHITE
- See Also:
getDiffuseColor()
,setDiffuseColor(Color)
-
setSpecularColor
public final void setSpecularColor(Color value)
Sets the value of the property specularColor.- Property description:
- The specular color of this
PhongMaterial
. - Default value:
- null
-
getSpecularColor
public final Color getSpecularColor()
Gets the value of the property specularColor.- Property description:
- The specular color of this
PhongMaterial
. - Default value:
- null
-
specularColorProperty
public final ObjectProperty<Color> specularColorProperty()
The specular color of thisPhongMaterial
.- Default value:
- null
- See Also:
getSpecularColor()
,setSpecularColor(Color)
-
setSpecularPower
public final void setSpecularPower(double value)
Sets the value of the property specularPower.- Property description:
- The specular power of this
PhongMaterial
. - Default value:
- 32.0
-
getSpecularPower
public final double getSpecularPower()
Gets the value of the property specularPower.- Property description:
- The specular power of this
PhongMaterial
. - Default value:
- 32.0
-
specularPowerProperty
public final DoubleProperty specularPowerProperty()
The specular power of thisPhongMaterial
.- Default value:
- 32.0
- See Also:
getSpecularPower()
,setSpecularPower(double)
-
setDiffuseMap
public final void setDiffuseMap(Image value)
Sets the value of the property diffuseMap.- Property description:
- The diffuse map of this
PhongMaterial
. - Default value:
- null
-
getDiffuseMap
public final Image getDiffuseMap()
Gets the value of the property diffuseMap.- Property description:
- The diffuse map of this
PhongMaterial
. - Default value:
- null
-
diffuseMapProperty
public final ObjectProperty<Image> diffuseMapProperty()
The diffuse map of thisPhongMaterial
.- Default value:
- null
- See Also:
getDiffuseMap()
,setDiffuseMap(Image)
-
setSpecularMap
public final void setSpecularMap(Image value)
Sets the value of the property specularMap.- Property description:
- The specular map of this
PhongMaterial
. - Default value:
- null
-
getSpecularMap
public final Image getSpecularMap()
Gets the value of the property specularMap.- Property description:
- The specular map of this
PhongMaterial
. - Default value:
- null
-
specularMapProperty
public final ObjectProperty<Image> specularMapProperty()
The specular map of thisPhongMaterial
.- Default value:
- null
- See Also:
getSpecularMap()
,setSpecularMap(Image)
-
setBumpMap
public final void setBumpMap(Image value)
Sets the value of the property bumpMap.- Property description:
- The bump map of this
PhongMaterial
, which is a normal map stored as a RGBImage
. - Default value:
- null
-
getBumpMap
public final Image getBumpMap()
Gets the value of the property bumpMap.- Property description:
- The bump map of this
PhongMaterial
, which is a normal map stored as a RGBImage
. - Default value:
- null
-
bumpMapProperty
public final ObjectProperty<Image> bumpMapProperty()
The bump map of thisPhongMaterial
, which is a normal map stored as a RGBImage
.- Default value:
- null
- See Also:
getBumpMap()
,setBumpMap(Image)
-
setSelfIlluminationMap
public final void setSelfIlluminationMap(Image value)
Sets the value of the property selfIlluminationMap.- Property description:
- The self illumination map of this
PhongMaterial
. - Default value:
- null
-
getSelfIlluminationMap
public final Image getSelfIlluminationMap()
Gets the value of the property selfIlluminationMap.- Property description:
- The self illumination map of this
PhongMaterial
. - Default value:
- null
-
selfIlluminationMapProperty
public final ObjectProperty<Image> selfIlluminationMapProperty()
The self illumination map of thisPhongMaterial
.- Default value:
- null
- See Also:
getSelfIlluminationMap()
,setSelfIlluminationMap(Image)
-
-