Repository: bevyengine/bevy
File: crates/bevy_mesh/src/primitives/dim3/plane.rs (Rust)

Code before:
use crate::{Indices, Mesh, MeshBuilder, Meshable, PrimitiveTopology};
use bevy_asset::RenderAssetUsages;
use bevy_math::{primitives::Plane3d, Dir3, Quat, Vec2, Vec3};
use bevy_reflect::prelude::*;

/// A builder used for creating a [`Mesh`] with a [`Plane3d`] shape.
#[derive(Clone, Copy, Debug, Default, Reflect)]
#[reflect(Default, Debug, Clone)]
pub struct PlaneMeshBuilder {
    /// The [`Plane3d`] shape.
    pub plane: Plane3d,
    /// The number of subdivisions in the mesh.
    ///
    /// 0 - is the original plane geometry, the 4 points in the XZ plane.
    ///
    /// 1 - adds a vertex in the middle of the X axis, resulting in a plane with 2 quads / 4 triangles, and a new edge along the Z axis.
    ///
    /// 2 - adds 2 vertices along the X axis, resulting in a plane with 3 quads / 6 triangles.
    ///
    /// and so on...
    pub subdivisions_x: u32,

    /// The number of subdivisions in the mesh.
    ///
    /// 0 - is the original plane geometry, the 4 points in the XZ plane.
    ///
    /// 1 - adds a vertex in the middle of the Z axis, resulting in a plane with 2 quads / 4 triangles, and a new edge along the X axis.
    ///
    /// 2 - adds 2 vertices along the Z axis, resulting in a plane with 3 quads / 6 triangles.
    ///
    /// and so on...
    pub subdivisions_z: u32,
}

impl PlaneMeshBuilder {
    /// Creates a new [`PlaneMeshBuilder`] from a given normal and size.
    #[inline]
    pub fn new(normal: Dir3, size: Vec2) -> Self {
        Self {
            plane: Plane3d {
                normal,
                half_size: size / 2.0,
            },
            subdivisions_x: 0,
            subdivisions_z: 0,
        }
    }


Review comment (suggestion):
```suggestion
    /// The number of subdivisions in the mesh along the Z axis.
```

Code after:
use crate::{Indices, Mesh, MeshBuilder, Meshable, PrimitiveTopology};
use bevy_asset::RenderAssetUsages;
use bevy_math::{primitives::Plane3d, Dir3, Quat, Vec2, Vec3};
use bevy_reflect::prelude::*;

/// A builder used for creating a [`Mesh`] with a [`Plane3d`] shape.
#[derive(Clone, Copy, Debug, Default, Reflect)]
#[reflect(Default, Debug, Clone)]
pub struct PlaneMeshBuilder {
    /// The [`Plane3d`] shape.
    pub plane: Plane3d,
    /// The number of subdivisions along the X axis.
    ///
    /// 0 - is the original plane geometry, the 4 points in the XZ plane.
    ///
    /// 1 - adds a vertex in the middle of the X axis, resulting in a plane with 2 quads / 4 triangles, and a new edge along the Z axis.
    ///
    /// 2 - adds 2 vertices along the X axis, resulting in a plane with 3 quads / 6 triangles.
    ///
    /// and so on...
    pub subdivisions_x: u32,

    /// The number of subdivisions along the Z axis.
    ///
    /// 0 - is the original plane geometry, the 4 points in the XZ plane.
    ///
    /// 1 - adds a vertex in the middle of the Z axis, resulting in a plane with 2 quads / 4 triangles, and a new edge along the X axis.
    ///
    /// 2 - adds 2 vertices along the Z axis, resulting in a plane with 3 quads / 6 triangles.
    ///
    /// and so on...
    pub subdivisions_z: u32,
}

impl PlaneMeshBuilder {
    /// Creates a new [`PlaneMeshBuilder`] from a given normal and size.
    #[inline]
    pub fn new(normal: Dir3, size: Vec2) -> Self {
        Self {
            plane: Plane3d {
                normal,
                half_size: size / 2.0,
            },
            subdivisions_x: 0,
            subdivisions_z: 0,
        }
    }