Bliss-Shader/shaders/lib/voxel_write.glsl
2024-05-01 16:32:25 -04:00

8 lines
281 B
GLSL

void SetVoxelBlock(const in vec3 playerPos, const in uint blockId) {
vec3 cameraOffset = fract(cameraPosition);
ivec3 voxelPos = ivec3(floor(playerPos + cameraOffset + VoxelSize/2u));
// TODO: exit early if outside bounds
imageStore(imgVoxelMask, voxelPos, uvec4(blockId));
}