three_d_asset/texture/texture3d.rs
1#[doc(inline)]
2pub use super::{Interpolation, Mipmap, TextureData, Wrapping};
3
4///
5/// A CPU-side version of a 3D texture.
6///
7#[derive(Clone, Debug)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9pub struct Texture3D {
10 /// Name of this texture.
11 pub name: String,
12 /// The pixel data for the image
13 pub data: TextureData,
14 /// The width of the image
15 pub width: u32,
16 /// The height of the image
17 pub height: u32,
18 /// The depth of the image
19 pub depth: u32,
20 /// The way the pixel data is interpolated when the texture is far away
21 pub min_filter: Interpolation,
22 /// The way the pixel data is interpolated when the texture is close
23 pub mag_filter: Interpolation,
24 /// Specifies the [Mipmap] settings for this texture. If this is `None`, no mipmaps are created.
25 pub mipmap: Option<Mipmap>,
26 /// Determines how the texture is sampled outside the [0..1] s coordinate range (the first value of the uvw coordinates).
27 pub wrap_s: Wrapping,
28 /// Determines how the texture is sampled outside the [0..1] t coordinate range (the second value of the uvw coordinates).
29 pub wrap_t: Wrapping,
30 /// Determines how the texture is sampled outside the [0..1] r coordinate range (the third value of the uvw coordinates).
31 pub wrap_r: Wrapping,
32}
33
34impl Default for Texture3D {
35 fn default() -> Self {
36 Self {
37 name: "default".to_owned(),
38 data: TextureData::RgbaU8(vec![[0, 0, 0, 0]]),
39 width: 1,
40 height: 1,
41 depth: 1,
42 min_filter: Interpolation::Linear,
43 mag_filter: Interpolation::Linear,
44 mipmap: None,
45 wrap_s: Wrapping::Repeat,
46 wrap_t: Wrapping::Repeat,
47 wrap_r: Wrapping::Repeat,
48 }
49 }
50}