#ifndef TERRAIN_MODULE_H_
#define TERRAIN_MODULE_H
#include <flecs.h>
namespace Ogre
{
class TerrainGlobalOptions;
class TerrainGroup;
class TerrainPaging;
class PageManager;
class PagedWorld;
class TerrainPagedWorldSection;
}
namespace ECS
{
class FlatTerrainDefiner;
struct Terrain {
	Ogre::TerrainGlobalOptions *mTerrainGlobals;
	Ogre::TerrainGroup *mTerrainGroup;
	Ogre::TerrainPaging *mTerrainPaging;
	Ogre::PageManager *mPageManager;
	Ogre::PagedWorld *mPagedWorld;
	FlatTerrainDefiner *definer;
	Ogre::TerrainPagedWorldSection *mTerrainPagedWorldSection;
	bool mTerrainReady;

	Ogre::Vector3 mTerrainPos;
};
struct PlacementObjects {
	struct item {
		Ogre::String entity;
		Ogre::Quaternion rotation;
		Ogre::Vector3 position;
	};
	std::vector<struct item> altar_items;
};
struct TerrainModule {
	TerrainModule(flecs::world &ecs);
	static float get_height(Ogre::TerrainGroup *group,
				const Ogre::Vector3 &position);
	static float get_world_x(int x);
	static float get_world_y(int y);
	static int get_img_x(float world_x);
	static int get_img_y(float world_z);
	static void update_heightmap(const Ogre::Image &heightmap);
	static void save_heightmap();
	static void defineTerrain(long x, long y);
};
struct TerrainReady {};
}
#endif