Top Description Fields Constructors Methods
javafx.scene.paint

public Class PhongMaterial

extends Material
Class Inheritance
Imports
com.sun.javafx.beans.event.AbstractNotifyListener, com.sun.javafx.scene.paint.MaterialHelper, com.sun.javafx.sg.prism.NGPhongMaterial, com.sun.javafx.tk.Toolkit, javafx.beans.Observable, javafx.beans.property.DoubleProperty, .ObjectProperty, .SimpleDoubleProperty, .SimpleObjectProperty, javafx.scene.AmbientLight, .PointLight, javafx.scene.image.Image

The PhongMaterial class provides definitions of properties that represent a Phong shaded material. It describes the interaction of light with the surface of the Mesh it is applied to. The PhongMaterial 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:

for 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
where 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,
and V is the normalized view vector.
Since
JavaFX 8.0
See Also
AmbientLight, PointLight

Field Summary

Modifier and TypeField and Description
private ObjectProperty<Image>
bumpMap

The bump map of this PhongMaterial, which is a normal map stored as a RGB Image.

private boolean
private ObjectProperty<Color>
diffuseColor

The diffuse color of this PhongMaterial.

private boolean
private ObjectProperty<Image>
diffuseMap

The diffuse map of this PhongMaterial.

private boolean
private Image
private Image
private Image
private Image
private NGPhongMaterial
peer

The peer node created by the graphics Toolkit/Pipeline implementation

private final AbstractNotifyListener
private ObjectProperty<Image>
selfIlluminationMap

The self illumination map of this PhongMaterial.

private boolean
private ObjectProperty<Color>
specularColor

The specular color of this PhongMaterial.

private boolean
private ObjectProperty<Image>
specularMap

The specular map of this PhongMaterial.

private boolean
private DoubleProperty
specularPower

The specular power of this PhongMaterial.

private boolean

Constructor Summary

AccessConstructor and Description
public
PhongMaterial()

Creates a new instance of PhongMaterial class with a default Color.WHITE diffuseColor property.

public
PhongMaterial(Color
the color of the diffuseColor property
diffuseColor
)

Creates a new instance of PhongMaterial class using the specified color for its diffuseColor property.

public
PhongMaterial(Color
the color of the diffuseColor property
diffuseColor
,
Image
the image of the diffuseMap property
diffuseMap
,
Image
the image of the specularMap property
specularMap
,
Image
the image of the bumpMap property
bumpMap
,
Image
the image of the selfIlluminationMap property
selfIlluminationMap
)

Creates a new instance of PhongMaterial class using the specified colors and images for its diffuseColor properties.

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Image>
public final ObjectProperty<Color>
public final ObjectProperty<Image>
public final Image
public final Color
public final Image
pack-priv NGPhongMaterial
public final Image
public final Color
public final Image
public final double
public final ObjectProperty<Image>
public final void
public final void
public final void
pack-priv void
public final void
public final void
public final void
public final void
setSpecularPower(double value)

public final ObjectProperty<Color>
public final ObjectProperty<Image>
public final DoubleProperty
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv void
Inherited from javafx.scene.paint.Material:
dirtyPropertyisDirty

Field Detail

bumpMapback to summary
private ObjectProperty<Image> bumpMap

The bump map of this PhongMaterial, which is a normal map stored as a RGB Image.

Default Value
null
bumpMapDirtyback to summary
private boolean bumpMapDirty
diffuseColorback to summary
private ObjectProperty<Color> diffuseColor

The diffuse color of this PhongMaterial.

Default Value
Color.WHITE
diffuseColorDirtyback to summary
private boolean diffuseColorDirty
diffuseMapback to summary
private ObjectProperty<Image> diffuseMap

The diffuse map of this PhongMaterial.

Default Value
null
diffuseMapDirtyback to summary
private boolean diffuseMapDirty
oldBumpMapback to summary
private Image oldBumpMap
oldDiffuseMapback to summary
private Image oldDiffuseMap
oldSelfIlluminationMapback to summary
private Image oldSelfIlluminationMap
oldSpecularMapback to summary
private Image oldSpecularMap
peerback to summary
private NGPhongMaterial peer

The peer node created by the graphics Toolkit/Pipeline implementation

platformImageChangeListenerback to summary
private final AbstractNotifyListener platformImageChangeListener
selfIlluminationMapback to summary
private ObjectProperty<Image> selfIlluminationMap

The self illumination map of this PhongMaterial.

Default Value
null
selfIlluminationMapDirtyback to summary
private boolean selfIlluminationMapDirty
specularColorback to summary
private ObjectProperty<Color> specularColor

The specular color of this PhongMaterial.

Default Value
null
specularColorDirtyback to summary
private boolean specularColorDirty
specularMapback to summary
private ObjectProperty<Image> specularMap

The specular map of this PhongMaterial.

Default Value
null
specularMapDirtyback to summary
private boolean specularMapDirty
specularPowerback to summary
private DoubleProperty specularPower

The specular power of this PhongMaterial.

Default Value
32.0
specularPowerDirtyback to summary
private boolean specularPowerDirty

Constructor Detail

PhongMaterialback to summary
public PhongMaterial()

Creates a new instance of PhongMaterial class with a default Color.WHITE diffuseColor property.

PhongMaterialback to summary
public PhongMaterial(Color diffuseColor)

Creates a new instance of PhongMaterial class using the specified color for its diffuseColor property.

Parameters
diffuseColor:Color

the color of the diffuseColor property

PhongMaterialback to summary
public PhongMaterial(Color diffuseColor, Image diffuseMap, Image specularMap, Image bumpMap, Image selfIlluminationMap)

Creates a new instance of PhongMaterial class using the specified colors and images for its diffuseColor properties.

Parameters
diffuseColor:Color

the color of the diffuseColor property

diffuseMap:Image

the image of the diffuseMap property

specularMap:Image

the image of the specularMap property

bumpMap:Image

the image of the bumpMap property

selfIlluminationMap:Image

the image of the selfIlluminationMap property

Method Detail

bumpMapPropertyback to summary
public final ObjectProperty<Image> bumpMapProperty()
diffuseColorPropertyback to summary
public final ObjectProperty<Color> diffuseColorProperty()
diffuseMapPropertyback to summary
public final ObjectProperty<Image> diffuseMapProperty()
getBumpMapback to summary
public final Image getBumpMap()
getDiffuseColorback to summary
public final Color getDiffuseColor()
getDiffuseMapback to summary
public final Image getDiffuseMap()
getNGMaterialback to summary
pack-priv NGPhongMaterial getNGMaterial()

Implements abstract javafx.scene.paint.Material.getNGMaterial.

Annotations
@Override
getSelfIlluminationMapback to summary
public final Image getSelfIlluminationMap()
getSpecularColorback to summary
public final Color getSpecularColor()
getSpecularMapback to summary
public final Image getSpecularMap()
getSpecularPowerback to summary
public final double getSpecularPower()
selfIlluminationMapPropertyback to summary
public final ObjectProperty<Image> selfIlluminationMapProperty()
setBumpMapback to summary
public final void setBumpMap(Image value)
setDiffuseColorback to summary
public final void setDiffuseColor(Color value)
setDiffuseMapback to summary
public final void setDiffuseMap(Image value)
setDirtyback to summary
pack-priv void setDirty(boolean value)

Overrides javafx.scene.paint.Material.setDirty.

Annotations
@Override
setSelfIlluminationMapback to summary
public final void setSelfIlluminationMap(Image value)
setSpecularColorback to summary
public final void setSpecularColor(Color value)
setSpecularMapback to summary
public final void setSpecularMap(Image value)
setSpecularPowerback to summary
public final void setSpecularPower(double value)
specularColorPropertyback to summary
public final ObjectProperty<Color> specularColorProperty()
specularMapPropertyback to summary
public final ObjectProperty<Image> specularMapProperty()
specularPowerPropertyback to summary
public final DoubleProperty specularPowerProperty()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
updatePGback to summary
pack-priv void updatePG()

Implements abstract javafx.scene.paint.Material.updatePG.

Annotations
@Override