Bliss-Shader/shaders/lib/voxel_write.glsl

8 lines
281 B
Plaintext
Raw Normal View History

2024-05-01 13:40:52 -04:00
void SetVoxelBlock(const in vec3 playerPos, const in uint blockId) {
vec3 cameraOffset = fract(cameraPosition);
2024-05-01 16:32:25 -04:00
ivec3 voxelPos = ivec3(floor(playerPos + cameraOffset + VoxelSize/2u));
// TODO: exit early if outside bounds
2024-05-01 13:40:52 -04:00
imageStore(imgVoxelMask, voxelPos, uvec4(blockId));
}