Trait bevy_render::camera::CameraProjection

source ·
pub trait CameraProjection {
    // Required methods
    fn get_clip_from_view(&self) -> Mat4;
    fn update(&mut self, width: f32, height: f32);
    fn far(&self) -> f32;
    fn get_frustum_corners(&self, z_near: f32, z_far: f32) -> [Vec3A; 8];

    // Provided method
    fn compute_frustum(&self, camera_transform: &GlobalTransform) -> Frustum { ... }
}
Expand description

Trait to control the projection matrix of a camera.

Components implementing this trait are automatically polled for changes, and used to recompute the camera projection matrix of the Camera component attached to the same entity as the component implementing this trait.

Use the plugins CameraProjectionPlugin and bevy::pbr::PbrProjectionPlugin to setup the systems for your CameraProjection implementation.

Required Methods§

source

fn get_clip_from_view(&self) -> Mat4

source

fn update(&mut self, width: f32, height: f32)

source

fn far(&self) -> f32

source

fn get_frustum_corners(&self, z_near: f32, z_far: f32) -> [Vec3A; 8]

Provided Methods§

source

fn compute_frustum(&self, camera_transform: &GlobalTransform) -> Frustum

Compute camera frustum for camera with given projection and transform.

This code is called by update_frusta system for each camera to update its frustum.

Implementors§