three_d_asset/volume.rs
1//!
2//! Contain volume asset definitions.
3//!
4pub use crate::prelude::*;
5#[doc(inline)]
6pub use crate::texture::texture3d::*;
7
8///
9/// Volume data consisting of voxel data inside a cube.
10///
11#[derive(Debug)]
12#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
13pub struct VoxelGrid {
14 /// Name.
15 pub name: String,
16
17 /// Voxel data, ie. small cubes in 3D (analogue to pixels in 2D) that contain 1-4 values.
18 pub voxels: Texture3D,
19
20 /// The size of the cube that is spanned by the voxel data.
21 pub size: Vec3,
22}
23
24impl std::default::Default for VoxelGrid {
25 fn default() -> Self {
26 Self {
27 name: String::default(),
28 voxels: Texture3D::default(),
29 size: Vec3::new(2.0, 2.0, 2.0),
30 }
31 }
32}