From 17ef73199b1ce68e0c1520f5b17ad9714d1ec7e3 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Mon, 1 Jan 2024 16:58:48 +0000 Subject: [PATCH] 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 --- crates/bevy_render/src/mesh/mesh/mod.rs | 11 +++++++---- crates/bevy_render/src/texture/image.rs | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index 84ff716c01eaf..84e8b3fc76b82 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -139,12 +139,15 @@ impl Mesh { /// Texture coordinates for the vertex. Use in conjunction with [`Mesh::insert_attribute`] /// or [`Mesh::with_inserted_attribute`]. /// - /// Values are generally between 0. and 1., with `StandardMaterial` and `ColorMaterial` - /// `[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 - /// clamped per pixel not for the vertex, "stretching" the borders of the texture. + /// Generally `[0.,0.]` is mapped to the top left of the texture, and `[1.,1.]` to the bottom-right. + /// + /// By default values outside will be clamped per pixel not for the vertex, + /// "stretching" the borders of the texture. /// 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. + /// + /// For different mapping outside of `0..=1` range, + /// see [`ImageAddressMode`](crate::texture::ImageAddressMode). pub const ATTRIBUTE_UV_0: MeshVertexAttribute = MeshVertexAttribute::new("Vertex_Uv", 2, VertexFormat::Float32x2); diff --git a/crates/bevy_render/src/texture/image.rs b/crates/bevy_render/src/texture/image.rs index 83a7a6a631817..c3b8cc876c30a 100644 --- a/crates/bevy_render/src/texture/image.rs +++ b/crates/bevy_render/src/texture/image.rs @@ -148,6 +148,8 @@ pub struct DefaultImageSampler(pub(crate) Sampler); /// How edges should be handled in texture addressing. /// +/// See [`ImageSamplerDescriptor`] for information how to configure this. +/// /// This type mirrors [`wgpu::AddressMode`]. #[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)] pub enum ImageAddressMode {