proper grid line tracing

This commit is contained in:
2024-06-04 22:35:49 -04:00
parent f455837183
commit ac35252272
2 changed files with 137 additions and 28 deletions

View File

@@ -125,7 +125,7 @@ impl VoxelPipeline {
r: (x as f32 / lx as f32 * 255.0) as u8,
g: (y as f32 / ly as f32 * 255.0) as u8,
b: 0,
a: 20,
a: 100,
};
}
}
@@ -149,10 +149,11 @@ impl VoxelPipeline {
data.len(),
&[ArrBufUpdate { offset: 0, data }],
);
let thing = Translation3::new(0.0, 0.0, 20.0)
* Rotation3::from_axis_angle(&Vector3::y_axis(), 0.5)
* Translation3::new(-(lx as f32 / 2.0), -(ly as f32 / 2.0), -(lz as f32 / 2.0));
let group = VoxelGroup {
transform: Transform3::identity()
* (Translation3::new(-5.0, -5.0, 20.0)
* Rotation3::from_axis_angle(&Vector3::y_axis(), 0.5)).inverse(),
transform: Transform3::identity() * thing.inverse(),
dimensions: Vector3::new(lx as u32, ly as u32, lz as u32),
};
self.voxel_groups.update(