saft_sdf/
opcodes.rs

1/// Assembly. Lower level representation.
2#[derive(Copy, Clone, Eq, PartialEq)]
3#[cfg_attr(
4    feature = "with_opcode_derives",
5    derive(Debug, Hash, num_enum::IntoPrimitive, num_enum::TryFromPrimitive)
6)]
7#[cfg_attr(feature = "with_serde", derive(serde::Serialize, serde::Deserialize))]
8#[cfg_attr(feature = "with_speedy", derive(speedy::Writable, speedy::Readable))]
9#[cfg_attr(feature = "with_arbitrary", derive(arbitrary::Arbitrary))]
10#[repr(u32)]
11pub enum Opcode {
12    // Primitives:
13    Plane = 0,          // vec4
14    Sphere = 1,         // center: vec3, radius: f32
15    Capsule = 2,        // p0: vec3, p1: vec3, radius: f32
16    TaperedCapsule = 3, // p0: vec3, r0: f32, p1: vec3, r0: f32
17
18    Material = 4, // rgb: vec3
19
20    // Combinators:
21    Union = 5,
22    UnionSmooth = 6,
23    Subtract = 7,
24    SubtractSmooth = 8,
25    Intersect = 9,
26    IntersectSmooth = 10,
27
28    // Transforms:
29    PushTranslation = 11,
30    PushRotation = 12,
31    PopTransform = 13,
32    PushScale = 14,
33    PopScale = 15,
34
35    End = 16,
36
37    RoundedBox = 17,      // half_size: vec3, radius: f32
38    BiconvexLens = 18,    // lower_sagitta, upper_sagitta, chord
39    RoundedCylinder = 19, // cylinder_radius, half_height, rounding_radius
40    Torus = 20,           // big_r, small_r
41    TorusSector = 21,     // big_r, small_r, sin_half_angle, cos_half_angle
42    Cone = 22,            // radius, height
43}