Viewport
Description
- Derived from
-
Versioned abstract
The Viewport class represents the viewport of a 3D application.
Instances of this class are used to project terrain-space error values and bounding spheres to screen-space. This is done using an isotropic metric, which is derived from the following values:
error' = error * scale / distance scale = size / fov
where error
is the terrain-space error value, distance
is the distance from the terrain vertex to the camera position, size
is the viewport size in screen pixels along the field of view, fov
is the field of view angle in radians and error'
is the resulting screen-space error value.
This class interprets the projection plane as a subsection of a sphere. Then, the field of view angles can then be seen as arc-lengths, which allows them to be greater than 180° (see AdjustFieldOfView).
Public / Methods
Inside
Checks if the given point or sphere is at least partially inside of the viewport frustum.
The point position must be specified in camera space: The positive Z-axis is the camera direction, the positive Y-axis is the camera upwards direction and the X-axis is the camera side direction (cartesian handedness is not relevant for this method).
Public / Attributes
BaseFieldOfView
The base field of view angle.
Depending on Mode, the angle is either measured along the viewports X-axis (FovMode.Horizontal) or Y-axis (FovMode.Vertical).
When the current field of view of the viewport is smaller than the base field of view angle given by this method, the viewport is considered to be zoomed in. In this case, terrain-space error values of vertices that lie inside the viewport (see Inside) are projected using the actual viewport field of view (i.e. the zoomed in one), whereas error values of the other vertices are projected using the base field of view:
+-----------------------------+ | | | +-----+ | | |ooooo| | | |ooooo| | | |ooooo| | | +-----+ | | | +-----------------------------+
This way, additional detail due to zooming is only generated in the visible area (the 'o’s in the above figure, which are inside the viewport quadrilateral). Otherwise, additional detail would be introduced into the whole mesh, which would quickly exhaust the vertex capacity.
Defaults to 0
.
- See also
FieldOfView
The current field of view angle, in degrees.
Depending on Mode, the angle is either measured along the viewports X-axis ( FovMode.Horizontal) or Y-axis (FovMode.Vertical).
- See also