public static final class PerspectiveCamera.Builder extends Object implements AutoCloseable
PerspectiveCamera
instances.Constructor and Description |
---|
Builder(PerspectiveCamera.Builder other) |
Modifier and Type | Method and Description |
---|---|
PerspectiveCamera |
build()
Returns a new perspective camera.
|
void |
close() |
PerspectiveCamera.Builder |
eye(Coordinate eye)
Sets the eye the position of the new camera.
|
protected void |
finalize() |
PerspectiveCamera.Builder |
fovY(Angle fovY)
Sets the vertical field of view.
|
PerspectiveCamera.Builder |
look(Camera.Look look)
Sets the position and orientation of the new camera.
|
PerspectiveCamera.Builder |
lookAt(Camera.LookAt lookAt)
Sets the description of what the camera is looking at and the orientation of the camera.
|
PerspectiveCamera.Builder |
lookFrom(Camera.LookFrom lookFrom)
Sets the description of the position and orientation of the new camera.
|
PerspectiveCamera.Builder |
orientation(Coordinate forward,
Coordinate up)
Sets the forward the viewing direction of the new camera and the camera's up direction.
|
public Builder(@NotNull PerspectiveCamera.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public PerspectiveCamera.Builder eye(@NotNull Coordinate eye)
eye
- the position of the new camera.@NotNull public PerspectiveCamera.Builder orientation(@NotNull Coordinate forward, @NotNull Coordinate up)
forward
- the viewing direction of the new cameraup
- the camera's up direction@NotNull public PerspectiveCamera.Builder look(@NotNull Camera.Look look)
look
- the position and orientation of the new camera.@NotNull public PerspectiveCamera.Builder lookAt(@NotNull Camera.LookAt lookAt)
lookAt
- the description of what the camera is looking at and the orientation of the camera.@NotNull public PerspectiveCamera.Builder lookFrom(@NotNull Camera.LookFrom lookFrom)
lookFrom
- the description of the position and orientation of the new camera.@NotNull public PerspectiveCamera.Builder fovY(@NotNull Angle fovY)
// Vertical -> horizontal field-of-view
double aspectRatio = (double) (camera.getWidth()) / camera.getHeight();
Angle cameraFovX = Angle.fromRadians(2.0 * Math.atan(Math.tan(camera.getFovY().getRadians() / 2.0) * aspectRatio));
// Horizontal -> vertical field-of-view
Angle newFovX = new Angle(60.0);
Angle newFovY = Angle.fromRadians(2 * Math.atan(Math.tan(newFovX.getRadians() / 2.0) / aspectRatio));
fovY
- the new vertical field of view.@NotNull public PerspectiveCamera build()