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

float offset = m_count;

float map(vec3 v) {
	float dy = v.y + offset;

	if (v.y >= m_offset) {
		if (dy >= i_volume_size.y) {
			return 0.0;
		} else {
			return voxel(vec3(v.x, dy, v.z));
		}
	} else {
		return voxel(v);
	}
}