GlobeEngine
Heightfield.h
Go to the documentation of this file.
1 //
2 // Heightfield.h
3 // GlobeEngine
4 //
5 // Created by Mathias Thöny on 27.12.11.
6 // Copyright (c) 2011 University of Zurich. All rights reserved.
7 //
8 
9 #ifndef GlobeEngine_Heightfield_h
10 #define GlobeEngine_Heightfield_h
11 
12 #include <string>
13 #include "OpenGL_Includes.h"
14 #include "DrawableComponent.h"
15 #include "VBOVertex.h"
16 #include "ColorisationTable.h"
17 
18 namespace geData {
20  {
21  public:
24 
25  void clear();
26  void destroy();
27  void create();
28  void create(int _verticesPerRow, int _verticesPerColumn, float _distBetweenVertices, float* &_heights);
29  void create(int _verticesPerRow, int _verticesPerColumn, float _distBetweenVertices, float* &_heights, ColorisationTable* _colortable);
30 
31  public:
32  void draw(std::shared_ptr<ge::Camera> _cam, GLuint _texHandle);
33  void update();
34  float getMaxHeight();
35  float getMinHeight();
36  float getMinMaxHeight();
37 
38  private:
39  void createRenderingStructures();
40  void createBounds();
41  void createVAO();
42  void createDiscretizedColorMap(GLfloat* &colorBuffer, int indexInBuffer, int discretizationLevels, vmml::Vector3f* &colors, GLfloat maxValue, GLfloat minValue);
43  void assignColorFromMap();
44 
45  private:
46  float rowLength;
47  float columnLength;
48  int verticesPerRow;
49  int verticesPerColumn;
50  float dist;
51  int trianglesPerRow;
52  float alpha;
53  int numberOfTriangleStrip;
54 
55 
56  int indexCountperStrip;
57 
58  float* heights;
59  float maxHeight;
60  float minHeight;
61  float diffHeight;
62  ge::Vertex3f* vertices;
63  ge::Vertex3f* normals;
64  GLuint* indices;
65  GLfloat* texCoord1D;
66 
67  GLuint vboVertexObject;
68  GLuint vboIndexObject;
69  GLuint vboNormalObject;
70  GLuint vboTexCoordObject;
71  ge::VBOVertex3f* vboVertices;
72  ge::VBOVertex3f* vboNormals;
73  GLuint* vboIndices;
74  bool geometryIsReady;
75  // Texture handle
76  ColorisationTable* colortable;
77 
78 
79 
80  };
81 }
82 #endif
Definition: DrawableComponent.h:25
float getMinHeight()
Definition: Heightfield.cpp:326
void update()
Definition: Heightfield.cpp:320
void create()
Definition: Heightfield.cpp:21
Definition: AvalancheTrainingSimulationEngine.h:39
Definition: ColorisationTable.h:31
~Heightfield()
Definition: Heightfield.h:23
void draw(std::shared_ptr< ge::Camera > _cam, GLuint _texHandle)
Definition: Heightfield.cpp:250
float getMinMaxHeight()
Definition: Heightfield.cpp:336
Heightfield()
Definition: Heightfield.h:22
Definition: VBOVertex.h:115
void destroy()
Definition: Heightfield.cpp:16
float getMaxHeight()
Definition: Heightfield.cpp:331
Definition: Heightfield.h:19
void clear()
Definition: Heightfield.cpp:8