Skip to main content

euv_core/game/engine3d/texture/
struct.rs

1use super::*;
2
3/// Sampler filtering and addressing configuration matching a glTF 2.0 sampler object.
4#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, New, PartialEq)]
5pub struct TextureSampler3D {
6    /// Magnification filter applied when texels cover multiple pixels.
7    #[get(type(copy))]
8    pub(crate) mag_filter: TextureFilterMode,
9    /// Minification filter applied when multiple texels project into one pixel.
10    #[get(type(copy))]
11    pub(crate) min_filter: TextureFilterMode,
12    /// Horizontal (`U` / `S`) coordinate wrap mode.
13    #[get(type(copy))]
14    pub(crate) wrap_s: TextureWrapMode,
15    /// Vertical (`V` / `T`) coordinate wrap mode.
16    #[get(type(copy))]
17    pub(crate) wrap_t: TextureWrapMode,
18}
19
20/// Single mipmap level storing packed RGBA8 texels.
21#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
22pub struct TextureMipLevel3D {
23    /// Mip level width in texels.
24    #[get(type(copy))]
25    pub(crate) width: u32,
26    /// Mip level height in texels.
27    #[get(type(copy))]
28    pub(crate) height: u32,
29    /// Packed RGBA8 texels (`width * height * 4` bytes).
30    pub(crate) pixels: Vec<u8>,
31}
32
33/// Mipmapped 3D texture asset decoded from embedded or external Blender/glTF images.
34#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
35pub struct Texture2D3D {
36    /// Human-readable texture or image name.
37    pub(crate) name: String,
38    /// Base `LOD0` width in texels.
39    #[get(type(copy))]
40    pub(crate) width: u32,
41    /// Base `LOD0` height in texels.
42    #[get(type(copy))]
43    pub(crate) height: u32,
44    /// Color-space interpretation controlling mip filtering and shader decode.
45    #[get(type(copy))]
46    pub(crate) color_space: TextureColorSpace,
47    /// Sampler wrap and filter configuration.
48    #[get(type(copy))]
49    pub(crate) sampler: TextureSampler3D,
50    /// Ordered mipmap chain starting at full resolution (`mips[0]`).
51    pub(crate) mips: Vec<TextureMipLevel3D>,
52}