Skip to main content

sim_engine/renderer/mesh3d/texture/
options.rs

1use super::TextureMipmaps3d;
2
3/// Explicit creation policy for independently filtered 3D RGBA8 images.
4#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
5pub struct Texture3dOptions {
6    mipmaps: TextureMipmaps3d,
7    preserve_alpha: bool,
8}
9impl Texture3dOptions {
10    /// Preserves legacy opaque source pixels and a single mip level.
11    pub const fn new() -> Self {
12        Self {
13            mipmaps: TextureMipmaps3d::None,
14            preserve_alpha: false,
15        }
16    }
17    /// Selects bounded complete-chain generation; packed tiles are not isolated automatically.
18    pub const fn with_mipmaps(mut self, mipmaps: TextureMipmaps3d) -> Self {
19        self.mipmaps = mipmaps;
20        self
21    }
22    /// Accepts arbitrary straight alpha rather than requiring alpha 255.
23    pub const fn with_alpha_preservation(mut self, preserve: bool) -> Self {
24        self.preserve_alpha = preserve;
25        self
26    }
27    /// Returns the retained complete-image mip policy.
28    pub const fn mipmaps(self) -> TextureMipmaps3d {
29        self.mipmaps
30    }
31    /// Whether alpha values other than 255 are accepted and retained.
32    pub const fn preserves_alpha(self) -> bool {
33        self.preserve_alpha
34    }
35}