Explain Camera physical size is in pixel (#11189)
# Objective It may be not be obviously clear what is physical size. Is it inches? Is it scaled somehow? ## Solution Add rustdoc comments.
This commit is contained in:
parent
fe68005f71
commit
cc2a77b5c5
@ -65,9 +65,12 @@ impl Default for Viewport {
|
|||||||
/// Information about the current [`RenderTarget`].
|
/// Information about the current [`RenderTarget`].
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Default, Debug, Clone)]
|
||||||
pub struct RenderTargetInfo {
|
pub struct RenderTargetInfo {
|
||||||
/// The physical size of this render target (ignores scale factor).
|
/// The physical size of this render target (in physical pixels, ignoring scale factor).
|
||||||
pub physical_size: UVec2,
|
pub physical_size: UVec2,
|
||||||
/// The scale factor of this render target.
|
/// The scale factor of this render target.
|
||||||
|
///
|
||||||
|
/// When rendering to a window, typically it is a value greater or equal than 1.0,
|
||||||
|
/// representing the ratio between the size of the window in physical pixels and the logical size of the window.
|
||||||
pub scale_factor: f32,
|
pub scale_factor: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +196,8 @@ impl Camera {
|
|||||||
.or_else(|| self.logical_target_size())
|
.or_else(|| self.logical_target_size())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The physical size of this camera's viewport. If the `viewport` field is set to [`Some`], this
|
/// The physical size of this camera's viewport (in physical pixels).
|
||||||
|
/// If the `viewport` field is set to [`Some`], this
|
||||||
/// will be the size of that custom viewport. Otherwise it will default to the full physical size of
|
/// will be the size of that custom viewport. Otherwise it will default to the full physical size of
|
||||||
/// the current [`RenderTarget`].
|
/// the current [`RenderTarget`].
|
||||||
/// For logic that requires the full physical size of the [`RenderTarget`], prefer [`Camera::physical_target_size`].
|
/// For logic that requires the full physical size of the [`RenderTarget`], prefer [`Camera::physical_target_size`].
|
||||||
@ -216,7 +220,8 @@ impl Camera {
|
|||||||
.and_then(|t| self.to_logical(t.physical_size))
|
.and_then(|t| self.to_logical(t.physical_size))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The full physical size of this camera's [`RenderTarget`], ignoring custom `viewport` configuration.
|
/// The full physical size of this camera's [`RenderTarget`] (in physical pixels),
|
||||||
|
/// ignoring custom `viewport` configuration.
|
||||||
/// Note that if the `viewport` field is [`Some`], this will not represent the size of the rendered area.
|
/// Note that if the `viewport` field is [`Some`], this will not represent the size of the rendered area.
|
||||||
/// For logic that requires the size of the actually rendered area, prefer [`Camera::physical_viewport_size`].
|
/// For logic that requires the size of the actually rendered area, prefer [`Camera::physical_viewport_size`].
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user