euv-core 0.53.1

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
/// 8-byte binary magic signature identifying `.euv3d` baked asset packages.
pub const EUV3D_MAGIC: [u8; 8] = *b"EUV3D\0\0\0";

/// Current `.euv3d` binary format specification version.
pub const EUV3D_FORMAT_VERSION: u32 = 1;

/// 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: [f32; 4] = [1.0, 0.5, 0.25, 0.1];

/// Header flag bit indicating pre-baked BVH4 acceleration sections are present.
pub(crate) const EUV3D_FLAG_HAS_BVH4: u32 = 1 << 0;

/// Header flag bit indicating spatial meshlet sections are present.
pub(crate) const EUV3D_FLAG_HAS_MESHLETS: u32 = 1 << 1;

/// Header flag bit indicating QEM LOD chain records are present.
pub(crate) const EUV3D_FLAG_HAS_LODS: u32 = 1 << 2;

/// Penalty weight applied to open boundary planes during QEM simplification to preserve mesh borders.
pub(crate) const EUV3D_BOUNDARY_WEIGHT: f64 = 16.0;

/// Minimum matrix determinant magnitude required to invert a 3x3 QEM quadric system directly.
pub(crate) const EUV3D_QEM_EPSILON: f64 = 1e-12;

/// Minimum normal dot product required to accept an edge collapse without flipping adjacent triangles.
pub(crate) const EUV3D_NORMAL_FLIP_MIN_DOT: f32 = 0.05;

/// Packed binary stride in bytes of a single serialized `Vertex3D`.
pub(crate) const EUV3D_VERTEX_STRIDE_BYTES: usize = 64;

/// Packed binary stride in bytes of a single serialized triangle index triplet `[u32; 3]`.
pub(crate) const EUV3D_INDEX_TRI_BYTES: usize = 12;

/// Packed binary stride in bytes of a single serialized `MeshSkinInfluence3D`.
pub(crate) const EUV3D_SKIN_STRIDE_BYTES: usize = 48;

/// Packed binary stride in bytes of a single serialized `Meshlet3D`.
pub(crate) const EUV3D_MESHLET_STRIDE_BYTES: usize = 52;

/// Packed binary stride in bytes of a single serialized 128-byte `Bvh4Node`.
pub(crate) const EUV3D_BVH4_NODE_STRIDE_BYTES: usize = 128;

/// Packed binary stride in bytes of a single serialized 160-byte `BvhTri4` packet.
pub(crate) const EUV3D_BVH_TRI4_STRIDE_BYTES: usize = 160;

/// Packed binary stride in bytes of a single serialized `BvhTriangle`.
pub(crate) const EUV3D_BVH_TRI_STRIDE_BYTES: usize = 128;

/// FNV-1a 64-bit hash offset basis used for `.euv3d` content digests.
pub(crate) const EUV3D_FNV1A_OFFSET: u64 = 0xcbf2_9ce4_8422_2325;

/// FNV-1a 64-bit hash prime multiplier used for `.euv3d` content digests.
pub(crate) const EUV3D_FNV1A_PRIME: u64 = 0x0000_0100_0000_01b3;

/// Error message returned when an `.euv3d` buffer is shorter than the 64-byte header.
pub(crate) 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(crate) const ERR_EUV3D_BAD_MAGIC: &str = "euv3d: invalid magic signature";

/// Error message returned when an `.euv3d` file has an unsupported version number.
pub(crate) const ERR_EUV3D_BAD_VERSION: &str = "euv3d: unsupported format version";

/// Error message returned when the `.euv3d` header or payload CRC32 verification fails.
pub(crate) 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(crate) 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(crate) 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(crate) 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(crate) 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(crate) const ERR_EUV3D_UNKNOWN_SECTION: &str = "euv3d: unknown section kind";

/// Error message returned when the required `SceneMetadataJson` section is absent.
pub(crate) const ERR_EUV3D_MISSING_METADATA: &str = "euv3d: missing scene metadata section";

/// Error message returned when `SceneMetadataJson` cannot be decoded.
pub(crate) 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(crate) 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(crate) const ERR_EUV3D_INVALID_BVH4: &str = "euv3d: pre-baked BVH4 child index out of bounds";