Very minor doc formatting changes (#5287)

# Objective

- Added a bunch of backticks to things that should have them, like equations, abstract variable names,
- Changed all small x, y, and z to capitals X, Y, Z.

This might be more annoying than helpful; Feel free to refuse this PR.
This commit is contained in:
CGMossa 2022-07-12 13:06:16 +00:00
parent a1d3f1b3b4
commit 93a131661d
22 changed files with 74 additions and 74 deletions

View File

@ -45,7 +45,7 @@ impl Default for Camera2dBundle {
} }
impl Camera2dBundle { impl Camera2dBundle {
/// Create an orthographic projection camera with a custom Z position. /// Create an orthographic projection camera with a custom `Z` position.
/// ///
/// The camera is placed at `Z=far-0.1`, looking toward the world origin `(0,0,0)`. /// The camera is placed at `Z=far-0.1`, looking toward the world origin `(0,0,0)`.
/// Its orthographic projection extends from `0.0` to `-far` in camera view space, /// Its orthographic projection extends from `0.0` to `-far` in camera view space,

View File

@ -793,7 +793,7 @@ impl<'w, T: Component> WorldQueryGats<'w> for &mut T {
type _State = ComponentIdState<T>; type _State = ComponentIdState<T>;
} }
/// SAFETY: component access and archetype component access are properly updated to reflect that T is /// SAFETY: component access and archetype component access are properly updated to reflect that `T` is
/// read and write /// read and write
unsafe impl<'w, T: Component> Fetch<'w> for WriteFetch<'w, T> { unsafe impl<'w, T: Component> Fetch<'w> for WriteFetch<'w, T> {
type Item = Mut<'w, T>; type Item = Mut<'w, T>;

View File

@ -515,10 +515,10 @@ impl<Q: WorldQuery, F: WorldQuery> QueryState<Q, F> {
/// Returns an [`Iterator`] over all possible combinations of `K` query results without repetition. /// Returns an [`Iterator`] over all possible combinations of `K` query results without repetition.
/// This can only be called for read-only queries. /// This can only be called for read-only queries.
/// ///
/// For permutations of size K of query returning N results, you will get: /// For permutations of size `K` of query returning `N` results, you will get:
/// - if K == N: one permutation of all query results /// - if `K == N`: one permutation of all query results
/// - if K < N: all possible K-sized combinations of query results, without repetition /// - if `K < N`: all possible `K`-sized combinations of query results, without repetition
/// - if K > N: empty set (no K-sized combinations exist) /// - if `K > N`: empty set (no `K`-sized combinations exist)
/// ///
/// This can only be called for read-only queries, see [`Self::iter_combinations_mut`] for /// This can only be called for read-only queries, see [`Self::iter_combinations_mut`] for
/// write-queries. /// write-queries.
@ -541,10 +541,10 @@ impl<Q: WorldQuery, F: WorldQuery> QueryState<Q, F> {
/// Iterates over all possible combinations of `K` query results for the given [`World`] /// Iterates over all possible combinations of `K` query results for the given [`World`]
/// without repetition. /// without repetition.
/// ///
/// For permutations of size K of query returning N results, you will get: /// For permutations of size `K` of query returning `N` results, you will get:
/// - if K == N: one permutation of all query results /// - if `K == N`: one permutation of all query results
/// - if K < N: all possible K-sized combinations of query results, without repetition /// - if `K < N`: all possible `K`-sized combinations of query results, without repetition
/// - if K > N: empty set (no K-sized combinations exist) /// - if `K > N`: empty set (no `K`-sized combinations exist)
#[inline] #[inline]
pub fn iter_combinations_mut<'w, 's, const K: usize>( pub fn iter_combinations_mut<'w, 's, const K: usize>(
&'s mut self, &'s mut self,

View File

@ -508,7 +508,7 @@ impl<T> SystemLabel for SystemTypeIdLabel<T> {
/// ///
/// // Unfortunately, we need all of these generics. `A` is the first system, with its /// // Unfortunately, we need all of these generics. `A` is the first system, with its
/// // parameters and marker type required for coherence. `B` is the second system, and /// // parameters and marker type required for coherence. `B` is the second system, and
/// // the other generics are for the input/output types of A and B. /// // the other generics are for the input/output types of `A` and `B`.
/// /// Chain creates a new system which calls `a`, then calls `b` with the output of `a` /// /// Chain creates a new system which calls `a`, then calls `b` with the output of `a`
/// pub fn chain<AIn, Shared, BOut, A, AParam, AMarker, B, BParam, BMarker>( /// pub fn chain<AIn, Shared, BOut, A, AParam, AMarker, B, BParam, BMarker>(
/// mut a: A, /// mut a: A,

View File

@ -334,10 +334,10 @@ impl<'w, 's, Q: WorldQuery, F: WorldQuery> Query<'w, 's, Q, F> {
/// Returns an [`Iterator`] over all possible combinations of `K` query results without repetition. /// Returns an [`Iterator`] over all possible combinations of `K` query results without repetition.
/// This can only return immutable data /// This can only return immutable data
/// ///
/// For permutations of size K of query returning N results, you will get: /// For permutations of size `K` of query returning `N` results, you will get:
/// - if K == N: one permutation of all query results /// - if `K == N`: one permutation of all query results
/// - if K < N: all possible K-sized combinations of query results, without repetition /// - if `K < N`: all possible `K`-sized combinations of query results, without repetition
/// - if K > N: empty set (no K-sized combinations exist) /// - if `K > N`: empty set (no `K`-sized combinations exist)
#[inline] #[inline]
pub fn iter_combinations<const K: usize>(&self) -> QueryCombinationIter<'_, '_, Q, F, K> { pub fn iter_combinations<const K: usize>(&self) -> QueryCombinationIter<'_, '_, Q, F, K> {
// SAFETY: system runs without conflicts with other systems. // SAFETY: system runs without conflicts with other systems.

View File

@ -10,8 +10,8 @@ use std::borrow::Cow;
/// A [`System`] that chains two systems together, creating a new system that routes the output of /// A [`System`] that chains two systems together, creating a new system that routes the output of
/// the first system into the input of the second system, yielding the output of the second system. /// the first system into the input of the second system, yielding the output of the second system.
/// ///
/// Given two systems A and B, A may be chained with B as `A.chain(B)` if the output type of A is /// Given two systems `A` and `B`, A may be chained with `B` as `A.chain(B)` if the output type of `A` is
/// equal to the input type of B. /// equal to the input type of `B`.
/// ///
/// Note that for [`FunctionSystem`](crate::system::FunctionSystem)s the output is the return value /// Note that for [`FunctionSystem`](crate::system::FunctionSystem)s the output is the return value
/// of the function and the input is the first [`SystemParam`](crate::system::SystemParam) if it is /// of the function and the input is the first [`SystemParam`](crate::system::SystemParam) if it is

View File

@ -280,9 +280,9 @@ pub enum ClusterFarZMode {
/// Configure the depth-slicing strategy for clustered forward rendering /// Configure the depth-slicing strategy for clustered forward rendering
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct ClusterZConfig { pub struct ClusterZConfig {
/// Far z plane of the first depth slice /// Far `Z` plane of the first depth slice
pub first_slice_depth: f32, pub first_slice_depth: f32,
/// Strategy for how to evaluate the far z plane of the furthest depth slice /// Strategy for how to evaluate the far `Z` plane of the furthest depth slice
pub far_z_mode: ClusterFarZMode, pub far_z_mode: ClusterFarZMode,
} }
@ -303,24 +303,24 @@ pub enum ClusterConfig {
/// One single cluster. Optimal for low-light complexity scenes or scenes where /// One single cluster. Optimal for low-light complexity scenes or scenes where
/// most lights affect the entire scene. /// most lights affect the entire scene.
Single, Single,
/// Explicit x, y and z counts (may yield non-square x/y clusters depending on the aspect ratio) /// Explicit `X`, `Y` and `Z` counts (may yield non-square `X/Y` clusters depending on the aspect ratio)
XYZ { XYZ {
dimensions: UVec3, dimensions: UVec3,
z_config: ClusterZConfig, z_config: ClusterZConfig,
/// Specify if clusters should automatically resize in x/y if there is a risk of exceeding /// Specify if clusters should automatically resize in `X/Y` if there is a risk of exceeding
/// the available cluster-light index limit /// the available cluster-light index limit
dynamic_resizing: bool, dynamic_resizing: bool,
}, },
/// Fixed number of z slices, x and y calculated to give square clusters /// Fixed number of `Z` slices, `X` and `Y` calculated to give square clusters
/// with at most total clusters. For top-down games where lights will generally always be within a /// with at most total clusters. For top-down games where lights will generally always be within a
/// short depth range, it may be useful to use this configuration with 1 or few z slices. This /// short depth range, it may be useful to use this configuration with 1 or few `Z` slices. This
/// would reduce the number of lights per cluster by distributing more clusters in screen space /// would reduce the number of lights per cluster by distributing more clusters in screen space
/// x/y which matches how lights are distributed in the scene. /// `X/Y` which matches how lights are distributed in the scene.
FixedZ { FixedZ {
total: u32, total: u32,
z_slices: u32, z_slices: u32,
z_config: ClusterZConfig, z_config: ClusterZConfig,
/// Specify if clusters should automatically resize in x/y if there is a risk of exceeding /// Specify if clusters should automatically resize in `X/Y` if there is a risk of exceeding
/// the available cluster-light index limit /// the available cluster-light index limit
dynamic_resizing: bool, dynamic_resizing: bool,
}, },
@ -329,7 +329,7 @@ pub enum ClusterConfig {
impl Default for ClusterConfig { impl Default for ClusterConfig {
fn default() -> Self { fn default() -> Self {
// 24 depth slices, square clusters with at most 4096 total clusters // 24 depth slices, square clusters with at most 4096 total clusters
// use max light distance as clusters max Z-depth, first slice extends to 5.0 // use max light distance as clusters max `Z`-depth, first slice extends to 5.0
Self::FixedZ { Self::FixedZ {
total: 4096, total: 4096,
z_slices: 24, z_slices: 24,
@ -412,7 +412,7 @@ impl ClusterConfig {
pub struct Clusters { pub struct Clusters {
/// Tile size /// Tile size
pub(crate) tile_size: UVec2, pub(crate) tile_size: UVec2,
/// Number of clusters in x / y / z in the view frustum /// Number of clusters in `X` / `Y` / `Z` in the view frustum
pub(crate) dimensions: UVec3, pub(crate) dimensions: UVec3,
/// Distance to the far plane of the first depth slice. The first depth slice is special /// Distance to the far plane of the first depth slice. The first depth slice is special
/// and explicitly-configured to avoid having unnecessarily many slices close to the camera. /// and explicitly-configured to avoid having unnecessarily many slices close to the camera.
@ -555,10 +555,10 @@ fn ndc_position_to_cluster(
const VEC2_HALF: Vec2 = Vec2::splat(0.5); const VEC2_HALF: Vec2 = Vec2::splat(0.5);
const VEC2_HALF_NEGATIVE_Y: Vec2 = Vec2::new(0.5, -0.5); const VEC2_HALF_NEGATIVE_Y: Vec2 = Vec2::new(0.5, -0.5);
// Calculate bounds for the light using a view space aabb. /// Calculate bounds for the light using a view space aabb.
// Returns a (Vec3, Vec3) containing min and max with /// Returns a `(Vec3, Vec3)` containing minimum and maximum with
// x and y in normalized device coordinates with range [-1, 1] /// `X` and `Y` in normalized device coordinates with range `[-1, 1]`
// z in view space, with range [-inf, -f32::MIN_POSITIVE] /// `Z` in view space, with range `[-inf, -f32::MIN_POSITIVE]`
fn cluster_space_light_aabb( fn cluster_space_light_aabb(
inverse_view_transform: Mat4, inverse_view_transform: Mat4,
projection_matrix: Mat4, projection_matrix: Mat4,

View File

@ -378,7 +378,7 @@ pub struct ExtractedClusterConfig {
/// Special near value for cluster calculations /// Special near value for cluster calculations
near: f32, near: f32,
far: f32, far: f32,
/// Number of clusters in x / y / z in the view frustum /// Number of clusters in `X` / `Y` / `Z` in the view frustum
dimensions: UVec3, dimensions: UVec3,
} }

View File

@ -314,7 +314,7 @@ pub enum DepthCalculation {
/// Pythagorean distance; works everywhere, more expensive to compute. /// Pythagorean distance; works everywhere, more expensive to compute.
#[default] #[default]
Distance, Distance,
/// Optimization for 2D; assuming the camera points towards -Z. /// Optimization for 2D; assuming the camera points towards `-Z`.
ZDifference, ZDifference,
} }

View File

@ -527,10 +527,10 @@ impl Color {
} }
} }
/// Converts Color to a u32 from sRGB colorspace. /// Converts `Color` to a `u32` from sRGB colorspace.
/// ///
/// Maps the RGBA channels in RGBA order to a little-endian byte array (GPUs are little-endian). /// Maps the RGBA channels in RGBA order to a little-endian byte array (GPUs are little-endian).
/// A will be the most significant byte and R the least significant. /// `A` will be the most significant byte and `R` the least significant.
pub fn as_rgba_u32(self: Color) -> u32 { pub fn as_rgba_u32(self: Color) -> u32 {
match self { match self {
Color::Rgba { Color::Rgba {
@ -576,7 +576,7 @@ impl Color {
/// Converts Color to a u32 from linear RGB colorspace. /// Converts Color to a u32 from linear RGB colorspace.
/// ///
/// Maps the RGBA channels in RGBA order to a little-endian byte array (GPUs are little-endian). /// Maps the RGBA channels in RGBA order to a little-endian byte array (GPUs are little-endian).
/// A will be the most significant byte and R the least significant. /// `A` will be the most significant byte and `R` the least significant.
pub fn as_linear_rgba_u32(self: Color) -> u32 { pub fn as_linear_rgba_u32(self: Color) -> u32 {
match self { match self {
Color::Rgba { Color::Rgba {

View File

@ -5,11 +5,11 @@ use wgpu::PrimitiveTopology;
/// A cylinder with hemispheres at the top and bottom /// A cylinder with hemispheres at the top and bottom
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct Capsule { pub struct Capsule {
/// Radius on the xz plane. /// Radius on the `XZ` plane.
pub radius: f32, pub radius: f32,
/// Number of sections in cylinder between hemispheres. /// Number of sections in cylinder between hemispheres.
pub rings: usize, pub rings: usize,
/// Height of the middle cylinder on the y axis, excluding the hemispheres. /// Height of the middle cylinder on the `Y` axis, excluding the hemispheres.
pub depth: f32, pub depth: f32,
/// Number of latitudes, distributed by inclination. Must be even. /// Number of latitudes, distributed by inclination. Must be even.
pub latitudes: usize, pub latitudes: usize,

View File

@ -114,7 +114,7 @@ impl From<Box> for Mesh {
} }
} }
/// A rectangle on the XY plane centered at the origin. /// A rectangle on the `XY` plane centered at the origin.
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct Quad { pub struct Quad {
/// Full width and height of the rectangle. /// Full width and height of the rectangle.
@ -167,7 +167,7 @@ impl From<Quad> for Mesh {
} }
} }
/// A square on the XZ plane centered at the origin. /// A square on the `XZ` plane centered at the origin.
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct Plane { pub struct Plane {
/// The total side length of the square. /// The total side length of the square.

View File

@ -1,10 +1,10 @@
use crate::mesh::{Indices, Mesh}; use crate::mesh::{Indices, Mesh};
use wgpu::PrimitiveTopology; use wgpu::PrimitiveTopology;
/// A regular polygon in the xy plane /// A regular polygon in the `XY` plane
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct RegularPolygon { pub struct RegularPolygon {
/// Inscribed radius in the xy plane. /// Inscribed radius in the `XY` plane.
pub radius: f32, pub radius: f32,
/// Number of sides. /// Number of sides.
pub sides: usize, pub sides: usize,
@ -20,7 +20,7 @@ impl Default for RegularPolygon {
} }
impl RegularPolygon { impl RegularPolygon {
/// Creates a regular polygon in the xy plane /// Creates a regular polygon in the `XY` plane
pub fn new(radius: f32, sides: usize) -> Self { pub fn new(radius: f32, sides: usize) -> Self {
Self { radius, sides } Self { radius, sides }
} }
@ -60,9 +60,9 @@ impl From<RegularPolygon> for Mesh {
} }
} }
/// A circle in the xy plane /// A circle in the `XY` plane
pub struct Circle { pub struct Circle {
/// Inscribed radius in the xy plane. /// Inscribed radius in the `XY` plane.
pub radius: f32, pub radius: f32,
/// The number of vertices used. /// The number of vertices used.
pub vertices: usize, pub vertices: usize,
@ -78,7 +78,7 @@ impl Default for Circle {
} }
impl Circle { impl Circle {
/// Creates a circle in the xy plane /// Creates a circle in the `XY` plane
pub fn new(radius: f32) -> Self { pub fn new(radius: f32) -> Self {
Self { Self {
radius, radius,

View File

@ -81,8 +81,8 @@ impl Sphere {
} }
/// A plane defined by a unit normal and distance from the origin along the normal /// A plane defined by a unit normal and distance from the origin along the normal
/// Any point p is in the plane if n.p + d = 0 /// Any point `p` is in the plane if `n.p + d = 0`
/// For planes defining half-spaces such as for frusta, if n.p + d > 0 then p is on /// For planes defining half-spaces such as for frusta, if `n.p + d > 0` then `p` is on
/// the positive side (inside) of the plane. /// the positive side (inside) of the plane.
#[derive(Clone, Copy, Debug, Default)] #[derive(Clone, Copy, Debug, Default)]
pub struct Plane { pub struct Plane {

View File

@ -14,7 +14,7 @@ impl ViewRangefinder3d {
} }
} }
/// Calculates the distance, or view-space Z value, for a transform /// Calculates the distance, or view-space `Z` value, for a transform
#[inline] #[inline]
pub fn distance(&self, transform: &Mat4) -> f32 { pub fn distance(&self, transform: &Mat4) -> f32 {
// NOTE: row 2 of the inverse view matrix dotted with column 3 of the model matrix // NOTE: row 2 of the inverse view matrix dotted with column 3 of the model matrix

View File

@ -8,9 +8,9 @@ use bevy_render::color::Color;
pub struct Sprite { pub struct Sprite {
/// The sprite's color tint /// The sprite's color tint
pub color: Color, pub color: Color,
/// Flip the sprite along the X axis /// Flip the sprite along the `X` axis
pub flip_x: bool, pub flip_x: bool,
/// Flip the sprite along the Y axis /// Flip the sprite along the `Y` axis
pub flip_y: bool, pub flip_y: bool,
/// An optional custom size for the sprite that will be used when rendering, instead of the size /// An optional custom size for the sprite that will be used when rendering, instead of the size
/// of the sprite's image /// of the sprite's image

View File

@ -14,8 +14,8 @@ use crate::Task;
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
#[must_use] #[must_use]
pub struct TaskPoolBuilder { pub struct TaskPoolBuilder {
/// If set, we'll set up the thread pool to use at most n threads. Otherwise use /// If set, we'll set up the thread pool to use at most `num_threads` threads.
/// the logical core count of the system /// Otherwise use the logical core count of the system
num_threads: Option<usize>, num_threads: Option<usize>,
/// If set, we'll use the given stack size rather than the system default /// If set, we'll use the given stack size rather than the system default
stack_size: Option<usize>, stack_size: Option<usize>,

View File

@ -138,7 +138,7 @@ impl GlobalTransform {
Affine3A::from_scale_rotation_translation(self.scale, self.rotation, self.translation) Affine3A::from_scale_rotation_translation(self.scale, self.rotation, self.translation)
} }
/// Get the unit vector in the local x direction /// Get the unit vector in the local `X` direction
#[inline] #[inline]
pub fn local_x(&self) -> Vec3 { pub fn local_x(&self) -> Vec3 {
self.rotation * Vec3::X self.rotation * Vec3::X
@ -156,7 +156,7 @@ impl GlobalTransform {
self.local_x() self.local_x()
} }
/// Get the unit vector in the local y direction /// Get the unit vector in the local `Y` direction
#[inline] #[inline]
pub fn local_y(&self) -> Vec3 { pub fn local_y(&self) -> Vec3 {
self.rotation * Vec3::Y self.rotation * Vec3::Y
@ -174,7 +174,7 @@ impl GlobalTransform {
-self.local_y() -self.local_y()
} }
/// Get the unit vector in the local z direction /// Get the unit vector in the local `Z` direction
#[inline] #[inline]
pub fn local_z(&self) -> Vec3 { pub fn local_z(&self) -> Vec3 {
self.rotation * Vec3::Z self.rotation * Vec3::Z

View File

@ -101,7 +101,7 @@ impl Transform {
} }
/// Updates and returns this [`Transform`] by rotating it so that its unit vector in the /// Updates and returns this [`Transform`] by rotating it so that its unit vector in the
/// local z direction is toward `target` and its unit vector in the local y direction /// local `Z` direction is toward `target` and its unit vector in the local `Y` direction
/// is toward `up`. /// is toward `up`.
#[inline] #[inline]
#[must_use] #[must_use]
@ -141,7 +141,7 @@ impl Transform {
Mat4::from_scale_rotation_translation(self.scale, self.rotation, self.translation) Mat4::from_scale_rotation_translation(self.scale, self.rotation, self.translation)
} }
/// Get the unit vector in the local x direction. /// Get the unit vector in the local `X` direction.
#[inline] #[inline]
pub fn local_x(&self) -> Vec3 { pub fn local_x(&self) -> Vec3 {
self.rotation * Vec3::X self.rotation * Vec3::X
@ -159,7 +159,7 @@ impl Transform {
self.local_x() self.local_x()
} }
/// Get the unit vector in the local y direction. /// Get the unit vector in the local `Y` direction.
#[inline] #[inline]
pub fn local_y(&self) -> Vec3 { pub fn local_y(&self) -> Vec3 {
self.rotation * Vec3::Y self.rotation * Vec3::Y
@ -177,7 +177,7 @@ impl Transform {
-self.local_y() -self.local_y()
} }
/// Get the unit vector in the local z direction. /// Get the unit vector in the local `Z` direction.
#[inline] #[inline]
pub fn local_z(&self) -> Vec3 { pub fn local_z(&self) -> Vec3 {
self.rotation * Vec3::Z self.rotation * Vec3::Z
@ -209,7 +209,7 @@ impl Transform {
self.rotate(Quat::from_axis_angle(axis, angle)); self.rotate(Quat::from_axis_angle(axis, angle));
} }
/// Rotates this [`Transform`] around the X axis by `angle` (in radians). /// Rotates this [`Transform`] around the `X` axis by `angle` (in radians).
/// ///
/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. /// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent.
#[inline] #[inline]
@ -217,7 +217,7 @@ impl Transform {
self.rotate(Quat::from_rotation_x(angle)); self.rotate(Quat::from_rotation_x(angle));
} }
/// Rotates this [`Transform`] around the Y axis by `angle` (in radians). /// Rotates this [`Transform`] around the `Y` axis by `angle` (in radians).
/// ///
/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. /// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent.
#[inline] #[inline]
@ -225,7 +225,7 @@ impl Transform {
self.rotate(Quat::from_rotation_y(angle)); self.rotate(Quat::from_rotation_y(angle));
} }
/// Rotates this [`Transform`] around the Z axis by `angle` (in radians). /// Rotates this [`Transform`] around the `Z` axis by `angle` (in radians).
/// ///
/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. /// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent.
#[inline] #[inline]
@ -233,19 +233,19 @@ impl Transform {
self.rotate(Quat::from_rotation_z(angle)); self.rotate(Quat::from_rotation_z(angle));
} }
/// Rotates this [`Transform`] around its X axis by `angle` (in radians). /// Rotates this [`Transform`] around its `X` axis by `angle` (in radians).
#[inline] #[inline]
pub fn rotate_local_x(&mut self, angle: f32) { pub fn rotate_local_x(&mut self, angle: f32) {
self.rotate_axis(self.local_x(), angle); self.rotate_axis(self.local_x(), angle);
} }
/// Rotates this [`Transform`] around its Y axis by `angle` (in radians). /// Rotates this [`Transform`] around its `Y` axis by `angle` (in radians).
#[inline] #[inline]
pub fn rotate_local_y(&mut self, angle: f32) { pub fn rotate_local_y(&mut self, angle: f32) {
self.rotate_axis(self.local_y(), angle); self.rotate_axis(self.local_y(), angle);
} }
/// Rotates this [`Transform`] around its Z axis by `angle` (in radians). /// Rotates this [`Transform`] around its `Z` axis by `angle` (in radians).
#[inline] #[inline]
pub fn rotate_local_z(&mut self, angle: f32) { pub fn rotate_local_z(&mut self, angle: f32) {
self.rotate_axis(self.local_z(), angle); self.rotate_axis(self.local_z(), angle);
@ -260,8 +260,8 @@ impl Transform {
self.rotation *= rotation; self.rotation *= rotation;
} }
/// Rotates this [`Transform`] so that its local negative z direction is toward /// Rotates this [`Transform`] so that its local negative `Z` direction is toward
/// `target` and its local y direction is toward `up`. /// `target` and its local `Y` direction is toward `up`.
#[inline] #[inline]
pub fn look_at(&mut self, target: Vec3, up: Vec3) { pub fn look_at(&mut self, target: Vec3, up: Vec3) {
let forward = Vec3::normalize(self.translation - target); let forward = Vec3::normalize(self.translation - target);

View File

@ -13,10 +13,10 @@ use bevy_math::Vec2;
use bevy_sprite::Rect; use bevy_sprite::Rect;
use bevy_transform::components::{GlobalTransform, Transform}; use bevy_transform::components::{GlobalTransform, Transform};
/// The resolution of Z values for UI /// The resolution of `Z` values for UI
pub const UI_Z_STEP: f32 = 0.001; pub const UI_Z_STEP: f32 = 0.001;
/// Updates transforms of nodes to fit with the z system /// Updates transforms of nodes to fit with the `Z` system
pub fn ui_z_system( pub fn ui_z_system(
root_node_query: Query<Entity, (With<Node>, Without<Parent>)>, root_node_query: Query<Entity, (With<Node>, Without<Parent>)>,
mut node_query: Query<&mut Transform, With<Node>>, mut node_query: Query<&mut Transform, With<Node>>,

View File

@ -44,9 +44,9 @@ struct RotateToPlayer {
/// ///
/// The Bevy coordinate system is the same for 2D and 3D, in terms of 2D this means that: /// The Bevy coordinate system is the same for 2D and 3D, in terms of 2D this means that:
/// ///
/// * X axis goes from left to right (+X points right) /// * `X` axis goes from left to right (`+X` points right)
/// * Y axis goes from bottom to top (+Y point up) /// * `Y` axis goes from bottom to top (`+Y` point up)
/// * Z axis goes from far to near (+Z points towards you, out of the screen) /// * `Z` axis goes from far to near (`+Z` points towards you, out of the screen)
/// ///
/// The origin is at the center of the screen. /// The origin is at the center of the screen.
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {

View File

@ -12,7 +12,7 @@ fn main() {
.run(); .run();
} }
/// This system prints when Ctrl + Shift + A is pressed /// This system prints when `Ctrl + Shift + A` is pressed
fn keyboard_input_system(input: Res<Input<KeyCode>>) { fn keyboard_input_system(input: Res<Input<KeyCode>>) {
let shift = input.any_pressed([KeyCode::LShift, KeyCode::RShift]); let shift = input.any_pressed([KeyCode::LShift, KeyCode::RShift]);
let ctrl = input.any_pressed([KeyCode::LControl, KeyCode::RControl]); let ctrl = input.any_pressed([KeyCode::LControl, KeyCode::RControl]);