lib3mf_core/model/volumetric.rs
1use crate::model::ResourceId;
2use serde::{Deserialize, Serialize};
3
4/// Represents a stack of volumetric layers, defining a 3D volume via slices.
5/// Similar to SliceStack but typically implies raster/voxel data or implicit fields.
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct VolumetricStack {
8 /// Unique resource ID for this volumetric stack.
9 pub id: ResourceId,
10 /// Extension version string (e.g., `"1.0"`).
11 pub version: String, // e.g. "1.0"
12 /// Inline volumetric layers.
13 pub layers: Vec<VolumetricLayer>,
14 /// References to volumetric stacks in external model parts.
15 pub refs: Vec<VolumetricRef>,
16}
17
18/// A single volumetric layer at a specific Z height.
19#[derive(Debug, Clone, Default, Serialize, Deserialize)]
20pub struct VolumetricLayer {
21 /// Z-height of this layer in model units.
22 pub z_height: f32, // The Z-height of this layer
23 // Content can be an image path, or raw data reference.
24 // Spec usually uses image stack approach or field.
25 // We will use a flexible 'path' to resource (e.g. texture path).
26 /// Path to the content resource (e.g., a texture image path in the package).
27 pub content_path: String,
28}
29
30/// A reference to a volumetric stack in an external model part.
31#[derive(Debug, Clone, Default, Serialize, Deserialize)]
32pub struct VolumetricRef {
33 /// ID of the referenced volumetric stack.
34 pub stack_id: ResourceId,
35 /// Package path to the model part containing the referenced volumetric stack.
36 pub path: String, // Path to the other model file
37}