parent
c6fe275b21
commit
701ccdec51
@ -186,6 +186,35 @@ impl Msaa {
|
|||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct ExtractedView {
|
pub struct ExtractedView {
|
||||||
|
/// Typically a right-handed projection matrix, one of either:
|
||||||
|
///
|
||||||
|
/// Perspective (infinite reverse z)
|
||||||
|
/// ```text
|
||||||
|
/// f = 1 / tan(fov_y_radians / 2)
|
||||||
|
///
|
||||||
|
/// ⎡ f / aspect 0 0 0 ⎤
|
||||||
|
/// ⎢ 0 f 0 0 ⎥
|
||||||
|
/// ⎢ 0 0 0 -1 ⎥
|
||||||
|
/// ⎣ 0 0 near 0 ⎦
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// Orthographic
|
||||||
|
/// ```text
|
||||||
|
/// w = right - left
|
||||||
|
/// h = top - bottom
|
||||||
|
/// d = near - far
|
||||||
|
/// cw = -right - left
|
||||||
|
/// ch = -top - bottom
|
||||||
|
///
|
||||||
|
/// ⎡ 2 / w 0 0 0 ⎤
|
||||||
|
/// ⎢ 0 2 / h 0 0 ⎥
|
||||||
|
/// ⎢ 0 0 1 / d 0 ⎥
|
||||||
|
/// ⎣ cw / w ch / h near / d 1 ⎦
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `clip_from_view[3][3] == 1.0` is the standard way to check if a projection is orthographic
|
||||||
|
///
|
||||||
|
/// Custom projections are also possible however.
|
||||||
pub clip_from_view: Mat4,
|
pub clip_from_view: Mat4,
|
||||||
pub world_from_view: GlobalTransform,
|
pub world_from_view: GlobalTransform,
|
||||||
// The view-projection matrix. When provided it is used instead of deriving it from
|
// The view-projection matrix. When provided it is used instead of deriving it from
|
||||||
@ -423,6 +452,35 @@ pub struct ViewUniform {
|
|||||||
pub world_from_clip: Mat4,
|
pub world_from_clip: Mat4,
|
||||||
pub world_from_view: Mat4,
|
pub world_from_view: Mat4,
|
||||||
pub view_from_world: Mat4,
|
pub view_from_world: Mat4,
|
||||||
|
/// Typically a right-handed projection matrix, one of either:
|
||||||
|
///
|
||||||
|
/// Perspective (infinite reverse z)
|
||||||
|
/// ```text
|
||||||
|
/// f = 1 / tan(fov_y_radians / 2)
|
||||||
|
///
|
||||||
|
/// ⎡ f / aspect 0 0 0 ⎤
|
||||||
|
/// ⎢ 0 f 0 0 ⎥
|
||||||
|
/// ⎢ 0 0 0 -1 ⎥
|
||||||
|
/// ⎣ 0 0 near 0 ⎦
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// Orthographic
|
||||||
|
/// ```text
|
||||||
|
/// w = right - left
|
||||||
|
/// h = top - bottom
|
||||||
|
/// d = near - far
|
||||||
|
/// cw = -right - left
|
||||||
|
/// ch = -top - bottom
|
||||||
|
///
|
||||||
|
/// ⎡ 2 / w 0 0 0 ⎤
|
||||||
|
/// ⎢ 0 2 / h 0 0 ⎥
|
||||||
|
/// ⎢ 0 0 1 / d 0 ⎥
|
||||||
|
/// ⎣ cw / w ch / h near / d 1 ⎦
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `clip_from_view[3][3] == 1.0` is the standard way to check if a projection is orthographic
|
||||||
|
///
|
||||||
|
/// Custom projections are also possible however.
|
||||||
pub clip_from_view: Mat4,
|
pub clip_from_view: Mat4,
|
||||||
pub view_from_clip: Mat4,
|
pub view_from_clip: Mat4,
|
||||||
pub world_position: Vec3,
|
pub world_position: Vec3,
|
||||||
|
@ -19,6 +19,35 @@ struct View {
|
|||||||
world_from_clip: mat4x4<f32>,
|
world_from_clip: mat4x4<f32>,
|
||||||
world_from_view: mat4x4<f32>,
|
world_from_view: mat4x4<f32>,
|
||||||
view_from_world: mat4x4<f32>,
|
view_from_world: mat4x4<f32>,
|
||||||
|
// Typically a right-handed projection matrix, one of either:
|
||||||
|
//
|
||||||
|
// Perspective (infinite reverse z)
|
||||||
|
// ```
|
||||||
|
// f = 1 / tan(fov_y_radians / 2)
|
||||||
|
//
|
||||||
|
// ⎡ f / aspect 0 0 0 ⎤
|
||||||
|
// ⎢ 0 f 0 0 ⎥
|
||||||
|
// ⎢ 0 0 0 -1 ⎥
|
||||||
|
// ⎣ 0 0 near 0 ⎦
|
||||||
|
// ```
|
||||||
|
//
|
||||||
|
// Orthographic
|
||||||
|
// ```
|
||||||
|
// w = right - left
|
||||||
|
// h = top - bottom
|
||||||
|
// d = near - far
|
||||||
|
// cw = -right - left
|
||||||
|
// ch = -top - bottom
|
||||||
|
//
|
||||||
|
// ⎡ 2 / w 0 0 0 ⎤
|
||||||
|
// ⎢ 0 2 / h 0 0 ⎥
|
||||||
|
// ⎢ 0 0 1 / d 0 ⎥
|
||||||
|
// ⎣ cw / w ch / h near / d 1 ⎦
|
||||||
|
// ```
|
||||||
|
//
|
||||||
|
// `clip_from_view[3][3] == 1.0` is the standard way to check if a projection is orthographic
|
||||||
|
//
|
||||||
|
// Custom projections are also possible however.
|
||||||
clip_from_view: mat4x4<f32>,
|
clip_from_view: mat4x4<f32>,
|
||||||
view_from_clip: mat4x4<f32>,
|
view_from_clip: mat4x4<f32>,
|
||||||
world_position: vec3<f32>,
|
world_position: vec3<f32>,
|
||||||
|
Loading…
Reference in New Issue
Block a user