Bridges-C++  3.4.2
Bridges(C++ API)
TerrainMesh.h
Go to the documentation of this file.
1 #ifndef TERRAIN_MESH
2 
3 #define TERRAIN_MESH
4 
5 #include <string>
6 #include <vector>
7 using namespace std;
8 
9 namespace bridges {
10  class TerrainMesh {
11 
12  private:
13  string name;
14  string type;
15  vector<float> vertices;
16  vector<float> colors;
17  int rows;
18  int cols;
19 
20  public:
22  TerrainMesh(string id, int r, int c, vector<float> elevation_data) {
23  name = id;
24  type = "terrain";
25  rows = r; cols = c;
26  vertices = elevation_data;
27  // set color for each vertex
28  for (int i = 0; i < rows; i++)
29  for (int j = 0; j < cols; j++)
30  for (int k = 0; k < 4; k++)
31  colors.push_back(1.);
32  }
33 
34  void setName (string n) {
35  name = n;
36  }
37 
38  string getName () {
39  return name;
40  }
41 
42  void setType (string t) {
43  type = t;
44  }
45 
46  string getType () {
47  return type;
48  }
49 
50  int getRows() {
51  return rows;
52  }
53 
54  void setRows(int r) {
55  rows = r;
56  }
57 
58  int getCols() {
59  return cols;
60  }
61 
62  void setCols(int c) {
63  cols = c;
64  }
65 
66 
67  vector<float> getColors() {
68  return colors;
69  }
70 
71  void setColors(vector<float> cols) {
72  colors = cols;
73  }
74 
75 
76  vector<float> getVertices() {
77  return vertices;
78  }
79 
80  void setVertices(vector<float>& v) {
81  vertices = v;
82  }
83  };
84 } //namespace bridges
85 
86 #endif
Definition: TerrainMesh.h:10
TerrainMesh()
Definition: TerrainMesh.h:21
void setVertices(vector< float > &v)
Definition: TerrainMesh.h:80
void setName(string n)
Definition: TerrainMesh.h:34
int getRows()
Definition: TerrainMesh.h:50
void setType(string t)
Definition: TerrainMesh.h:42
vector< float > getColors()
Definition: TerrainMesh.h:67
string getName()
Definition: TerrainMesh.h:38
void setCols(int c)
Definition: TerrainMesh.h:62
void setColors(vector< float > cols)
Definition: TerrainMesh.h:71
int getCols()
Definition: TerrainMesh.h:58
string getType()
Definition: TerrainMesh.h:46
void setRows(int r)
Definition: TerrainMesh.h:54
TerrainMesh(string id, int r, int c, vector< float > elevation_data)
Definition: TerrainMesh.h:22
vector< float > getVertices()
Definition: TerrainMesh.h:76
these methods convert byte arrays in to base64 codes and are used in BRIDGES to represent the color a...
Definition: alltypes.h:4