pub struct ArrayCamera {
pub camera: PerspectiveCamera,
pub cameras: Vec<PerspectiveCamera>,
}Expand description
ArrayCamera — a PerspectiveCamera holding sub-cameras that one
render() call draws the scene through, each into its own
viewport.
three.js’ ArrayCamera extends PerspectiveCamera; the port derefs to the
base camera, which is what the render list’s sort and the frustum array’s
fallback read. The sub-cameras are not its children: their matrices are
the application’s to update, as webgpu_camera_array does with
subcamera.updateMatrixWorld().
isMultiViewCamera (WebXR’s OVR_multiview2) is not ported.
Fields§
§camera: PerspectiveCameraThe base camera: ArrayCamera extends PerspectiveCamera, held by value
since Rust has no inheritance.
cameras: Vec<PerspectiveCamera>camera.cameras.
Implementations§
Source§impl ArrayCamera
impl ArrayCamera
Sourcepub fn new(cameras: Vec<PerspectiveCamera>) -> Self
pub fn new(cameras: Vec<PerspectiveCamera>) -> Self
new ArrayCamera( array ) — the base camera is new PerspectiveCamera()’s defaults.
Methods from Deref<Target = PerspectiveCamera>§
Sourcepub fn set_focal_length(&mut self, focal_length: f64)
pub fn set_focal_length(&mut self, focal_length: f64)
PerspectiveCamera.setFocalLength().
Sourcepub fn get_focal_length(&self) -> f64
pub fn get_focal_length(&self) -> f64
PerspectiveCamera.getFocalLength().
Sourcepub fn get_effective_fov(&self) -> f64
pub fn get_effective_fov(&self) -> f64
PerspectiveCamera.getEffectiveFOV().
Sourcepub fn get_film_width(&self) -> f64
pub fn get_film_width(&self) -> f64
PerspectiveCamera.getFilmWidth().
Sourcepub fn get_film_height(&self) -> f64
pub fn get_film_height(&self) -> f64
PerspectiveCamera.getFilmHeight().
Sourcepub fn get_view_bounds(
&self,
distance: f64,
min_target: &mut Vector2,
max_target: &mut Vector2,
)
pub fn get_view_bounds( &self, distance: f64, min_target: &mut Vector2, max_target: &mut Vector2, )
PerspectiveCamera.getViewBounds().
Sourcepub fn get_view_size(&self, distance: f64) -> Vector2
pub fn get_view_size(&self, distance: f64) -> Vector2
PerspectiveCamera.getViewSize().
Sourcepub fn set_view_offset(
&mut self,
full_width: f64,
full_height: f64,
x: f64,
y: f64,
width: f64,
height: f64,
)
pub fn set_view_offset( &mut self, full_width: f64, full_height: f64, x: f64, y: f64, width: f64, height: f64, )
PerspectiveCamera.setViewOffset().
Sourcepub fn clear_view_offset(&mut self)
pub fn clear_view_offset(&mut self)
PerspectiveCamera.clearViewOffset().
Sourcepub fn update_projection_matrix(&mut self)
pub fn update_projection_matrix(&mut self)
PerspectiveCamera.updateProjectionMatrix().
Sourcepub fn fit(&mut self, box_: &Box3, margin: f64)
pub fn fit(&mut self, box_: &Box3, margin: f64)
Move the camera along the direction it already looks in, until box_
fills the frame with margin of it left as slack (0.0 is tight, 0.1
leaves 10 % of the half-frame free on the tightest side). Not a three.js
method — see issue #51.
The view direction is the camera’s own, taken from matrix_world; only
the position moves, along that direction, and near/far are set to the
box’s extent along it. fov, aspect and zoom are read, not written,
so the caller’s framing choices survive the fit.
The distance is the one that actually frames the box: a bounding sphere
wastes the corners, and so does taking the eight corners’ lateral
extent, because a corner nearer the camera needs more distance than a far
one at the same offset. For each corner this asks what distance d puts
it exactly on a frustum plane — |x| / tan_h - depth horizontally,
|y| / tan_v - depth vertically, with depth the corner’s offset along
the view direction from the box centre — and takes the largest of the
sixteen answers.
A view offset (set_view_offset) is ignored;
the fit is to the full frustum.
Sourcepub fn look_at(&mut self, target: &Vector3)
pub fn look_at(&mut self, target: &Vector3)
Object3D.lookAt() for a camera: the matrix looks from the camera
position at the target.
Sourcepub fn update_matrix_world(&mut self)
pub fn update_matrix_world(&mut self)
Camera.updateMatrixWorld().
Trait Implementations§
Source§impl Clone for ArrayCamera
impl Clone for ArrayCamera
Source§impl Deref for ArrayCamera
impl Deref for ArrayCamera
Source§type Target = PerspectiveCamera
type Target = PerspectiveCamera
Source§fn deref(&self) -> &PerspectiveCamera
fn deref(&self) -> &PerspectiveCamera
Source§impl DerefMut for ArrayCamera
impl DerefMut for ArrayCamera
Source§fn deref_mut(&mut self) -> &mut PerspectiveCamera
fn deref_mut(&mut self) -> &mut PerspectiveCamera
Source§impl RenderCamera for ArrayCamera
impl RenderCamera for ArrayCamera
Source§fn set_view_offset(
&mut self,
full_width: f64,
full_height: f64,
x: f64,
y: f64,
width: f64,
height: f64,
)
fn set_view_offset( &mut self, full_width: f64, full_height: f64, x: f64, y: f64, width: f64, height: f64, )
ArrayCamera inherits PerspectiveCamera.setViewOffset, so the
offset lands on the outer camera; three’s sub-cameras keep their own
projections, and so do these.
Source§fn is_perspective_camera(&self) -> bool
fn is_perspective_camera(&self) -> bool
camera.isPerspectiveCamera.Source§fn update_matrix_world(&mut self)
fn update_matrix_world(&mut self)
camera.updateMatrixWorld(), which also refreshes matrixWorldInverse.Source§fn clear_view_offset(&mut self)
fn clear_view_offset(&mut self)
camera.clearViewOffset().Source§fn projection_matrix(&self) -> Matrix4
fn projection_matrix(&self) -> Matrix4
camera.projectionMatrix.Source§fn projection_matrix_inverse(&self) -> Matrix4
fn projection_matrix_inverse(&self) -> Matrix4
camera.projectionMatrixInverse, kept current by
update_projection_matrix() on both cameras.Source§fn matrix_world_inverse(&self) -> Matrix4
fn matrix_world_inverse(&self) -> Matrix4
camera.matrixWorldInverse — the view matrix.Source§fn coordinate_system(&self) -> CoordinateSystem
fn coordinate_system(&self) -> CoordinateSystem
camera.coordinateSystem.Source§fn matrix_world(&self) -> Matrix4
fn matrix_world(&self) -> Matrix4
camera.matrixWorld.Source§fn sub_cameras(&self) -> &[PerspectiveCamera]
fn sub_cameras(&self) -> &[PerspectiveCamera]
camera.isArrayCamera ? camera.cameras : [] — the sub-cameras one
render draws through, each into its own viewport. Empty for every
camera but an ArrayCamera.Source§fn is_orthographic_camera(&self) -> bool
fn is_orthographic_camera(&self) -> bool
camera.isOrthographicCamera.