--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
+1
View File
@@ -5,6 +5,7 @@ layout(push_constant)uniform PushConstantData{
mat4 world;
vec3 dimensions;
vec3 lowest_corner;
uint enable[16];
} pc;
layout(set = 0, binding = 0) uniform Lights {
+38 -2
View File
@@ -17,7 +17,7 @@ use std::{
fs::{File, remove_file, rename},
io::{Cursor, Read, Write},
path::{Path, PathBuf},
simd::StdFloat,
simd::{StdFloat, cmp::SimdPartialOrd},
sync::Arc,
time::Instant,
};
@@ -88,7 +88,7 @@ use winit::{
};
mod gui;
use crate::{gui::*, implicit_vs::PushConstantData};
use crate::{gui::*, implicit_vs::PushConstantData, types::Interval};
mod 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.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 {
+8 -1
View File
@@ -67,13 +67,20 @@ impl Interval {
Interval::new(Value::splat(lower), Value::splat(upper))
}
const fn const_splat(value: f32) -> Interval {
pub const fn const_splat(value: f32) -> Interval {
Interval {
lower: 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
#[inline]
pub fn lower(&self) -> Value {