[−][src]Trait kiss3d::camera::Camera
Trait every camera must implement.
Required methods
fn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
Handle a mouse event.
fn eye(&self) -> Point3<f32>
The camera position.
fn view_transform(&self) -> Isometry3<f32>
The camera view transform.
fn transformation(&self) -> Matrix4<f32>
The transformation applied by the camera to transform a point in world coordinates to a point in device coordinates.
fn inverse_transformation(&self) -> Matrix4<f32>
The transformation applied by the camera to transform point in device coordinates to a point in world coordinate.
fn clip_planes(&self) -> (f32, f32)
The clipping planes, aka. (znear
, zfar
).
fn update(&mut self, canvas: &Canvas)
Update the camera. This is called once at the beginning of the render loop.
fn upload(
&self,
pass: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
&self,
pass: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
Upload the camera view and projection to the gpu. This can be called multiple times on the render loop.
Provided methods
fn num_passes(&self) -> usize
The number of passes required by this camera.
fn start_pass(&self, _pass: usize, _canvas: &Canvas)
Indicates that a pass will begin.
fn render_complete(&self, _canvas: &Canvas)
Indicates that the scene has been rendered and the post-processing is being run.
fn project(
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
Converts a 3d point to 2d screen coordinates, assuming the screen has the size size
.
fn unproject(
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
Converts a point in 2d screen coordinates to a ray (a 3d position and a direction).
The screen is assumed to have a size given by size
.
Implementors
impl Camera for ArcBall
[src]
fn clip_planes(&self) -> (f32, f32)
[src]
fn view_transform(&self) -> Isometry3<f32>
[src]
fn eye(&self) -> Point3<f32>
[src]
fn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
[src]
fn upload(
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
[src]
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
fn transformation(&self) -> Matrix4<f32>
[src]
fn inverse_transformation(&self) -> Matrix4<f32>
[src]
fn update(&mut self, _: &Canvas)
[src]
fn num_passes(&self) -> usize
[src]
fn start_pass(&self, _pass: usize, _canvas: &Canvas)
[src]
fn render_complete(&self, _canvas: &Canvas)
[src]
fn project(
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
[src]
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
fn unproject(
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
[src]
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
impl Camera for FirstPerson
[src]
fn clip_planes(&self) -> (f32, f32)
[src]
fn view_transform(&self) -> Isometry3<f32>
[src]
The camera view transformation (i-e transformation without projection).
fn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
[src]
fn eye(&self) -> Point3<f32>
[src]
fn transformation(&self) -> Matrix4<f32>
[src]
fn inverse_transformation(&self) -> Matrix4<f32>
[src]
fn upload(
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
[src]
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
fn update(&mut self, canvas: &Canvas)
[src]
fn num_passes(&self) -> usize
[src]
fn start_pass(&self, _pass: usize, _canvas: &Canvas)
[src]
fn render_complete(&self, _canvas: &Canvas)
[src]
fn project(
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
[src]
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
fn unproject(
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
[src]
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
impl Camera for FirstPersonStereo
[src]
fn clip_planes(&self) -> (f32, f32)
[src]
fn view_transform(&self) -> Isometry3<f32>
[src]
The imaginary middle eye camera view transformation (i-e transformation without projection).
fn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
[src]
fn eye(&self) -> Point3<f32>
[src]
fn transformation(&self) -> Matrix4<f32>
[src]
fn inverse_transformation(&self) -> Matrix4<f32>
[src]
fn update(&mut self, canvas: &Canvas)
[src]
fn upload(
&self,
pass: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
[src]
&self,
pass: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
fn num_passes(&self) -> usize
[src]
fn start_pass(&self, pass: usize, canvas: &Canvas)
[src]
fn render_complete(&self, canvas: &Canvas)
[src]
fn project(
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
[src]
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
fn unproject(
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
[src]
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
impl Camera for FixedView
[src]
fn clip_planes(&self) -> (f32, f32)
[src]
fn view_transform(&self) -> Isometry3<f32>
[src]
fn eye(&self) -> Point3<f32>
[src]
fn handle_event(&mut self, _: &Canvas, event: &WindowEvent)
[src]
fn upload(
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
[src]
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
fn transformation(&self) -> Matrix4<f32>
[src]
fn inverse_transformation(&self) -> Matrix4<f32>
[src]
fn update(&mut self, _: &Canvas)
[src]
fn num_passes(&self) -> usize
[src]
fn start_pass(&self, _pass: usize, _canvas: &Canvas)
[src]
fn render_complete(&self, _canvas: &Canvas)
[src]
fn project(
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
[src]
&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>
) -> Vector2<f32>
fn unproject(
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)
[src]
&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>
) -> (Point3<f32>, Vector3<f32>)