Reputation: 63
i have made an octree in rust
pub struct Octree {
pub root: [u32; 3],
pub width: u32,
pub leaf: Leaf,
}
pub struct Leaf {
pub children: Vec<Leaf>,
pub voxel: OctreeVoxel,
}
pub struct OctreeVoxel {
pub id: u8,
pub color: u8,
pub padding: [u8; 2],
}
and i am serialising this octree into a buffer and sending it to the gpu. in gpu land (wgsl) i was trying to implement it the same way, but then i get this error saying its recursive:
struct Octree {
root: array<u32, 3>,
width: u32,
leaf: Leaf,
}
struct Leaf {
children: array<Leaf>,
voxel: OctreeVoxel,
}
struct OctreeVoxel {
id: u32,
color: u32,
padding: array<u32, 2>,
}
error: declaration of `Leaf` is recursive
┌─ wgsl:7:8
│
7 │ struct Leaf {
│ ^^^^
8 │ children: array<Leaf>,
│ ^^^^ uses itself here
i was wondering if there might be a way to raymarch into this tree without me having to implement my own way of reading the raw serialised data.
if you would need any extra info id be happy to provide it :) and any help is much appresiated :)
Upvotes: 1
Views: 222