-
Notifications
You must be signed in to change notification settings - Fork 1
/
landscape.h
55 lines (40 loc) · 1.08 KB
/
landscape.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* LoD terrain generation and displaying
* Svoboda Petr, Vojvoda Jakub
*
* 2014
*
*/
#ifndef LANDSCAPE_H
#define LANDSCAPE_H
#include "patch.h"
#include "pgr.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <exception>
#define MAP_SIZE (513)
#define NUM_PATCHES_PER_SIDE (8)
#define POOL_SIZE (150000)
#define PATCH_SIZE (MAP_SIZE/NUM_PATCHES_PER_SIDE)
#define MAX(a,b) ((a < b) ? (b) : (a))
extern glm::vec3 camera;
class Landscape
{
protected:
Patch m_Patches[NUM_PATCHES_PER_SIDE][NUM_PATCHES_PER_SIDE];
std::vector<Patch*> sorted_distance;
static int m_NextTriNode;
static TriTreeNode m_TriPool[POOL_SIZE];
static int GetNextTriNode() { return m_NextTriNode; }
static void SetNextTriNode( int nNextNode ) { m_NextTriNode = nNextNode; }
public:
float** heightMap;
static TriTreeNode *AllocateTri();
void updateDistance();
void splitBasedOnDistance();
void renderBasedOnDistance();
void Init(float **hMap);
void Reset();
};
#endif