Class PhongMaterialBuilder
java.lang.Object
io.github.sosuisen.jfxbuilder.graphics.PhongMaterialBuilder
The
PhongMaterialBuilder class constructs instances of the PhongMaterial class
and offers a fluent interface for creating and configuring it.
This class includes a static create method that accepts the same arguments as the original PhongMaterial constructor
and returns an instance of the PhongMaterialBuilder.
You can use method chaining to call the builder methods for configuring the PhongMaterial.
Finally, invoke the build method to generate an instance of the PhongMaterial class.
Note that intermediate builder methods are not evaluated until the build method
is called, meaning they are evaluated lazily.
- Author:
- Hidekazu Kubota <hidekazu.kubota@gmail.com>
-
Method Summary
Modifier and TypeMethodDescriptionapply(Consumer<PhongMaterial> func) Applies a function to the PhongMaterial instance being constructed.build()Builds and returns an instance of thePhongMaterialclass.A builder method that invokes thesetBumpMapmethod on the instance being constructed.Applies a function to thebumpMapPropertyof the instance being constructed.static PhongMaterialBuildercreate()Returns an instance of thePhongMaterialBuilder.static PhongMaterialBuilderAccepts the constructor arguments ofPhongMaterial(Color)and returns an instance ofPhongMaterialBuilder.static PhongMaterialBuildercreate(Color diffuseColor, Image diffuseMap, Image specularMap, Image bumpMap, Image selfIlluminationMap) Accepts the constructor arguments ofPhongMaterial(Color, Image, Image, Image, Image)and returns an instance ofPhongMaterialBuilder.diffuseColor(Color value) A builder method that invokes thesetDiffuseColormethod on the instance being constructed.Applies a function to thediffuseColorPropertyof the instance being constructed.diffuseMap(Image value) A builder method that invokes thesetDiffuseMapmethod on the instance being constructed.Applies a function to thediffuseMapPropertyof the instance being constructed.selfIlluminationMap(Image value) A builder method that invokes thesetSelfIlluminationMapmethod on the instance being constructed.Applies a function to theselfIlluminationMapPropertyof the instance being constructed.specularColor(Color value) A builder method that invokes thesetSpecularColormethod on the instance being constructed.Applies a function to thespecularColorPropertyof the instance being constructed.specularMap(Image value) A builder method that invokes thesetSpecularMapmethod on the instance being constructed.Applies a function to thespecularMapPropertyof the instance being constructed.specularPower(double value) A builder method that invokes thesetSpecularPowermethod on the instance being constructed.Applies a function to thespecularPowerPropertyof the instance being constructed.
-
Method Details
-
create
Returns an instance of thePhongMaterialBuilder.- Returns:
- an instance of the
PhongMaterialBuilder.
-
create
Accepts the constructor arguments ofPhongMaterial(Color)and returns an instance ofPhongMaterialBuilder.- Returns:
- an instance of the
PhongMaterialBuilder.
-
create
public static PhongMaterialBuilder create(Color diffuseColor, Image diffuseMap, Image specularMap, Image bumpMap, Image selfIlluminationMap) Accepts the constructor arguments ofPhongMaterial(Color, Image, Image, Image, Image)and returns an instance ofPhongMaterialBuilder.- Returns:
- an instance of the
PhongMaterialBuilder.
-
build
Builds and returns an instance of thePhongMaterialclass.Intermediate builder methods are not evaluated until the
buildmethod is called; in other words, they are evaluated lazily.- Returns:
- new instance of the
PhongMaterialclass
-
apply
Applies a function to the PhongMaterial instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
bumpMap
A builder method that invokes thesetBumpMapmethod on the instance being constructed.- Returns:
- builder instance
-
diffuseColor
A builder method that invokes thesetDiffuseColormethod on the instance being constructed.- Returns:
- builder instance
-
diffuseMap
A builder method that invokes thesetDiffuseMapmethod on the instance being constructed.- Returns:
- builder instance
-
selfIlluminationMap
A builder method that invokes thesetSelfIlluminationMapmethod on the instance being constructed.- Returns:
- builder instance
-
specularColor
A builder method that invokes thesetSpecularColormethod on the instance being constructed.- Returns:
- builder instance
-
specularMap
A builder method that invokes thesetSpecularMapmethod on the instance being constructed.- Returns:
- builder instance
-
specularPower
A builder method that invokes thesetSpecularPowermethod on the instance being constructed.- Returns:
- builder instance
-
bumpMapPropertyApply
Applies a function to thebumpMapPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.bumpMapProperty().bind(anotherProperty)) // Use shorthand form .bumpMapPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
diffuseColorPropertyApply
Applies a function to thediffuseColorPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.diffuseColorProperty().bind(anotherProperty)) // Use shorthand form .diffuseColorPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
diffuseMapPropertyApply
Applies a function to thediffuseMapPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.diffuseMapProperty().bind(anotherProperty)) // Use shorthand form .diffuseMapPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
selfIlluminationMapPropertyApply
Applies a function to theselfIlluminationMapPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.selfIlluminationMapProperty().bind(anotherProperty)) // Use shorthand form .selfIlluminationMapPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
specularColorPropertyApply
Applies a function to thespecularColorPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.specularColorProperty().bind(anotherProperty)) // Use shorthand form .specularColorPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
specularMapPropertyApply
Applies a function to thespecularMapPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.specularMapProperty().bind(anotherProperty)) // Use shorthand form .specularMapPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
specularPowerPropertyApply
Applies a function to thespecularPowerPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.specularPowerProperty().bind(anotherProperty)) // Use shorthand form .specularPowerPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-