@@ -262,34 +262,36 @@ impl RetainedViewEntity {
262
262
pub struct ExtractedView {
263
263
/// The entity in the main world corresponding to this render world view.
264
264
pub retained_view_entity : RetainedViewEntity ,
265
- /// Typically a right-handed projection matrix, one of either:
265
+ /// Typically a column-major right-handed projection matrix, one of either:
266
266
///
267
267
/// Perspective (infinite reverse z)
268
268
/// ```text
269
269
/// f = 1 / tan(fov_y_radians / 2)
270
270
///
271
- /// ⎡ f / aspect 0 0 0 ⎤
272
- /// ⎢ 0 f 0 0 ⎥
273
- /// ⎢ 0 0 0 -1 ⎥
274
- /// ⎣ 0 0 near 0 ⎦
271
+ /// ⎡ f / aspect 0 0 0 ⎤
272
+ /// ⎢ 0 f 0 0 ⎥
273
+ /// ⎢ 0 0 0 near ⎥
274
+ /// ⎣ 0 0 -1 0 ⎦
275
275
/// ```
276
276
///
277
277
/// Orthographic
278
278
/// ```text
279
279
/// w = right - left
280
280
/// h = top - bottom
281
- /// d = near - far
281
+ /// d = far - near
282
282
/// cw = -right - left
283
283
/// ch = -top - bottom
284
284
///
285
- /// ⎡ 2 / w 0 0 0 ⎤
286
- /// ⎢ 0 2 / h 0 0 ⎥
287
- /// ⎢ 0 0 1 / d 0 ⎥
288
- /// ⎣ cw / w ch / h near / d 1 ⎦
285
+ /// ⎡ 2 / w 0 0 cw / w ⎤
286
+ /// ⎢ 0 2 / h 0 ch / h ⎥
287
+ /// ⎢ 0 0 1 / d far / d ⎥
288
+ /// ⎣ 0 0 0 1 ⎦
289
289
/// ```
290
290
///
291
291
/// `clip_from_view[3][3] == 1.0` is the standard way to check if a projection is orthographic
292
292
///
293
+ /// Glam matrices are column major, so for example getting the near plane of a perspective projection is `clip_from_view[3][2]`
294
+ ///
293
295
/// Custom projections are also possible however.
294
296
pub clip_from_view : Mat4 ,
295
297
pub world_from_view : GlobalTransform ,
@@ -529,34 +531,36 @@ pub struct ViewUniform {
529
531
pub world_from_clip : Mat4 ,
530
532
pub world_from_view : Mat4 ,
531
533
pub view_from_world : Mat4 ,
532
- /// Typically a right-handed projection matrix, one of either:
534
+ /// Typically a column-major right-handed projection matrix, one of either:
533
535
///
534
536
/// Perspective (infinite reverse z)
535
537
/// ```text
536
538
/// f = 1 / tan(fov_y_radians / 2)
537
539
///
538
- /// ⎡ f / aspect 0 0 0 ⎤
539
- /// ⎢ 0 f 0 0 ⎥
540
- /// ⎢ 0 0 0 -1 ⎥
541
- /// ⎣ 0 0 near 0 ⎦
540
+ /// ⎡ f / aspect 0 0 0 ⎤
541
+ /// ⎢ 0 f 0 0 ⎥
542
+ /// ⎢ 0 0 0 near ⎥
543
+ /// ⎣ 0 0 -1 0 ⎦
542
544
/// ```
543
545
///
544
546
/// Orthographic
545
547
/// ```text
546
548
/// w = right - left
547
549
/// h = top - bottom
548
- /// d = near - far
550
+ /// d = far - near
549
551
/// cw = -right - left
550
552
/// ch = -top - bottom
551
553
///
552
- /// ⎡ 2 / w 0 0 0 ⎤
553
- /// ⎢ 0 2 / h 0 0 ⎥
554
- /// ⎢ 0 0 1 / d 0 ⎥
555
- /// ⎣ cw / w ch / h near / d 1 ⎦
554
+ /// ⎡ 2 / w 0 0 cw / w ⎤
555
+ /// ⎢ 0 2 / h 0 ch / h ⎥
556
+ /// ⎢ 0 0 1 / d far / d ⎥
557
+ /// ⎣ 0 0 0 1 ⎦
556
558
/// ```
557
559
///
558
560
/// `clip_from_view[3][3] == 1.0` is the standard way to check if a projection is orthographic
559
561
///
562
+ /// Glam matrices are column major, so for example getting the near plane of a perspective projection is `clip_from_view[3][2]`
563
+ ///
560
564
/// Custom projections are also possible however.
561
565
pub clip_from_view : Mat4 ,
562
566
pub view_from_clip : Mat4 ,
0 commit comments