My Project: openb3dlib.mod/openb3d/src/terrain.h Source File

My Project

terrain.h
Go to the documentation of this file.
1 /*
2 * terrain.h
3 * minib3d
4 *
5 *
6 */
7
8 #ifndef TERRAIN_H
9 #define TERRAIN_H
10
11
12 #include <iostream>
13 #include <string>
14
15 #include "shadermat.h"
16
17
18 using namespace std;
19
20 const int ROAM_LMAX = 20; //<-----------terrain detail here
21
22 class Terrain : public Entity{
23 private:
24 float dradius;
25 float* NormalsMap;
26 float xcf,ycf,zcf; //used to store camera position
27
28 public:
29 static list<Terrain*> terrain_list;
30 static int triangleindex;
31 static MeshInfo* mesh_info;
32
33 float size; //terrainsize
34 float vsize; //terrainheight
35
36 float level2dzsize[ROAM_LMAX+1]; /* Max midpoint displacement per level */
37 float* height; //heightmap
38 MeshCollider* c_col_tree;
39
40 Camera* eyepoint; //reference to camera
41
42 Shader* ShaderMat;
43
44
45 static Terrain* CreateTerrain(int tsize=0, Entity* parent_ent=NULL);
46 static Terrain* LoadTerrain(string filename,Entity* parent_ent=NULL);
47 Terrain* CopyEntity(Entity* parent_ent=NULL);
48 void FreeEntity(void);
49
50 virtual void UpdateTerrain();
51 void RecreateROAM();
52 void drawsub(int l, float v0[], float v1[], float v2[]);
53 void UpdateNormals();
54 void ModifyTerrain (int x, int z, float height);
55 virtual void TreeCheck(CollisionInfo* ci);
56 void col_tree_sub(int l, float v0[], float v1[], float v2[]);
57 float TerrainHeight (int x, int z);
58 float TerrainX (float x, float y, float z);
59 float TerrainY (float x, float y, float z);
60 float TerrainZ (float x, float y, float z);
61
62 Terrain(){
63 size=0;
64 ShaderMat=0;
65 };
66
67
68
69
70
71
72 };
73
74 #endif
Terrain::height
float * height
Definition: terrain.h:37
Terrain::mesh_info
static MeshInfo * mesh_info
Definition: terrain.h:31
Terrain::eyepoint
Camera * eyepoint
Definition: terrain.h:40
UpdateNormals
void UpdateNormals(Mesh *mesh)
Definition: functions.cpp:1603
col_tree_sub
void col_tree_sub(Terrain *obj, int l, float v0[], float v1[], float v2[])
Definition: methods.cpp:454
CreateTerrain
Terrain * CreateTerrain(int size, Entity *parent)
Definition: functions.cpp:574
Terrain
Definition: terrain.h:22
TerrainZ
float TerrainZ(Terrain *terr, float x, float y, float z)
Definition: functions.cpp:1491
CopyEntity
Entity * CopyEntity(Entity *ent, Entity *parent)
Definition: functions.cpp:421
std
TreeCheck
void TreeCheck(Mesh *obj)
Definition: methods.cpp:312
TerrainY
float TerrainY(Terrain *terr, float x, float y, float z)
Definition: functions.cpp:1484
Camera
Definition: camera.h:23
Terrain::triangleindex
static int triangleindex
Definition: terrain.h:30
FreeEntity
void FreeEntity(Entity *ent)
Definition: functions.cpp:882
MeshCollider
Definition: tree.h:14
Terrain::Terrain
Terrain()
Definition: terrain.h:62
Entity
Definition: entity.h:27
RecreateROAM
void RecreateROAM(Terrain *obj)
Definition: methods.cpp:442
drawsub
void drawsub(Terrain *obj, int l, float v0[], float v1[], float v2[])
Definition: methods.cpp:446
ModifyTerrain
void ModifyTerrain(Terrain *terr, int x, int z, float new_height)
Definition: functions.cpp:1115
Terrain::terrain_list
static list< Terrain * > terrain_list
Definition: terrain.h:29
ROAM_LMAX
const int ROAM_LMAX
Definition: terrain.h:20
Terrain::size
float size
Definition: terrain.h:33
TerrainX
float TerrainX(Terrain *terr, float x, float y, float z)
Definition: functions.cpp:1476
Shader
Definition: shadermat.h:56
shadermat.h
UpdateTerrain
void UpdateTerrain(Terrain *obj)
Definition: methods.cpp:438
Terrain::vsize
float vsize
Definition: terrain.h:34
Terrain::c_col_tree
MeshCollider * c_col_tree
Definition: terrain.h:38
CollisionInfo
Definition: collision.h:51
Terrain::ShaderMat
Shader * ShaderMat
Definition: terrain.h:42
MeshInfo
Definition: tree.h:55
LoadTerrain
Terrain * LoadTerrain(char *file, Entity *parent)
Definition: functions.cpp:1057
TerrainHeight
float TerrainHeight(Terrain *terr, int x, int z)
Definition: functions.cpp:1469
NULL
#define NULL
Definition: tree.cpp:4