feat: Starting a proper attribtues description for voxel attributes

This commit is contained in:
2026-11-17 22:04:22 +01:00
parent 9b8fd9840e
commit 95a45a57d7
12 changed files with 1181 additions and 87 deletions
+2 -11
View File
@@ -68,6 +68,7 @@ use vxls_bvh::BvhStructureTable;
use vxls_bvh::aabb::Aabb;
use vxls_bvh::build::Bvh;
use vxls_bvh::debug::BvhDebugPipeline;
use vxls_production::Attributes;
use vxls_production::ProducerId;
use vxls_production::StructureAnchor;
use vxls_production::StructureLocator;
@@ -395,17 +396,7 @@ impl State
let egui_renderer = EguiRenderer::new(&device, surface_format, &window);
let mut layout = vxls_voxel_cache::layout::CacheLayout::default();
layout.add_attribute(vxls_voxel_cache::CacheAttribute {
label: Some("color"),
word_count: 1,
init: vxls_voxel_cache::CacheAttributeInit::External,
});
layout.add_attribute(vxls_voxel_cache::CacheAttribute {
label: Some("normal"),
word_count: 3,
init: vxls_voxel_cache::CacheAttributeInit::External,
});
let layout = crate::producers::VoxelAttributes::LAYOUT.to_cache_layout_only();
let request_buffer = CacheRequestBuffer::new(&device, 1024);
let voxel_cache =
+18
View File
@@ -1,6 +1,8 @@
use std::fs::File;
use std::path::Path;
use bytemuck::Pod;
use bytemuck::Zeroable;
use glam::Vec3;
use itertools::Itertools;
use noise::Cylinders;
@@ -12,6 +14,22 @@ use rand::random;
use crate::sparse_tree::Color;
use vxls_voxel_cache::schema::ChildInformation;
/// The voxel attributes used by the demo cache.
///
/// The field order is load-bearing: attribute 0 is a packed RGBA color and
/// attribute 1 is a 3-word normal, matching `fetch_color` / `fetch_normal` in
/// `shaders/voxel.slang`.
#[derive(Clone, Copy, PartialEq, Default, Pod, Zeroable, vxls_production::Attributes, Debug)]
#[repr(C)]
pub struct VoxelAttributes
{
#[attribute(label = "color", semantic = "color")]
pub color: u32,
#[attribute(label = "normal", semantic = "normal")]
pub normal: [f32; 3],
}
pub struct BallGenerator<const N: usize>
{
chunk_power: usize,