optic_core/consts.rs
1//! Constants for asset paths, cache magic, shader/mesh metadata.
2//!
3//! These are used by [`optic_file`] and [`optic_render`] to resolve
4//! asset locations and validate cache files.
5
6/// Root asset directory.
7pub const ASSET: &str = "opt/";
8/// Temporary asset directory.
9pub const TEMP: &str = "opt/temp/";
10/// Shader asset directory.
11pub const SHDR_ASSET: &str = "opt/shdr/";
12/// Mesh asset directory.
13pub const MESH_ASSET: &str = "opt/mesh/";
14/// Texture asset directory.
15pub const TXTR_ASSET: &str = "opt/txtr/";
16
17/// Vertex shader file extension.
18pub const VERT: &str = "vert";
19/// Fragment shader file extension.
20pub const FRAG: &str = "frag";
21/// GLSL shader file extension.
22pub const GLSL: &str = "glsl";
23/// Wavefront OBJ mesh file extension.
24pub const OBJ: &str = "obj";
25/// PNG image file extension.
26pub const PNG: &str = "png";
27
28/// Optic cached shader extension.
29pub const OSHDR: &str = "oshdr";
30/// Optic cached mesh extension.
31pub const OMESH: &str = "omesh";
32/// Optic cached texture extension.
33pub const OTXTR: &str = "otxtr";
34
35/// Magic signature for all optic engine binary cache files (8 bytes).
36///
37/// This never changes. Every binary cache file starts with these bytes.
38pub const OPTIC_MAGIC: [u8; 8] = *b"/0PTIC_x";
39
40/// Version of the binary cache format.
41///
42/// Bump this when the layout after the header changes.
43pub const OPTIC_CACHE_VERSION: u16 = 1;
44
45/// Shader file sub-type discriminator for pipeline shaders.
46pub const SHADER_PIPELINE: u8 = 0;
47/// Shader file sub-type discriminator for compute shaders.
48pub const SHADER_COMPUTE: u8 = 1;
49
50/// Bitflag: mesh has normal data.
51pub const MESH_FLAG_HAS_NORMALS: u8 = 0b0001;
52/// Bitflag: mesh has UV data.
53pub const MESH_FLAG_HAS_UVS: u8 = 0b0010;