From f4ff1af49b83ea163ad51b8972cac50d8dfa269d Mon Sep 17 00:00:00 2001 From: Ivo Worms Date: Fri, 25 Oct 2024 21:49:25 +0200 Subject: [PATCH] Add support anisotropic filtering and for limiting the maximum number of mipmaps --- src/texture/texture2d.rs | 6 ++++++ src/texture/texture3d.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/texture/texture2d.rs b/src/texture/texture2d.rs index ee73352..87a36b2 100644 --- a/src/texture/texture2d.rs +++ b/src/texture/texture2d.rs @@ -21,10 +21,14 @@ pub struct Texture2D { pub mag_filter: Interpolation, /// Specifies whether mipmaps should be created for this texture and what type of interpolation to use between the two closest mipmaps. pub mip_map_filter: Option, + /// Specifies the maximum number of mipmaps that can be created for this texture. + pub mip_map_limit: Option, /// Determines how the texture is sampled outside the [0..1] s coordinate range (the first value of the uv coordinates). pub wrap_s: Wrapping, /// Determines how the texture is sampled outside the [0..1] t coordinate range (the second value of the uv coordinates). pub wrap_t: Wrapping, + /// Specifies the level of anisotropic filtering to be applied. + pub anisotropic_filter: Option, } impl Default for Texture2D { @@ -37,8 +41,10 @@ impl Default for Texture2D { min_filter: Interpolation::Linear, mag_filter: Interpolation::Linear, mip_map_filter: Some(Interpolation::Linear), + mip_map_limit: None, wrap_s: Wrapping::Repeat, wrap_t: Wrapping::Repeat, + anisotropic_filter: None, } } } diff --git a/src/texture/texture3d.rs b/src/texture/texture3d.rs index 853df2a..f697bdb 100644 --- a/src/texture/texture3d.rs +++ b/src/texture/texture3d.rs @@ -23,12 +23,16 @@ pub struct Texture3D { pub mag_filter: Interpolation, /// Specifies whether mipmaps should be created for this texture and what type of interpolation to use between the two closest mipmaps. pub mip_map_filter: Option, + /// Specifies the maximum number of mipmaps that can be created for this texture. + pub mip_map_limit: Option, /// Determines how the texture is sampled outside the [0..1] s coordinate range (the first value of the uvw coordinates). pub wrap_s: Wrapping, /// Determines how the texture is sampled outside the [0..1] t coordinate range (the second value of the uvw coordinates). pub wrap_t: Wrapping, /// Determines how the texture is sampled outside the [0..1] r coordinate range (the third value of the uvw coordinates). pub wrap_r: Wrapping, + /// Specifies the level of anisotropic filtering to be applied. + pub anisotropic_filter: Option, } impl Default for Texture3D { @@ -42,9 +46,11 @@ impl Default for Texture3D { min_filter: Interpolation::Linear, mag_filter: Interpolation::Linear, mip_map_filter: Some(Interpolation::Linear), + mip_map_limit: None, wrap_s: Wrapping::Repeat, wrap_t: Wrapping::Repeat, wrap_r: Wrapping::Repeat, + anisotropic_filter: None, } } }