Skip to content

Commit 17ef731

Browse files
authored
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 #11109
1 parent 55c9958 commit 17ef731

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

crates/bevy_render/src/mesh/mesh/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,15 @@ impl Mesh {
139139
/// Texture coordinates for the vertex. Use in conjunction with [`Mesh::insert_attribute`]
140140
/// or [`Mesh::with_inserted_attribute`].
141141
///
142-
/// Values are generally between 0. and 1., with `StandardMaterial` and `ColorMaterial`
143-
/// `[0.,0.]` is the top left of the texture, and [1.,1.] the bottom-right.
144-
/// You usually want to only use values in that range, values outside will be
145-
/// clamped per pixel not for the vertex, "stretching" the borders of the texture.
142+
/// Generally `[0.,0.]` is mapped to the top left of the texture, and `[1.,1.]` to the bottom-right.
143+
///
144+
/// By default values outside will be clamped per pixel not for the vertex,
145+
/// "stretching" the borders of the texture.
146146
/// This behavior can be useful in some cases, usually when the borders have only
147147
/// one color, for example a logo, and you want to "extend" those borders.
148+
///
149+
/// For different mapping outside of `0..=1` range,
150+
/// see [`ImageAddressMode`](crate::texture::ImageAddressMode).
148151
pub const ATTRIBUTE_UV_0: MeshVertexAttribute =
149152
MeshVertexAttribute::new("Vertex_Uv", 2, VertexFormat::Float32x2);
150153

crates/bevy_render/src/texture/image.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ pub struct DefaultImageSampler(pub(crate) Sampler);
148148

149149
/// How edges should be handled in texture addressing.
150150
///
151+
/// See [`ImageSamplerDescriptor`] for information how to configure this.
152+
///
151153
/// This type mirrors [`wgpu::AddressMode`].
152154
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
153155
pub enum ImageAddressMode {

0 commit comments

Comments
 (0)