Adding attribute system to the cache

This commit is contained in:
2026-09-19 15:41:23 +02:00
parent 306b01b44c
commit a332ac08ed
8 changed files with 134 additions and 88 deletions
+10 -24
View File
@@ -73,35 +73,28 @@ where
let child_diagonal_length = (child_size as f32 / 2.) * f32::sqrt(3.);
let alpha;
let subdivided;
if (dist - (global_size as f32 / 2.)).abs() <= child_diagonal_length
{
//children.push(StructurePointer::new(depth <= 3, false, 0));
children.push(StructurePointer(
if depth < (self.chunk_power - 1)
{
0xFFFFFFFF
}
else
{
0
},
));
subdivided = depth < (self.chunk_power - 1);
alpha = if dist > 128. { 0. } else { 1. };
}
else if dist > (global_size as f32 / 2.)
{
children.push(StructurePointer(0));
subdivided = false;
alpha = 0.;
}
else
{
children.push(StructurePointer(0));
subdivided = false;
alpha = 1.;
}
// let alpha = 1.;
// children.push(StructurePointer::new(depth <= 3, false, 0));
children.push(StructurePointer::new(subdivided, subdivided || alpha != 0.));
children_color.push(Color(
gvx as f32 / global_size as f32,
gvy as f32 / global_size as f32,
@@ -530,28 +523,20 @@ where
let gcy = gny + cy * child_size;
let index = cz * N * N + cy * N + cx;
let alpha;
let subdivided;
if gcy > sample_max
{
children[index] = StructurePointer(0);
subdivided = false;
alpha = 0.;
}
else if gcy + child_size < sample_min
{
children[index] = StructurePointer(0);
subdivided = false;
alpha = 1.;
}
else
{
children[index] = StructurePointer(
if depth < (self.chunk_power - 1)
{
0xFFFFFFFF
}
else
{
0
},
);
subdivided = depth < (self.chunk_power - 1);
//children.push(StructurePointer(0));
alpha = if (sample_max + sample_min / 2) > gcy + (child_size / 2)
{
@@ -563,6 +548,7 @@ where
};
}
children[index] = StructurePointer::new(subdivided, subdivided || alpha != 0.);
children_color[index] = Color(color_avg.0, color_avg.1, color_avg.2, alpha);
}
}