altEngine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
terrain.h
Go to the documentation of this file.
1 #include "include.h"
2 
3 #ifndef TERRAIN_H
4 #define TERRAIN_H
5 
6 class Terrain
7 {
8 public:
9  Terrain();
10  int load(Graphics &gfx, float scale, vec3 &offset, char *heightmap, char *texture_str, bool sphere, int anisotropic);
11  int CreateMesh(char *heightmap, float scale_width, float scale_height, vec3 &offset, vertex_t *&vertex, unsigned int *&index, unsigned int &num_vertex, unsigned int &num_index);
12  void render(Graphics &gfx);
13  bool collision_detect(RigidBody &body);
14  float GetHeight(const vec3 &position, vec3 &normal);
15  void Smooth(vertex_t *image, int width, int height, vec3 &avg);
16  int CreateWater(float scale_width, float scale_height, vertex_t *&vertex, unsigned int *&index, unsigned int &num_vertex, unsigned int &num_index);
17 
18  void CreateSphere(char *heightmap, float radius, vec3 &offset, vertex_t *&vertex, unsigned int *&index, unsigned int &num_vertex, unsigned int &num_index);
19 
20  float height;
21  int x_index;
22  int y_index;
23  int top;
24 private:
25 
26  float size;
28  int num_col;
29  int num_row;
30  float trilength;
31  bool loaded;
32 
33 
36  unsigned int *water_index;
37  unsigned int water_nvertex;
38  unsigned int water_nindex;
39  int water_vbo;
40  int water_ibo;
41  int water_tex;
42 
43 
44 
45 
47  unsigned int *index_array;
48  unsigned int num_vertex;
49  unsigned int num_index;
50  int vbo;
51  int ibo;
53 };
54 
55 #endif