Class PhongMaterialBuilder

java.lang.Object
io.github.sosuisen.jfxbuilder.graphics.PhongMaterialBuilder

public class PhongMaterialBuilder extends Object
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 Details

    • create

      public static PhongMaterialBuilder create()
      Returns an instance of the PhongMaterialBuilder.
      Returns:
      an instance of the PhongMaterialBuilder.
    • create

      public static PhongMaterialBuilder create(Color diffuseColor)
      Accepts the constructor arguments of PhongMaterial(Color) and returns an instance of PhongMaterialBuilder.
      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 of PhongMaterial(Color, Image, Image, Image, Image) and returns an instance of PhongMaterialBuilder.
      Returns:
      an instance of the PhongMaterialBuilder.
    • build

      public PhongMaterial build()
      Builds and returns an instance of the PhongMaterial class.

      Intermediate builder methods are not evaluated until the build method is called; in other words, they are evaluated lazily.

      Returns:
      new instance of the PhongMaterial class
    • 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

      public PhongMaterialBuilder bumpMap(Image value)
      A builder method that invokes the setBumpMap method on the instance being constructed.
      Returns:
      builder instance
    • diffuseColor

      public PhongMaterialBuilder diffuseColor(Color value)
      A builder method that invokes the setDiffuseColor method on the instance being constructed.
      Returns:
      builder instance
    • diffuseMap

      public PhongMaterialBuilder diffuseMap(Image value)
      A builder method that invokes the setDiffuseMap method on the instance being constructed.
      Returns:
      builder instance
    • selfIlluminationMap

      public PhongMaterialBuilder selfIlluminationMap(Image value)
      A builder method that invokes the setSelfIlluminationMap method on the instance being constructed.
      Returns:
      builder instance
    • specularColor

      public PhongMaterialBuilder specularColor(Color value)
      A builder method that invokes the setSpecularColor method on the instance being constructed.
      Returns:
      builder instance
    • specularMap

      public PhongMaterialBuilder specularMap(Image value)
      A builder method that invokes the setSpecularMap method on the instance being constructed.
      Returns:
      builder instance
    • specularPower

      public PhongMaterialBuilder specularPower(double value)
      A builder method that invokes the setSpecularPower method on the instance being constructed.
      Returns:
      builder instance
    • bumpMapPropertyApply

      public PhongMaterialBuilder bumpMapPropertyApply(Consumer<ObjectProperty<Image>> op)
      Applies a function to the bumpMapProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.bumpMapProperty().bind(anotherProperty))
      
      // Use shorthand form
      .bumpMapPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • diffuseColorPropertyApply

      public PhongMaterialBuilder diffuseColorPropertyApply(Consumer<ObjectProperty<Color>> op)
      Applies a function to the diffuseColorProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.diffuseColorProperty().bind(anotherProperty))
      
      // Use shorthand form
      .diffuseColorPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • diffuseMapPropertyApply

      public PhongMaterialBuilder diffuseMapPropertyApply(Consumer<ObjectProperty<Image>> op)
      Applies a function to the diffuseMapProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.diffuseMapProperty().bind(anotherProperty))
      
      // Use shorthand form
      .diffuseMapPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • selfIlluminationMapPropertyApply

      public PhongMaterialBuilder selfIlluminationMapPropertyApply(Consumer<ObjectProperty<Image>> op)
      Applies a function to the selfIlluminationMapProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.selfIlluminationMapProperty().bind(anotherProperty))
      
      // Use shorthand form
      .selfIlluminationMapPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • specularColorPropertyApply

      public PhongMaterialBuilder specularColorPropertyApply(Consumer<ObjectProperty<Color>> op)
      Applies a function to the specularColorProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.specularColorProperty().bind(anotherProperty))
      
      // Use shorthand form
      .specularColorPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • specularMapPropertyApply

      public PhongMaterialBuilder specularMapPropertyApply(Consumer<ObjectProperty<Image>> op)
      Applies a function to the specularMapProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.specularMapProperty().bind(anotherProperty))
      
      // Use shorthand form
      .specularMapPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • specularPowerPropertyApply

      public PhongMaterialBuilder specularPowerPropertyApply(Consumer<DoubleProperty> op)
      Applies a function to the specularPowerProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.specularPowerProperty().bind(anotherProperty))
      
      // Use shorthand form
      .specularPowerPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance