--wip-- [skip ci]

This commit is contained in:
2025-01-01 20:40:20 +00:00
parent 94f8e0502a
commit b6b252c69d
7 changed files with 1129 additions and 1019 deletions
Generated
+22 -99
View File
@@ -76,15 +76,6 @@ version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
[[package]]
name = "approx"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "arbitrary" name = "arbitrary"
version = "1.4.1" version = "1.4.1"
@@ -327,16 +318,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "cgmath"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a98d30140e3296250832bbaaff83b27dcd6fa3cc70fb6f1f3e5c9c0023b5317"
dependencies = [
"approx",
"num-traits",
]
[[package]] [[package]]
name = "clipboard-win" name = "clipboard-win"
version = "5.4.0" version = "5.4.0"
@@ -574,8 +555,8 @@ dependencies = [
"egui", "egui",
"egui-winit", "egui-winit",
"image", "image",
"vulkano 0.34.0 (git+https://github.com/vulkano-rs/vulkano.git)", "vulkano",
"vulkano-shaders 0.34.0 (git+https://github.com/vulkano-rs/vulkano.git)", "vulkano-shaders",
"winit", "winit",
] ]
@@ -639,17 +620,18 @@ name = "erroccfisuvsc"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"cgmath",
"egui", "egui",
"egui_winit_vulkano", "egui_winit_vulkano",
"foldhash",
"glam",
"obj", "obj",
"rand", "rand",
"rayon", "rayon",
"serde", "serde",
"serde_json", "serde_json",
"utf-8", "utf-8",
"vulkano 0.34.0 (git+https://github.com/Molive-0/vulkano)", "vulkano",
"vulkano-shaders 0.34.0 (git+https://github.com/Molive-0/vulkano)", "vulkano-shaders",
"vulkano-util", "vulkano-util",
"winit", "winit",
] ]
@@ -767,6 +749,12 @@ dependencies = [
"weezl", "weezl",
] ]
[[package]]
name = "glam"
version = "0.29.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc46dd3ec48fdd8e693a98d2b8bafae273a2d54c1de02a2a7e3d57d501f39677"
[[package]] [[package]]
name = "half" name = "half"
version = "2.4.1" version = "2.4.1"
@@ -2339,50 +2327,10 @@ dependencies = [
"xml-rs", "xml-rs",
] ]
[[package]]
name = "vk-parse"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11be98ea9c3e6a91789a99d111087588d597a1e30ecc33fd4c7b8cfdf5161989"
dependencies = [
"xml-rs",
]
[[package]] [[package]]
name = "vulkano" name = "vulkano"
version = "0.34.0" version = "0.34.0"
source = "git+https://github.com/Molive-0/vulkano#9bb8ebd8b0c05c23eb83f92435c54ed130cfba97" source = "git+https://github.com/vulkano-rs/vulkano#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
dependencies = [
"ash",
"bytemuck",
"crossbeam-queue",
"foldhash",
"half",
"heck 0.5.0",
"indexmap",
"libloading",
"nom",
"once_cell",
"parking_lot",
"proc-macro2",
"quote",
"raw-window-handle",
"raw-window-metal",
"serde",
"serde_json",
"slabbin",
"smallvec",
"thread_local",
"vk-parse 0.16.0",
"vulkano-macros 0.34.0 (git+https://github.com/Molive-0/vulkano)",
"x11-dl",
"x11rb",
]
[[package]]
name = "vulkano"
version = "0.34.0"
source = "git+https://github.com/vulkano-rs/vulkano.git#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
dependencies = [ dependencies = [
"ash", "ash",
"bytemuck", "bytemuck",
@@ -2404,8 +2352,8 @@ dependencies = [
"slabbin", "slabbin",
"smallvec", "smallvec",
"thread_local", "thread_local",
"vk-parse 0.15.0", "vk-parse",
"vulkano-macros 0.34.0 (git+https://github.com/vulkano-rs/vulkano.git)", "vulkano-macros",
"x11-dl", "x11-dl",
"x11rb", "x11rb",
] ]
@@ -2413,18 +2361,7 @@ dependencies = [
[[package]] [[package]]
name = "vulkano-macros" name = "vulkano-macros"
version = "0.34.0" version = "0.34.0"
source = "git+https://github.com/Molive-0/vulkano#9bb8ebd8b0c05c23eb83f92435c54ed130cfba97" source = "git+https://github.com/vulkano-rs/vulkano#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "vulkano-macros"
version = "0.34.0"
source = "git+https://github.com/vulkano-rs/vulkano.git#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
@@ -2435,21 +2372,7 @@ dependencies = [
[[package]] [[package]]
name = "vulkano-shaders" name = "vulkano-shaders"
version = "0.34.0" version = "0.34.0"
source = "git+https://github.com/Molive-0/vulkano#9bb8ebd8b0c05c23eb83f92435c54ed130cfba97" source = "git+https://github.com/vulkano-rs/vulkano#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
dependencies = [
"foldhash",
"heck 0.5.0",
"proc-macro2",
"quote",
"shaderc",
"syn",
"vulkano 0.34.0 (git+https://github.com/Molive-0/vulkano)",
]
[[package]]
name = "vulkano-shaders"
version = "0.34.0"
source = "git+https://github.com/vulkano-rs/vulkano.git#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
dependencies = [ dependencies = [
"foldhash", "foldhash",
"heck 0.4.1", "heck 0.4.1",
@@ -2457,16 +2380,16 @@ dependencies = [
"quote", "quote",
"shaderc", "shaderc",
"syn", "syn",
"vulkano 0.34.0 (git+https://github.com/vulkano-rs/vulkano.git)", "vulkano",
] ]
[[package]] [[package]]
name = "vulkano-util" name = "vulkano-util"
version = "0.34.0" version = "0.34.0"
source = "git+https://github.com/Molive-0/vulkano#9bb8ebd8b0c05c23eb83f92435c54ed130cfba97" source = "git+https://github.com/vulkano-rs/vulkano#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
dependencies = [ dependencies = [
"foldhash", "foldhash",
"vulkano 0.34.0 (git+https://github.com/Molive-0/vulkano)", "vulkano",
"winit", "winit",
] ]
@@ -3177,9 +3100,9 @@ dependencies = [
[[patch.unused]] [[patch.unused]]
name = "vulkano-taskgraph" name = "vulkano-taskgraph"
version = "0.34.0" version = "0.34.0"
source = "git+https://github.com/Molive-0/vulkano#9bb8ebd8b0c05c23eb83f92435c54ed130cfba97" source = "git+https://github.com/vulkano-rs/vulkano#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
[[patch.unused]] [[patch.unused]]
name = "vulkano-win" name = "vulkano-win"
version = "0.34.0" version = "0.34.0"
source = "git+https://github.com/Molive-0/vulkano#9bb8ebd8b0c05c23eb83f92435c54ed130cfba97" source = "git+https://github.com/vulkano-rs/vulkano#ea30f65280360b1e1bc907cd42d4eb355fed3c9d"
+8 -7
View File
@@ -18,7 +18,7 @@ bytemuck = { version = "1.13", features = [
"min_const_generics", "min_const_generics",
] } ] }
cgmath = "0.18" glam = "0.29"
egui = "0.30" egui = "0.30"
egui_winit_vulkano = "0.27" egui_winit_vulkano = "0.27"
@@ -31,13 +31,14 @@ utf-8 = "0.7"
rayon = "1.7" rayon = "1.7"
rand = "0.8.5" rand = "0.8.5"
foldhash = "0.1.4"
# using latest gits # using latest gits
[patch.crates-io] [patch.crates-io]
vulkano = { git = "https://github.com/Molive-0/vulkano" } vulkano = { git = "https://github.com/vulkano-rs/vulkano" }
vulkano-macros = { git = "https://github.com/Molive-0/vulkano" } vulkano-macros = { git = "https://github.com/vulkano-rs/vulkano" }
vulkano-shaders = { git = "https://github.com/Molive-0/vulkano" } vulkano-shaders = { git = "https://github.com/vulkano-rs/vulkano" }
vulkano-taskgraph = { git = "https://github.com/Molive-0/vulkano" } vulkano-taskgraph = { git = "https://github.com/vulkano-rs/vulkano" }
vulkano-util = { git = "https://github.com/Molive-0/vulkano" } vulkano-util = { git = "https://github.com/vulkano-rs/vulkano" }
vulkano-win = { git = "https://github.com/Molive-0/vulkano" } vulkano-win = { git = "https://github.com/vulkano-rs/vulkano" }
egui_winit_vulkano = { git = "https://github.com/Molive-0/egui_winit_vulkano" } egui_winit_vulkano = { git = "https://github.com/Molive-0/egui_winit_vulkano" }
+1 -1
View File
@@ -8,7 +8,7 @@
#ifdef implicit #ifdef implicit
layout (constant_id = 0) const bool DISABLE_TRACE = false; layout (constant_id = 0) const bool DISABLE_TRACE = false;
layout (constant_id = 1) const bool BRUTE_FORCE = false; layout (constant_id = 5) const bool BRUTE_FORCE = false;
layout(location=0)in VertexInput layout(location=0)in VertexInput
{ {
+4 -4
View File
@@ -8,10 +8,10 @@ uint DescriptionIndex;
#include "include.glsl" #include "include.glsl"
#include "intervals.glsl" #include "intervals.glsl"
layout (constant_id = 0) const bool DISABLE_TRACE = false; layout (constant_id = 1) const bool DISABLE_TRACE = false;
layout (constant_id = 1) const bool DISABLE_SCALING_1 = false; layout (constant_id = 2) const bool DISABLE_SCALING_1 = false;
layout (constant_id = 2) const bool DISABLE_SCALING_2 = false; layout (constant_id = 3) const bool DISABLE_SCALING_2 = false;
layout (constant_id = 3) const bool BRUTE_FORCE = false; layout (constant_id = 5) const bool BRUTE_FORCE = false;
layout(local_size_x=32,local_size_y=1,local_size_z=1)in; layout(local_size_x=32,local_size_y=1,local_size_z=1)in;
layout(triangles,max_vertices=256,max_primitives=192)out; layout(triangles,max_vertices=256,max_primitives=192)out;
+1 -1
View File
@@ -8,7 +8,7 @@
#include "include.glsl" #include "include.glsl"
#include "intervals.glsl" #include "intervals.glsl"
layout (constant_id = 0) const bool DISABLE_TRACE = false; layout (constant_id = 4) const bool DISABLE_TRACE = false;
layout(local_size_x=32,local_size_y=1,local_size_z=1)in; layout(local_size_x=32,local_size_y=1,local_size_z=1)in;
+1029 -805
View File
File diff suppressed because it is too large Load Diff
+64 -102
View File
@@ -2,21 +2,22 @@ use std::{
collections::HashMap, collections::HashMap,
io::{Cursor, Read}, io::{Cursor, Read},
mem, mem,
sync::Arc,
}; };
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
use cgmath::{ use glam::{self, Mat2, Mat3, Mat4, Vec2, Vec3, Vec4};
Deg, EuclideanSpace, Euler, Matrix2, Matrix3, Matrix4, Point3, SquareMatrix, Vector2, Vector3,
Vector4,
};
use obj::{LoadConfig, ObjData, ObjError}; use obj::{LoadConfig, ObjData, ObjError};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use vulkano::{ use vulkano::{
buffer::{Buffer, BufferAllocateInfo, BufferUsage, Subbuffer}, buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
memory::allocator::{
AllocationCreateInfo, MemoryAllocatePreference, MemoryTypeFilter, StandardMemoryAllocator,
},
pipeline::graphics::vertex_input::Vertex, pipeline::graphics::vertex_input::Vertex,
}; };
use crate::{instruction_set::InstructionSet, mcsg_deserialise::from_reader, MemoryAllocator}; use crate::{instruction_set::InstructionSet, mcsg_deserialise::from_reader};
pub(crate) const PLATONIC_SOLIDS: [(&str, &[u8]); 1] = [("Buny", include_bytes!("bunny.obj"))]; pub(crate) const PLATONIC_SOLIDS: [(&str, &[u8]); 1] = [("Buny", include_bytes!("bunny.obj"))];
pub(crate) const CSG_SOLIDS: [(&str, &[u8]); 1] = pub(crate) const CSG_SOLIDS: [(&str, &[u8]); 1] =
@@ -40,27 +41,21 @@ pub(crate) struct Mesh {
pub(crate) name: String, pub(crate) name: String,
pub(crate) vertices: Subbuffer<[OVertex]>, pub(crate) vertices: Subbuffer<[OVertex]>,
pub(crate) indices: Subbuffer<[u32]>, pub(crate) indices: Subbuffer<[u32]>,
pub(crate) pos: Point3<f32>, pub(crate) pos: Vec3,
pub(crate) rot: Euler<Deg<f32>>, pub(crate) rot: Vec3,
pub(crate) scale: Vector3<f32>, pub(crate) scale: Vec3,
} }
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct CSG { pub(crate) struct CSG {
pub(crate) name: String, pub(crate) name: String,
pub(crate) parts: Vec<CSGPart>, pub(crate) parts: Vec<CSGPart>,
pub(crate) pos: Point3<f32>, pub(crate) pos: Vec3,
pub(crate) rot: Euler<Deg<f32>>, pub(crate) rot: Vec3,
pub(crate) scale: Vector3<f32>, pub(crate) scale: Vec3,
} }
pub(crate) type Float = f64; pub(crate) type Float = f32;
pub(crate) type Vec2 = Vector2<Float>;
pub(crate) type Vec3 = Vector3<Float>;
pub(crate) type Vec4 = Vector4<Float>;
pub(crate) type Mat2 = Matrix2<Float>;
pub(crate) type Mat3 = Matrix3<Float>;
pub(crate) type Mat4 = Matrix4<Float>;
#[derive(Clone, Copy, Debug, Default, PartialEq)] #[derive(Clone, Copy, Debug, Default, PartialEq)]
pub(crate) enum Inputs { pub(crate) enum Inputs {
@@ -117,7 +112,7 @@ impl CSGPart {
} }
pub(crate) fn load_obj( pub(crate) fn load_obj(
memory_allocator: &MemoryAllocator, memory_allocator: &Arc<StandardMemoryAllocator>,
input: &mut dyn Read, input: &mut dyn Read,
name: String, name: String,
) -> Result<Vec<Mesh>, ObjError> { ) -> Result<Vec<Mesh>, ObjError> {
@@ -154,9 +149,14 @@ pub(crate) fn load_obj(
} }
let vertex_buffer = Buffer::from_iter( let vertex_buffer = Buffer::from_iter(
memory_allocator, memory_allocator.clone(),
BufferAllocateInfo { BufferCreateInfo {
buffer_usage: BufferUsage::VERTEX_BUFFER, usage: BufferUsage::VERTEX_BUFFER,
..Default::default()
},
AllocationCreateInfo {
memory_type_filter: MemoryTypeFilter::PREFER_DEVICE,
allocate_preference: MemoryAllocatePreference::AlwaysAllocate,
..Default::default() ..Default::default()
}, },
vertices, vertices,
@@ -164,9 +164,14 @@ pub(crate) fn load_obj(
.unwrap(); .unwrap();
let index_buffer = Buffer::from_iter( let index_buffer = Buffer::from_iter(
memory_allocator, memory_allocator.clone(),
BufferAllocateInfo { BufferCreateInfo {
buffer_usage: BufferUsage::INDEX_BUFFER, usage: BufferUsage::INDEX_BUFFER,
..Default::default()
},
AllocationCreateInfo {
memory_type_filter: MemoryTypeFilter::PREFER_DEVICE,
allocate_preference: MemoryAllocatePreference::AlwaysAllocate,
..Default::default() ..Default::default()
}, },
indices, indices,
@@ -176,17 +181,9 @@ pub(crate) fn load_obj(
Ok(vec![Mesh { Ok(vec![Mesh {
vertices: vertex_buffer, vertices: vertex_buffer,
indices: index_buffer, indices: index_buffer,
pos: Point3 { pos: Vec3::ZERO,
x: 0., rot: Vec3::ZERO,
y: 0., scale: Vec3::ONE,
z: 0.,
},
rot: Euler::new(Deg(0.), Deg(0.), Deg(0.)),
scale: Vector3 {
x: 1.,
y: 1.,
z: 1.,
},
name, name,
}]) }])
} }
@@ -200,42 +197,31 @@ type MCSGObject = HashMap<String, String>;
type MCSGCSG = Vec<MCSGCSGPart>; type MCSGCSG = Vec<MCSGCSGPart>;
type MCSGCSGPart = HashMap<String, String>; type MCSGCSGPart = HashMap<String, String>;
fn matrix3_from_string(input: &str) -> Result<Matrix3<f32>, String> { fn mat3_from_string(input: &str) -> Result<Mat3, String> {
let vec = input let vec = input
.split(' ') .split(' ')
.map(|s| s.parse::<f32>()) .map(|s| s.parse::<f32>())
.collect::<Result<Vec<f32>, _>>() .collect::<Result<Vec<f32>, _>>()
.map_err(|_| "not floats")?; .map_err(|_| "not floats")?;
let array: [f32; 9] = vec.try_into().map_err(|_| "wrong number of values")?; let array: [f32; 9] = vec.try_into().map_err(|_| "wrong number of values")?;
let matrix: &Matrix3<f32> = (&array).into(); let matrix = Mat3::from_cols_array(&array);
Ok(*matrix) Ok(matrix)
} }
fn vector3_from_string(input: &str) -> Result<Vector3<f32>, String> { fn vec3_from_string(input: &str) -> Result<Vec3, String> {
let vec = input let vec = input
.split(' ') .split(' ')
.map(|s| s.parse::<f32>()) .map(|s| s.parse::<f32>())
.collect::<Result<Vec<f32>, _>>() .collect::<Result<Vec<f32>, _>>()
.map_err(|_| "not floats")?; .map_err(|_| "not floats")?;
let array: [f32; 3] = vec.try_into().map_err(|_| "wrong number of values")?; let array: [f32; 3] = vec.try_into().map_err(|_| "wrong number of values")?;
let vector: &Vector3<f32> = (&array).into(); let vector = Vec3::from_array(array);
Ok(*vector) Ok(vector)
}
fn point3_from_string(input: &str) -> Result<Point3<f32>, String> {
let vec = input
.split(' ')
.map(|s| s.parse::<f32>())
.collect::<Result<Vec<f32>, _>>()
.map_err(|_| "not floats")?;
let array: [f32; 3] = vec.try_into().map_err(|_| "wrong number of values")?;
let point: &Point3<f32> = (&array).into();
Ok(*point)
} }
struct TRS { struct TRS {
translation: Point3<f32>, translation: Vec3,
rotation: Matrix3<f32>, rotation: Mat3,
scale: Vector3<f32>, scale: Vec3,
} }
fn get_trs(o: &HashMap<String, String>) -> Result<TRS, String> { fn get_trs(o: &HashMap<String, String>) -> Result<TRS, String> {
@@ -243,49 +229,37 @@ fn get_trs(o: &HashMap<String, String>) -> Result<TRS, String> {
translation: o translation: o
.get("t") .get("t")
.map(String::as_str) .map(String::as_str)
.map(point3_from_string) .map(vec3_from_string)
.transpose()? .transpose()?
.unwrap_or(Point3::origin()), .unwrap_or(Vec3::ZERO),
rotation: o rotation: o
.get("r") .get("r")
.map(String::as_str) .map(String::as_str)
.map(matrix3_from_string) .map(mat3_from_string)
.transpose()? .transpose()?
.unwrap_or(Matrix3::identity()), .unwrap_or(Mat3::IDENTITY),
scale: o scale: o
.get("s") .get("s")
.map(String::as_str) .map(String::as_str)
.map(vector3_from_string) .map(vec3_from_string)
.transpose()? .transpose()?
.unwrap_or(Vector3 { .unwrap_or(Vec3::ONE),
x: 1.,
y: 1.,
z: 1.,
}),
}) })
} }
fn get_color(o: &HashMap<String, String>) -> Result<Vector3<f32>, String> { fn get_color(o: &HashMap<String, String>) -> Result<Vec3, String> {
Ok(o.get("color") Ok(o.get("color")
.map(String::as_str) .map(String::as_str)
.map(vector3_from_string) .map(vec3_from_string)
.transpose()? .transpose()?
.unwrap_or(Vector3 { .unwrap_or(Vec3::splat(255.)))
x: 255.,
y: 255.,
z: 255.,
}))
} }
fn get_rgb(o: &HashMap<String, String>) -> Result<Vector3<f32>, String> { fn get_rgb(o: &HashMap<String, String>) -> Result<Vec3, String> {
Ok(o.get("rgb") Ok(o.get("rgb")
.map(String::as_str) .map(String::as_str)
.map(vector3_from_string) .map(vec3_from_string)
.transpose()? .transpose()?
.unwrap_or(Vector3 { .unwrap_or(Vec3::splat(255.)))
x: 255.,
y: 255.,
z: 255.,
}))
} }
fn get_f32(o: &HashMap<String, String>, tag: &str) -> Result<f32, String> { fn get_f32(o: &HashMap<String, String>, tag: &str) -> Result<f32, String> {
@@ -338,7 +312,7 @@ fn get_half(o: &HashMap<String, String>) -> Result<Half, String> {
} }
pub(crate) fn load_csg( pub(crate) fn load_csg(
_memory_allocator: &MemoryAllocator, _memory_allocator: &Arc<StandardMemoryAllocator>,
input: &mut dyn Read, input: &mut dyn Read,
name: String, name: String,
) -> Result<Vec<CSG>, String> { ) -> Result<Vec<CSG>, String> {
@@ -388,17 +362,9 @@ pub(crate) fn load_csg(
Ok(CSG { Ok(CSG {
parts, parts,
pos: Point3 { pos: Vec3::ZERO,
x: 0., rot: Vec3::ZERO,
y: 0., scale: Vec3::ONE,
z: 0.,
},
rot: Euler::new(Deg(0.), Deg(0.), Deg(0.)),
scale: Vector3 {
x: 1.,
y: 1.,
z: 1.,
},
name, name,
}) })
}) })
@@ -407,13 +373,13 @@ pub(crate) fn load_csg(
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct Light { pub(crate) struct Light {
pub(crate) pos: Point3<f32>, pub(crate) pos: Vec3,
pub(crate) colour: Vector3<f32>, pub(crate) colour: Vec3,
} }
impl Light { impl Light {
pub(crate) fn new(pos: [f32; 3], colour: [f32; 3], intensity: f32) -> Light { pub(crate) fn new(pos: [f32; 3], colour: [f32; 3], intensity: f32) -> Light {
let c: Vector3<f32> = colour.into(); let c: Vec3 = colour.into();
Light { Light {
pos: pos.into(), pos: pos.into(),
colour: c * intensity, colour: c * intensity,
@@ -424,12 +390,8 @@ impl Light {
impl Default for Light { impl Default for Light {
fn default() -> Self { fn default() -> Self {
Self { Self {
pos: Point3::origin(), pos: Vec3::ZERO,
colour: Vector3 { colour: Vec3::ONE,
x: 1.,
y: 1.,
z: 1.,
},
} }
} }
} }