-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTerrain.hpp
69 lines (45 loc) · 1.54 KB
/
Terrain.hpp
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef TERRAIN_H
#define TERRAIN_H
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/glm.hpp>
#include <cmath>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include "rawModel.h"
#include "modelTexture.h"
#include "loader.h"
#include "TerrainTexture.hpp"
#include "TerrainTexturePack.hpp"
#include "math.hpp"
/*
Used to Return Array from Function
*/
typedef struct Height {
float height[256][256];
} HeightPojo;
/*
Terrain: hold All Data for Terrain.
*/
class Terrain {
public:
float x; // Position of Terrain in World
float z; // Position of Terrain in World
RawModel rawModel; // Raw Data for Terrain
ModelTexture modelTexture; // Main Texture for Terrain(grass)
TerrainTexture blendMap; // Terrain Bledn Map
TerrainTexturePack terrainTexturePack; // All Terrain Textures for MutliTexturing
Height heights; // Hold Data for Every Vertex Hight.
float getHeightOfTerrain(float worldX, float worldZ, Height heights);
Terrain(int gridX, int gridZ, Loader loader, TerrainTexturePack terrainTexturePack, TerrainTexture blendMap);
private:
float SIZE; // Default 800.0f
int VERTEX_COUNT; // Default 128
std::vector<std::string> removeDupWord(std::string str);
RawModel generateTerrain(Loader loader);
HeightPojo generateHeights(); // Genereate Vertex Terrain Heiht from Heigth Map
glm::vec3 calucalateNormal(int x, int z, HeightPojo heigts);
};
#endif // TERRAIN_H