--wip-- [skip ci]

This commit is contained in:
2025-06-26 19:47:18 +01:00
parent 8a371de244
commit 88ed766ab8
3 changed files with 56 additions and 12 deletions
+10 -9
View File
@@ -1,22 +1,23 @@
#ifndef glsl_include #ifndef glsl_include
#define glsl_include #define glsl_include
layout(push_constant)uniform PushConstantData{ layout(push_constant) uniform PushConstantData {
mat4 world; mat4 world;
vec3 dimensions; vec3 dimensions;
vec3 lowest_corner; vec3 lowest_corner;
}pc; uint enable[16];
} pc;
layout(set=0,binding=0)uniform Lights{ layout(set = 0, binding = 0) uniform Lights {
vec4[32]pos; vec4[32] pos;
vec4[32]col; vec4[32] col;
uint light_count; uint light_count;
}light_uniforms; } light_uniforms;
layout(set=0,binding=1)uniform Camera{ layout(set = 0, binding = 1) uniform Camera {
mat4 view; mat4 view;
mat4 proj; mat4 proj;
vec3 campos; vec3 campos;
}camera_uniforms; } camera_uniforms;
#endif #endif
+38 -2
View File
@@ -17,7 +17,7 @@ use std::{
fs::{File, remove_file, rename}, fs::{File, remove_file, rename},
io::{Cursor, Read, Write}, io::{Cursor, Read, Write},
path::{Path, PathBuf}, path::{Path, PathBuf},
simd::StdFloat, simd::{StdFloat, cmp::SimdPartialOrd},
sync::Arc, sync::Arc,
time::Instant, time::Instant,
}; };
@@ -88,7 +88,7 @@ use winit::{
}; };
mod gui; mod gui;
use crate::{gui::*, implicit_vs::PushConstantData}; use crate::{gui::*, implicit_vs::PushConstantData, types::Interval};
mod objects; mod objects;
use crate::objects::*; use crate::objects::*;
@@ -318,6 +318,42 @@ fn interval_check(csg: &CSG, push_constants: &mut PushConstantData) {
push_constants.dimensions = (highest_corner - lowest_corner).to_array().into(); push_constants.dimensions = (highest_corner - lowest_corner).to_array().into();
push_constants.lowest_corner = lowest_corner.into(); push_constants.lowest_corner = lowest_corner.into();
for x in 0..8 {
for y in 0..8 {
const INTERVAL_INPUT_Z: interpreter::Value = Interval::new(
interpreter::Value::from_array([
0.0 / 8.0,
1.0 / 8.0,
2.0 / 8.0,
3.0 / 8.0,
4.0 / 8.0,
5.0 / 8.0,
6.0 / 8.0,
7.0 / 8.0,
]),
interpreter::Value::from_array([
1.0 / 8.0,
2.0 / 8.0,
3.0 / 8.0,
4.0 / 8.0,
5.0 / 8.0,
6.0 / 8.0,
7.0 / 8.0,
8.0 / 8.0,
]),
);
let mut interpreter = IntervalInterpreter::new(csg);
let output = interpreter.scene(
Interval::const_splat2(x as f32 / 8.0, (x + 1) as f32 / 8.0),
Interval::const_splat2(y as f32 / 8.0, (y + 1) as f32 / 8.0),
INTERPRET_INPUT_Z,
);
(output.lower().simd_le(VALUE_0) & output.lower().simd_ge(VALUE_0)).to_bitmask()
}
}
} }
impl App { impl App {
+8 -1
View File
@@ -67,13 +67,20 @@ impl Interval {
Interval::new(Value::splat(lower), Value::splat(upper)) Interval::new(Value::splat(lower), Value::splat(upper))
} }
const fn const_splat(value: f32) -> Interval { pub const fn const_splat(value: f32) -> Interval {
Interval { Interval {
lower: Value::splat(value), lower: Value::splat(value),
upper: Value::splat(value), upper: Value::splat(value),
} }
} }
pub const fn const_splat2(lower: f32, upper: f32) -> Interval {
Interval {
lower: Value::splat(lower),
upper: Value::splat(upper),
}
}
/// Returns the lower bound of the interval /// Returns the lower bound of the interval
#[inline] #[inline]
pub fn lower(&self) -> Value { pub fn lower(&self) -> Value {