Class DepthOfFieldModel.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
DepthOfFieldModel
Builder for a DepthOfFieldModel.- Since:
- 2026.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionblurStartDistance(double blurStartDistance) Sets the blur-start distance in meters: the distance from the focus plane beyond which objects start to blur.blurStrength(double blurStrength) Sets the blur strength multiplier.build()Builds the depth-of-field model.voidclose()protected voidfinalize()focusDistance(double focusDistance) Sets the focus distance in meters: the distance from the camera at which objects are perfectly in focus.fullBlurDistance(double fullBlurDistance) Sets the full-blur distance in meters: the distance from the focus plane at which the blur saturates and objects are fully blurred.
-
Constructor Details
-
Builder
Copy constructor.- Parameters:
other- the builder to copy.
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
blurStrength
@NotNull public DepthOfFieldModel.Builder blurStrength(double blurStrength) throws IllegalArgumentException Sets the blur strength multiplier.This value scales the amount of blur applied to out-of-focus objects: at the default of 1, fully out-of-focus objects reach the maximum blur, values above 1 reach the maximum over a shorter distance, and values below 1 soften the blur. The default is 1.
- Parameters:
blurStrength- the blur strength multiplier. Must be non-negative.- Returns:
- this builder.
- Throws:
IllegalArgumentException- when the blur strength is negative.
-
focusDistance
@NotNull public DepthOfFieldModel.Builder focusDistance(double focusDistance) throws IllegalArgumentException Sets the focus distance in meters: the distance from the camera at which objects are perfectly in focus.This distance defines the focus plane, around which the blur-start distance and full-blur distance are measured. The default focus distance is 200.
- Parameters:
focusDistance- the focus distance in meters. Must be non-negative.- Returns:
- this builder.
- Throws:
IllegalArgumentException- when the focus distance is negative.
-
blurStartDistance
@NotNull public DepthOfFieldModel.Builder blurStartDistance(double blurStartDistance) throws IllegalArgumentException Sets the blur-start distance in meters: the distance from the focus plane beyond which objects start to blur.Within this distance objects stay perfectly sharp. It is measured symmetrically around the focus plane. The default is 200.
- Parameters:
blurStartDistance- the blur-start distance in meters. Must be non-negative.- Returns:
- this builder.
- Throws:
IllegalArgumentException- when the blur-start distance is negative.
-
fullBlurDistance
@NotNull public DepthOfFieldModel.Builder fullBlurDistance(double fullBlurDistance) throws IllegalArgumentException Sets the full-blur distance in meters: the distance from the focus plane at which the blur saturates and objects are fully blurred.Between the blur-start distance and this distance objects are blurred progressively. The full-blur distance must be at least the blur-start distance, which
buildverifies. Setting it equal to the blur-start distance gives an immediate transition to full blur (no progressive blurring). The default is 400.- Parameters:
fullBlurDistance- the full-blur distance in meters. Must be non-negative.- Returns:
- this builder.
- Throws:
IllegalArgumentException- when the full-blur distance is negative.
-
build
Builds the depth-of-field model.- Returns:
- the built depth-of-field model.
- Throws:
IllegalArgumentException- when the blur-start distance is larger than the full-blur distance.
-