use nalgebra::{Point3, Vector3};
use serde::{Deserialize, Serialize};
use bytemuck::{Pod, Zeroable};
pub type Point3f = Point3<f32>;
pub type Point3d = Point3<f64>;
pub type Vector3f = Vector3<f32>;
pub type Vector3d = Vector3<f64>;
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
#[repr(C)]
pub struct ColoredPoint3f {
pub position: Point3f,
pub color: [u8; 3],
}
unsafe impl Pod for ColoredPoint3f {}
unsafe impl Zeroable for ColoredPoint3f {}
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
#[repr(C)]
pub struct NormalPoint3f {
pub position: Point3f,
pub normal: Vector3f,
}
unsafe impl Pod for NormalPoint3f {}
unsafe impl Zeroable for NormalPoint3f {}
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
#[repr(C)]
pub struct ColoredNormalPoint3f {
pub position: Point3f,
pub normal: Vector3f,
pub color: [u8; 3],
}
unsafe impl Pod for ColoredNormalPoint3f {}
unsafe impl Zeroable for ColoredNormalPoint3f {}
impl Default for ColoredPoint3f {
fn default() -> Self {
Self {
position: Point3f::origin(),
color: [255, 255, 255],
}
}
}
impl Default for NormalPoint3f {
fn default() -> Self {
Self {
position: Point3f::origin(),
normal: Vector3f::new(0.0, 0.0, 1.0),
}
}
}
impl Default for ColoredNormalPoint3f {
fn default() -> Self {
Self {
position: Point3f::origin(),
normal: Vector3f::new(0.0, 0.0, 1.0),
color: [255, 255, 255],
}
}
}