ft (wip): deserialization
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user