Factory object that can create new PerspectiveCamera instances.
More...
Factory object that can create new PerspectiveCamera instances.
◆ Builder()
Copy constructor.
- Parameters
-
| other | the builder to copy. |
◆ Build()
Returns a new perspective camera.
- Returns
- a new perspective camera.
◆ Dispose()
| void Luciad.Cameras.PerspectiveCamera.Builder.Dispose |
( |
| ) |
|
|
inline |
◆ Eye()
Sets the eye the position of the new camera.
- Parameters
-
| eye | the position of the new camera. |
- Returns
- this builder
◆ FovY()
Sets the vertical field of view.
- Note
- The horizontal field of view will be derived from vertical field of view based on the aspect ratio. You can convert between horizontal and vertical field-of-view angles using the following formulae:
double aspectRatio = (double)(camera.Width) / camera.Height;
Angle cameraFovX = Angle.FromRadians(2.0 * Math.Atan(Math.Tan(camera.FovY.Radians / 2.0) * aspectRatio));
Angle newFovX = 60.0;
Angle newFovY = Angle.FromRadians(2 * Math.Atan(Math.Tan(newFovX.Radians / 2.0) / aspectRatio));
- Parameters
-
| fovY | the new vertical field of view. |
- Returns
- this builder
◆ Look()
Sets the position and orientation of the new camera.
- Parameters
-
| look | the position and orientation of the new camera. |
- Returns
- this builder
◆ LookAt()
Sets the description of what the camera is looking at and the orientation of the camera.
- Parameters
-
| lookAt | the description of what the camera is looking at and the orientation of the camera. |
- Returns
- this builder
◆ LookFrom()
Sets the description of the position and orientation of the new camera.
- Parameters
-
| lookFrom | the description of the position and orientation of 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).
Note that choosing a range that is too wide can introduce depth artifacts. Choosing a range that is too narrow can clip parts of the visible object, or even clip it away completely.
Both distances are in the units of the map reference (meters for a geocentric reference). The near plane must be positive and smaller than the far plane.
Guidelines for choosing a range:
-
Depth precision is governed by the far to near ratio, not by the absolute values. Very large ratios make distant surfaces z-fight, so keep the ratio as small as the scene allows (up to the order of 1e5 is usually fine).
-
Push the near plane as far from the eye as you can without clipping the closest geometry you care about. The near plane dominates precision, so a needlessly small one wastes precision over the whole range.
-
Pull the far plane in to just beyond the farthest geometry that has to stay visible.
-
Prefer deriving both from the distance between the eye and what you are looking at, rather than fixed values, so the range tracks the scene as you zoom.
Example ranges for a geocentric (meters) map, with an earth radius of about 6.378e6:
-
Close to the ground, inspecting buildings (eye a few hundred meters up): near about 1, far about 1e5.
-
Regional view (eye tens of kilometers up): near about 1e2, far about 1e6.
-
Whole-earth view (eye a couple of earth radii out): near about 1e5, far about 5e7, reaching the far side of the globe.
- 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
◆ Orientation()
Sets the forward the viewing direction of the new camera and the camera's up direction.
- Parameters
-
| forward | the viewing direction of the new camera |
| up | the camera's up direction |
- Returns
- this builder