// Copyright (c) 2023 Lachlan McDonald
// This work is licensed under the MIT License (MIT)
// https://github.com/lachlanmcdonald/magicavoxel-shaders
//
// xs flood [Height]
//
// xs_begin
// author : '@lmcdx.bsky.social'
// arg : { name = 'Height'  var = 'm_height'  range = '1 256'  value = '1'  step = '1'  precision = '0' }
// xs_end

float map(vec3 v) {
	float index = voxel(v);

	if (index == 0.0) {
		if (v.z < m_height) {
			return i_color_index;
		}
	}

	return index;
}