1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
use *;
/// 8-byte binary magic signature identifying `.euv3d` baked asset packages.
pub const EUV3D_MAGIC: = *b"EUV3D\0\0\0";
/// Current `.euv3d` binary format specification version.
pub const EUV3D_FORMAT_VERSION: u32 = 1;
/// Quantized `.euv3d` v2 binary format version featuring 24-byte vertices and mip-tail-first streaming sections.
pub const EUV3D_FORMAT_VERSION_V2: u32 = 2;
/// Fixed byte length of the `.euv3d` file header.
pub const EUV3D_HEADER_BYTES: usize = 64;
/// Fixed byte length of each `.euv3d` section directory entry.
pub const EUV3D_SECTION_ENTRY_BYTES: usize = 32;
/// Mandatory power-of-two byte alignment for every `.euv3d` payload section (cache-line & GPU-buffer friendly).
pub const EUV3D_SECTION_ALIGNMENT: usize = 64;
/// Maximum unique vertices permitted inside a single spatial meshlet cluster.
pub const EUV3D_MESHLET_MAX_VERTS: usize = 64;
/// Maximum triangles permitted inside a single spatial meshlet cluster.
pub const EUV3D_MESHLET_MAX_TRIS: usize = 124;
/// Default number of Garland-Heckbert QEM LOD levels generated during baking (`LOD0..LOD3`).
pub const EUV3D_DEFAULT_LOD_LEVELS: usize = 4;
/// Default relative triangle budgets for `LOD0` through `LOD3`.
pub const EUV3D_LOD_RATIOS: = ;
/// Maximum triangles permitted inside a single `.euv3d` v2 cache-friendly meshlet cluster (`64`).
pub const EUV3D_V2_MESHLET_MAX_TRIS: usize = 64;
/// Maximum texture dimension (width and height) placed in the contiguous `.euv3d` v2 mip-tail superblock (`32x32..1x1`).
pub const EUV3D_V2_MIP_TAIL_MAX_DIM: u32 = 32;
/// Packed binary stride in bytes of a single `.euv3d` v2 `QuantizedVertex3D` (`24` bytes).
pub const EUV3D_V2_VERTEX_STRIDE_BYTES: usize = 24;
/// Packed binary stride in bytes of a single `.euv3d` v2 `QuantizedSkinVertex3D` (`16` bytes).
pub const EUV3D_V2_SKIN_STRIDE_BYTES: usize = 16;
/// Packed binary stride in bytes of a single `.euv3d` v2 cache-line `QuantizedMeshlet3D` (`64` bytes).
pub const EUV3D_V2_MESHLET_STRIDE_BYTES: usize = 64;
/// Header flag bit indicating pre-baked BVH4 acceleration sections are present.
pub const EUV3D_FLAG_HAS_BVH4: u32 = 1 << 0;
/// Header flag bit indicating spatial meshlet sections are present.
pub const EUV3D_FLAG_HAS_MESHLETS: u32 = 1 << 1;
/// Header flag bit indicating QEM LOD chain records are present.
pub const EUV3D_FLAG_HAS_LODS: u32 = 1 << 2;
/// Header flag bit indicating `.euv3d` v2 quantized 24B vertices and 16B skins are stored.
pub const EUV3D_FLAG_QUANTIZED_V2: u32 = 1 << 3;
/// Header flag bit indicating `.euv3d` v2 mip-tail-first streamable textures are stored.
pub const EUV3D_FLAG_MIP_TAIL_FIRST: u32 = 1 << 4;
/// `QuantizedVertex3D::pad_flags` bit indicating negative tangent handedness sign (`w < 0.0`).
pub const QUANTIZED_FLAG_TANGENT_NEG_W: u16 = 1 << 8;
/// Penalty weight applied to open boundary planes during QEM simplification to preserve mesh borders.
pub const EUV3D_BOUNDARY_WEIGHT: f64 = 16.0;
/// Minimum matrix determinant magnitude required to invert a 3x3 QEM quadric system directly.
pub const EUV3D_QEM_EPSILON: f64 = 1e-12;
/// Minimum normal dot product required to accept an edge collapse without flipping adjacent triangles.
pub const EUV3D_NORMAL_FLIP_MIN_DOT: f32 = 0.05;
/// Packed binary stride in bytes of a single serialized `Vertex3D`.
pub const EUV3D_VERTEX_STRIDE_BYTES: usize = 64;
/// Packed binary stride in bytes of a single serialized triangle index triplet `[u32; 3]`.
pub const EUV3D_INDEX_TRI_BYTES: usize = 12;
/// Packed binary stride in bytes of a single serialized `MeshSkinInfluence3D`.
pub const EUV3D_SKIN_STRIDE_BYTES: usize = 48;
/// Packed binary stride in bytes of a single serialized `Meshlet3D`.
pub const EUV3D_MESHLET_STRIDE_BYTES: usize = 52;
/// Packed binary stride in bytes of a single serialized 128-byte `Bvh4Node`.
pub const EUV3D_BVH4_NODE_STRIDE_BYTES: usize = 128;
/// Packed binary stride in bytes of a single serialized 160-byte `BvhTri4` packet.
pub const EUV3D_BVH_TRI4_STRIDE_BYTES: usize = 160;
/// Packed binary stride in bytes of a single serialized `BvhTriangle`.
pub const EUV3D_BVH_TRI_STRIDE_BYTES: usize = 128;
/// FNV-1a 64-bit hash offset basis used for `.euv3d` content digests.
pub const EUV3D_FNV1A_OFFSET: u64 = 0xcbf2_9ce4_8422_2325;
/// FNV-1a 64-bit hash prime multiplier used for `.euv3d` content digests.
pub const EUV3D_FNV1A_PRIME: u64 = 0x0000_0100_0000_01b3;
/// Error message returned when an `.euv3d` buffer is shorter than the 64-byte header.
pub const ERR_EUV3D_TOO_SHORT: &str = "euv3d: payload shorter than 64-byte header";
/// Error message returned when the `.euv3d` 8-byte magic header does not match `EUV3D\0\0\0`.
pub const ERR_EUV3D_BAD_MAGIC: &str = "euv3d: invalid magic signature";
/// Error message returned when an `.euv3d` file has an unsupported version number.
pub const ERR_EUV3D_BAD_VERSION: &str = "euv3d: unsupported format version";
/// Error message returned when the `.euv3d` header or payload CRC32 verification fails.
pub const ERR_EUV3D_CRC_MISMATCH: &str = "euv3d: crc32 integrity check failed";
/// Error message returned when declared `total_bytes` disagrees with the input buffer size.
pub const ERR_EUV3D_SIZE_MISMATCH: &str = "euv3d: declared byte length mismatch";
/// Error message returned when the section directory extends past the end of the buffer.
pub const ERR_EUV3D_TABLE_OOB: &str = "euv3d: section table out of bounds";
/// Error message returned when a section offset is not 64-byte aligned.
pub const ERR_EUV3D_UNALIGNED_SECTION: &str = "euv3d: section offset is not 64-byte aligned";
/// Error message returned when a section range exceeds the buffer length.
pub const ERR_EUV3D_SECTION_OOB: &str = "euv3d: section range out of bounds";
/// Error message returned when a section entry carries an unrecognized kind tag.
pub const ERR_EUV3D_UNKNOWN_SECTION: &str = "euv3d: unknown section kind";
/// Error message returned when the required `SceneMetadataJson` section is absent.
pub const ERR_EUV3D_MISSING_METADATA: &str = "euv3d: missing scene metadata section";
/// Error message returned when `SceneMetadataJson` cannot be decoded.
pub const ERR_EUV3D_BAD_METADATA: &str = "euv3d: failed to deserialize scene metadata";
/// Error message returned when a typed binary payload slice is truncated or malformed.
pub const ERR_EUV3D_TRUNCATED_BLOB: &str = "euv3d: truncated binary section data";
/// Error message returned when a pre-baked BVH4 node references an out-of-range child or leaf packet.
pub const ERR_EUV3D_INVALID_BVH4: &str = "euv3d: pre-baked BVH4 child index out of bounds";
const _: = assert!;
const _: = assert!;
const _: = assert!;