Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support anisotropic filtering and for limiting the maximum number of mipmaps #41

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/texture/texture2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Interpolation>,
/// Specifies the maximum number of mipmaps that can be created for this texture.
pub mip_map_limit: Option<u32>,
/// 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<u32>,
}

impl Default for Texture2D {
Expand All @@ -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,
}
}
}
6 changes: 6 additions & 0 deletions src/texture/texture3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Interpolation>,
/// Specifies the maximum number of mipmaps that can be created for this texture.
pub mip_map_limit: Option<u32>,
/// 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<u32>,
}

impl Default for Texture3D {
Expand All @@ -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,
}
}
}