From: Brendan Hansen Date: Sun, 19 Dec 2021 16:10:10 +0000 (-0600) Subject: "lighting" X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=2eed94e4d7ae44a4043410897b7d669a640efad7;p=voxel-shooter.git "lighting" --- diff --git a/src/chunk.onyx b/src/chunk.onyx index 25c2eb4..f592b24 100644 --- a/src/chunk.onyx +++ b/src/chunk.onyx @@ -15,7 +15,7 @@ block_make :: (red, green, blue: f32, brightness: f32) -> Block { return ~~((i << 12) | (b << 8) | (g << 4) | r); } -Chunk_Size :: 16 +Chunk_Size :: 32 Chunk :: struct { blocks: [] Block; @@ -93,11 +93,18 @@ chunk_build_mesh :: (use chunk: ^Chunk) -> ^Mesh { nz := z + n.z; if chunk_get(chunk, nx, ny, nz) != Block_Empty do continue; + color := block; + if i != 4 { + color = cast(Block) (0xb000 | (0xfff & cast(u32) color)); + } + if i == 5 { + color = cast(Block) (0x9000 | (0xfff & cast(u32) color)); + } indicies := cast([] u32) block_indicies[i]; for j: 6 { v := block_verticies[indicies[j]]; - verticies << .{ ~~x+v.x, ~~y+v.y, ~~z+v.z, ~~block }; + verticies << .{ ~~x+v.x, ~~y+v.y, ~~z+v.z, ~~color }; } } };