Class OrthographicCamera.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
OrthographicCamera
OrthographicCamera instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a new orthographic camera.voidclose()protected voidfinalize()look2D(Camera.Look2D look) Sets up a 2D camera viewpoint, looking straight down (along the z axis to plane at z=0).nearFar(double nearPlane, double farPlane) Sets the near and far clipping distances of the new camera.
-
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
-
look2D
Sets up a 2D camera viewpoint, looking straight down (along the z axis to plane at z=0).- Parameters:
look- the description of target, scaling and orientation description for the new camera.- Returns:
- this builder
-
nearFar
Sets the near and far clipping distances of the new camera.These values only take effect when the map's automatic near/far adjustment is turned off (see
Map#setAutoAdjustDepthRangeEnabled). With that adjustment on (the default), the map manages the near and far for you, so values set here apply only once you turn it off. A freshly built orthographic camera defaults to a near of -9000 and a far of 20000.The near and far bound the depth range: the interval along the view direction, measured from the eye, that is kept. For an orthographic projection the view volume between them is a box (parallel, equally sized near and far planes), so unlike a perspective camera the near distance may be zero or negative, depth is linear, and the far to near ratio does not affect precision. The range only has to contain the geometry you want to keep visible, so bracketing your content with some margin is enough (for a top-down view, a range that is roughly symmetric around the plane you are looking at works well).
Practical note: the orthographic camera is currently only used for 2D (projected, grid) maps, where all content lies in the map plane (at z=0), so the exact near and far have little visible effect as long as the range contains that plane.
- Parameters:
nearPlane- the distance from the eye to the near clipping plane.farPlane- the distance from the eye to the far clipping plane.- Returns:
- this builder
- Since:
- 2026.1
-
build
Returns a new orthographic camera.- Returns:
- a new orthographic camera.
-