#pragma once

#include <uf/config.h>
#include <uf/ext/ext.h>
#include <uf/engine/entity/entity.h>
#include <uf/engine/scene/scene.h>
#include <uf/utils/math/vector.h>
#include <uf/utils/math/matrix.h>
#include <uf/utils/renderer/renderer.h>

namespace ext {
	namespace VoxelizerSceneBehavior {
		UF_BEHAVIOR_DEFINE_TYPE();
		EXT_BEHAVIOR_DEFINE_TRAITS();
		EXT_BEHAVIOR_DEFINE_FUNCTIONS();
		UF_BEHAVIOR_DEFINE_METADATA(
			pod::Vector3ui fragmentSize = { 0, 0 };
			pod::Vector3ui voxelSize = { 0, 0, 0 };
			pod::Vector3ui dispatchSize = { 0, 0, 0 };
			uf::stl::string renderModeName = "VXGI";

			uf::renderer::Buffer atomicCounter;
		#if !UF_USE_OPENGL
			uf::stl::vector<VkImageView> views;
		#endif
			
			size_t cascades = 0;
			float cascadePower = 0;
			float granularity = 0;
			float voxelizeScale = 0;
			float occlusionFalloff = 0;
			float traceStartOffsetFactor = 1.0f;
			uint32_t shadows = 0;
			uf::stl::string filtering = "LINEAR";

			struct {
				pod::Vector3f min = {};
				pod::Vector3f max = {};
				pod::Matrix4f matrix = uf::matrix::identity();
			} extents;
			struct {
				float frequency = 0.0f;
				float timer = 0.0f;
			} limiter;
			bool initialized = false;
		);
	}
}