Skip to main content

euv_core/game/engine3d/gltf/
enum.rs

1/// Keyframe interpolation mode defined by glTF 2.0 animation samplers.
2#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
3pub enum GltfInterpolationMode {
4    /// Constant piecewise hold (`STEP`).
5    Step,
6    /// Linear or quaternion SLERP interpolation (`LINEAR`).
7    #[default]
8    Linear,
9    /// Hermite cubic spline with `(in_tangent, value, out_tangent)` triplets (`CUBICSPLINE`).
10    CubicSpline,
11}
12
13/// Target node property driven by a glTF 2.0 animation channel.
14#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
15pub enum GltfAnimationPath {
16    /// Node local `Vec3` translation.
17    #[default]
18    Translation,
19    /// Node local `Quat` rotation `[x, y, z, w]`.
20    Rotation,
21    /// Node local `Vec3` non-uniform scale.
22    Scale,
23    /// Node shape-key / morph target weight array.
24    MorphWeights,
25}
26
27/// Perspective or orthographic projection imported from a glTF 2.0 / Blender camera.
28#[derive(Clone, Copy, Debug, PartialEq)]
29pub enum GltfCameraProjection {
30    /// Perspective projection with vertical field of view in radians.
31    Perspective {
32        /// Vertical field of view in radians.
33        yfov_rad: f32,
34        /// Optional fixed aspect ratio override.
35        aspect_ratio: Option<f32>,
36        /// Near clipping plane distance in meters.
37        znear: f32,
38        /// Optional finite far clipping plane distance (`None` = infinite reverse-Z).
39        zfar: Option<f32>,
40    },
41    /// Orthographic projection with horizontal and vertical half-extents.
42    Orthographic {
43        /// Horizontal magnification half-width.
44        xmag: f32,
45        /// Vertical magnification half-height.
46        ymag: f32,
47        /// Near clipping plane distance.
48        znear: f32,
49        /// Far clipping plane distance.
50        zfar: f32,
51    },
52}
53
54/// Light emitter classification imported from `KHR_lights_punctual` or Blender area-light extras.
55#[derive(Clone, Copy, Debug, PartialEq)]
56pub enum GltfLightKind {
57    /// Infinite directional sun light oriented along node `-Z`.
58    Directional,
59    /// Omnidirectional point light with optional attenuation cutoff range.
60    Point {
61        /// Optional maximum influence distance in meters.
62        range: Option<f32>,
63    },
64    /// Conical spotlight oriented along node `-Z`.
65    Spot {
66        /// Optional maximum influence distance in meters.
67        range: Option<f32>,
68        /// Inner full-intensity cone half-angle in radians.
69        inner_cone_angle: f32,
70        /// Outer cutoff cone half-angle in radians.
71        outer_cone_angle: f32,
72    },
73    /// Rectangular Blender area light imported via `extras.euv`.
74    Area {
75        /// Emitter width in meters.
76        width: f32,
77        /// Emitter height in meters.
78        height: f32,
79    },
80}