1use nalgebra::{Point3, Vector3};
4use serde::{Deserialize, Serialize};
5use bytemuck::{Pod, Zeroable};
6
7pub type Point3f = Point3<f32>;
9
10pub type Point3d = Point3<f64>;
12
13pub type Vector3f = Vector3<f32>;
15
16pub type Vector3d = Vector3<f64>;
18
19#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
21#[repr(C)]
22pub struct ColoredPoint3f {
23 pub position: Point3f,
24 pub color: [u8; 3],
25}
26
27unsafe impl Pod for ColoredPoint3f {}
28unsafe impl Zeroable for ColoredPoint3f {}
29
30#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
32#[repr(C)]
33pub struct NormalPoint3f {
34 pub position: Point3f,
35 pub normal: Vector3f,
36}
37
38unsafe impl Pod for NormalPoint3f {}
39unsafe impl Zeroable for NormalPoint3f {}
40
41#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
43#[repr(C)]
44pub struct ColoredNormalPoint3f {
45 pub position: Point3f,
46 pub normal: Vector3f,
47 pub color: [u8; 3],
48}
49
50unsafe impl Pod for ColoredNormalPoint3f {}
51unsafe impl Zeroable for ColoredNormalPoint3f {}
52
53impl Default for ColoredPoint3f {
54 fn default() -> Self {
55 Self {
56 position: Point3f::origin(),
57 color: [255, 255, 255],
58 }
59 }
60}
61
62impl Default for NormalPoint3f {
63 fn default() -> Self {
64 Self {
65 position: Point3f::origin(),
66 normal: Vector3f::new(0.0, 0.0, 1.0),
67 }
68 }
69}
70
71impl Default for ColoredNormalPoint3f {
72 fn default() -> Self {
73 Self {
74 position: Point3f::origin(),
75 normal: Vector3f::new(0.0, 0.0, 1.0),
76 color: [255, 255, 255],
77 }
78 }
79}