Line data Source code
1 : /**
2 : * @file Terrain.h
3 : * @brief generate and manage terrain game objects.
4 : *
5 : * Terrain game object.
6 : */
7 : #ifndef _TERRAIN_H_
8 : #define _TERRAIN_H_
9 :
10 : #include "constants.h"
11 : #include "Object.h"
12 : #include "DisplayList.h"
13 :
14 : class Terrain : public Object {
15 : public:
16 : Terrain();
17 : ~Terrain();
18 :
19 : void draw(Object*);
20 : void drawOutline(Object*);
21 :
22 0 : void handleCollision(Object* temp) {}
23 : void animate(const float&, Object*);
24 : void generate();
25 :
26 : void calcTerrainNorm(Vector*);
27 : void calcViewableTerrainNorm();
28 : void update(Vector*);
29 :
30 : void init();
31 : void load(const char*, Vector*);
32 : void save(const char*, Vector*);
33 : void unload();
34 :
35 : float getHeight(const float&, const float&);
36 :
37 0 : void printTypeName() { PRINT_DEBUG("Terrain\n"); }
38 : virtual void buildLuaObjectTable(lua_State *L);
39 : virtual void transferLuaObjectTable(lua_State *L);
40 : void drawGrid();
41 :
42 : void setVertexHeight(const int&, const int&, const float&);
43 : void setVertexType(const int&, const int&, const int&);
44 : void setVertexColor(const int&, const int&, const Vector&);
45 : float getVertexHeight(const int&, const int&);
46 : int getVertexType(const int&, const int&);
47 : Vector getVertexColor(const int&, const int&);
48 :
49 : DisplayList* getDisplayList() { return displayList_; }
50 9 : void setDisplayList(DisplayList* displayList) { displayList_ = displayList; }
51 :
52 9 : int getXSize() { return xSize_; }
53 9 : int getZSize() { return zSize_; }
54 27 : int getScaleFactor() { return scaleFactor_; }
55 :
56 : void setCurveDistance(const GLfloat &curveDistance) { curveDistance_ = curveDistance; }
57 : void setCurveRate(const GLfloat &curveRate) { curveRate_ = curveRate; }
58 : void setIsCurveEnabled(const bool &isCurveEnabled) { isCurveEnabled_ = isCurveEnabled; }
59 : GLfloat getCurveDistance() { return curveDistance_; };
60 : GLfloat getCurveRate() { return curveRate_; };
61 : GLfloat getIsCurveEnabled() { return isCurveEnabled_; }
62 :
63 : private:
64 : DisplayList* displayList_;
65 :
66 : GLint xSize_, zSize_;
67 : GLfloat scaleFactor_;
68 :
69 : GLfloat*** vertex_;
70 : GLfloat** lightIntensity_;
71 : GLfloat*** color_;
72 : Vector **vertexNormal_;
73 : int** type_;
74 :
75 : GLfloat curveDistance_;
76 : GLfloat curveRate_;
77 : bool isCurveEnabled_;
78 :
79 : float totalTime_;
80 :
81 : Vector *light_;
82 : };
83 :
84 : #endif
|