
struct Area2D{

	Area2D(C VecI2 &xz, Ptr grid_user);
	~Area2D();
	void Load();
	void Save();
	void Build();
	void Stitch(C Heightmap &right, C Heightmap &down);
	void update();// update
	void Draw();
	void CreatePhysics();
	void RemovePhysics();

	void Unload();
	C Vec Pos()C{ return mat.pos; }

	AREA_STATE state;
	VecI2 pos;
	EE::Heightmap hm;
private:
	Flt   last_update;
	Image img;
	Matrix mat;
	void BuildMesh(); // build 'mesh', 'phys' and 'actor' from 'heightmap'
	
	Mesh mesh;
	PhysPart phys; 
	Actor actor;
	MaterialPtr material;
};