adds cone component

This commit is contained in:
zomseffen 2025-04-07 17:10:22 +02:00
parent 3f199ce4a6
commit a39cf62b0b
4 changed files with 197 additions and 6 deletions
src/scene

View file

@ -4,7 +4,7 @@ use crate::primitives::cube::Cube;
use crate::primitives::rec_cuboid::Cuboid;
use crate::primitives::drawable::Drawable;
use crate::app_data::AppData;
use super::volumetrics::{ShapeComposition, Sphere};
use super::volumetrics::{Cone, ShapeComposition, Sphere};
extern crate rand;
use rand::Rng;
@ -125,9 +125,8 @@ pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<(Poi
scene.volumetrics.push(Rc::new(RefCell::new(comp)));
let mut comp = ShapeComposition::new(64);
comp.included_shapes.push(Rc::new(RefCell::new(Sphere::new(Vector3 { x: 20.0 + grid_size as f32, y: 5.0 + grid_size as f32, z: 10.0 }, Vector3 { x: 0.0, y: 0.0, z: 0.0 }, 2.0, Vector3 { x: 0, y: 255, z: 0 }, 64, false))));
comp.included_shapes.push(Rc::new(RefCell::new(Sphere::new(Vector3 { x: 20.0 + grid_size as f32, y: 5.0 + grid_size as f32, z: 10.0 }, Vector3 { x: 0.0, y: 0.0, z: 0.0 }, 2.5, Vector3 { x: 255, y: 0, z: 0 }, 64, false))));
comp.excluded_shapes.push(Rc::new(RefCell::new(Sphere::new(Vector3 { x: 20.0 + grid_size as f32, y: 5.0 + grid_size as f32, z: 11.5 }, Vector3 { x: 0.0, y: 0.0, z: 0.0 }, 1.5, Vector3 { x: 0, y: 255, z: 0 }, 64, false))));
comp.included_shapes.push(Rc::new(RefCell::new(Cone::new(Vector3 { x: 20.0 + grid_size as f32, y: 5.0 + grid_size as f32, z: 10.0 }, Vector3 { x: 0.0, y: 0.0, z: 0.0 }, 0.0, 2.5, Vector3 { x: 0.0, y: 10.0, z: 0.0 },Vector3 { x: 0, y: 255, z: 0 }, 64, false))));
comp.excluded_shapes.push(Rc::new(RefCell::new(Cone::new(Vector3 { x: 20.0 + grid_size as f32, y: 5.0 + grid_size as f32, z: 10.0 }, Vector3 { x: 0.0, y: 0.0, z: 0.0 }, 0.0, 1.5, Vector3 { x: 0.0, y: 10.0, z: 0.0 },Vector3 { x: 0, y: 255, z: 0 }, 64, false))));
scene.volumetrics.push(Rc::new(RefCell::new(comp)));
Ok((cgmath::point3(5.0, 5.0, 10.0)))