#pragma once

#include "heightmap.h"
#include "skybox.h"
#include "math.h"
#include "map.h"

const int max_size = 32;

class rQuadTree
{
public:
	~rQuadTree();
	void Create(rMap *Map, int side_Size, vector3* normalArray, float* heightArray);
	rQuadTree FindPoint(vector3 point);
	void Draw();

	float getHeight(int x, int y);
private:
	void DrawRec();
	void CreateRec(rMap *Map, int X, int Z, int side_Size, vector3* normalArray, float* heightArray);

	rQuadTree	*nodes;
	rHeightMap	*HM;
	rMap	*g_Map;
	int		x;
	int		z;
	float	highestY;
	float	lowestY;
	int		sideSize;
	bool	bDivided;
};

