ft (wip): deserialization

This commit is contained in:
2026-04-25 14:46:03 +02:00
parent ef8da70436
commit 430bdf63bc
15 changed files with 421 additions and 158 deletions

View File

@@ -1,6 +1,9 @@
use core::f32::math::sqrt;
use std::fmt::{self, Debug};
use std::sync::Arc;
use serde::Deserialize;
use crate::objects::hit::Hit;
use crate::objects::materials::traits::Material;
use crate::objects::traits::Hittable;
@@ -13,6 +16,16 @@ pub struct Sphere {
material: Arc<dyn Material>,
}
impl Debug for Sphere {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Sphere")
.field("center", &self.center)
.field("radius", &self.radius)
.field("material", &self.material)
.finish()
}
}
impl Sphere {
pub fn new(center: Vec3, r: f32, mat: Arc<dyn Material>) -> Self {
Self {