Minor cleanup
This commit is contained in:
parent
89a35db491
commit
05ce6e42c3
1 changed files with 4 additions and 20 deletions
|
@ -39,22 +39,6 @@ impl Vertex for TerrainVertex {
|
|||
}
|
||||
}
|
||||
|
||||
const fn index_to_coord(i: usize) -> (usize, usize, usize) {
|
||||
let x = i % CHUNK_SIZE;
|
||||
let y = (i / CHUNK_SIZE) % CHUNK_SIZE;
|
||||
let z = i / CHUNK_SIZE.pow(2);
|
||||
(x, y, z)
|
||||
}
|
||||
|
||||
fn index_to_pos(i: usize) -> Vector3<f32> {
|
||||
let (x, y, z) = index_to_coord(i);
|
||||
(x as f32, y as f32, z as f32).into()
|
||||
}
|
||||
|
||||
const fn pos_to_index(x: usize, y: usize, z: usize) -> usize {
|
||||
x + y * CHUNK_SIZE + z * CHUNK_SIZE.pow(2)
|
||||
}
|
||||
|
||||
fn generate_terrain_voxels(
|
||||
seed: u64,
|
||||
chunk_coords: Vector3<i32>,
|
||||
|
@ -269,10 +253,10 @@ mod tests {
|
|||
let [x, y, z] = v.position;
|
||||
println!("v {} {} {}", x, y, z);
|
||||
}
|
||||
// for v in &vert {
|
||||
// let [x, y, z] = v.normal;
|
||||
// println!("vn {} {} {}", x, y, z);
|
||||
// }
|
||||
for v in &vert {
|
||||
let [x, y, z] = v.normal;
|
||||
println!("vn {} {} {}", x, y, z);
|
||||
}
|
||||
for i in idx.chunks(3) {
|
||||
println!("f {} {} {}", i[0] + 1, i[1] + 1, i[2] + 1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue