Fix Mesh::ATTRIBUTE_UV_0 documentation (#11110)

Comment incorrect suggests that texture is clamped outside of `0..=1`
range, while it can actually be configured.

CC https://github.com/bevyengine/bevy/pull/11109
This commit is contained in:
Stepan Koltsov 2024-01-01 16:58:48 +00:00 committed by GitHub
parent 55c9958dd0
commit 17ef73199b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -139,12 +139,15 @@ impl Mesh {
/// Texture coordinates for the vertex. Use in conjunction with [`Mesh::insert_attribute`] /// Texture coordinates for the vertex. Use in conjunction with [`Mesh::insert_attribute`]
/// or [`Mesh::with_inserted_attribute`]. /// or [`Mesh::with_inserted_attribute`].
/// ///
/// Values are generally between 0. and 1., with `StandardMaterial` and `ColorMaterial` /// Generally `[0.,0.]` is mapped to the top left of the texture, and `[1.,1.]` to the bottom-right.
/// `[0.,0.]` is the top left of the texture, and [1.,1.] the bottom-right. ///
/// You usually want to only use values in that range, values outside will be /// By default values outside will be clamped per pixel not for the vertex,
/// clamped per pixel not for the vertex, "stretching" the borders of the texture. /// "stretching" the borders of the texture.
/// This behavior can be useful in some cases, usually when the borders have only /// This behavior can be useful in some cases, usually when the borders have only
/// one color, for example a logo, and you want to "extend" those borders. /// one color, for example a logo, and you want to "extend" those borders.
///
/// For different mapping outside of `0..=1` range,
/// see [`ImageAddressMode`](crate::texture::ImageAddressMode).
pub const ATTRIBUTE_UV_0: MeshVertexAttribute = pub const ATTRIBUTE_UV_0: MeshVertexAttribute =
MeshVertexAttribute::new("Vertex_Uv", 2, VertexFormat::Float32x2); MeshVertexAttribute::new("Vertex_Uv", 2, VertexFormat::Float32x2);

View File

@ -148,6 +148,8 @@ pub struct DefaultImageSampler(pub(crate) Sampler);
/// How edges should be handled in texture addressing. /// How edges should be handled in texture addressing.
/// ///
/// See [`ImageSamplerDescriptor`] for information how to configure this.
///
/// This type mirrors [`wgpu::AddressMode`]. /// This type mirrors [`wgpu::AddressMode`].
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
pub enum ImageAddressMode { pub enum ImageAddressMode {