My Project
 All Classes Files Functions Variables Enumerations Pages
triangle_mesh_terrain.h
Go to the documentation of this file.
1 /**************************************************************************/
2 /* Copyright 2009 Tim Day */
3 /* */
4 /* This file is part of Fracplanet */
5 /* */
6 /* Fracplanet is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* Fracplanet is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU General Public License */
17 /* along with Fracplanet. If not, see <http://www.gnu.org/licenses/>. */
18 /**************************************************************************/
19 
24 #ifndef _triangle_mesh_terrain_h_
25 #define _triangle_mesh_terrain_h_
26 
27 #include "image.h"
28 #include "parameters_terrain.h"
29 #include "triangle_mesh.h"
30 
32 
36 class TriangleMeshTerrain : virtual public TriangleMesh
37 {
38  public:
39 
41  TriangleMeshTerrain(Progress* progress);
42 
45 
47 
49  virtual void write_povray(std::ofstream& out,const ParametersSave&,const ParametersTerrain&) const
50  =0;
51 
53 
55  virtual void write_blender(std::ofstream& out,const ParametersSave&,const ParametersTerrain&,const std::string& mesh_name) const;
56 
58  virtual void render_texture(Raster<ByteRGBA>&,Raster<ushort>*,Raster<ByteRGBA>*,bool shading,float ambient,const XYZ& illumination) const;
59 
60  protected:
61 
63  std::set<uint> sea_triangles;
64 
66  std::set<uint> river_vertices;
67 
69  float max_height;
70 
72  void do_noise(const ParametersTerrain& parameters);
73 
75  void do_sea_level(const ParametersTerrain& parameters);
76 
78  void do_power_law(const ParametersTerrain& parameters);
79 
81  void do_rivers(const ParametersTerrain& parameters);
82 
84  void do_colours(const ParametersTerrain& parameters);
85 
87  void do_terrain(const ParametersTerrain& parameters);
88 };
89 
92 {
93  public:
94 
97 
100  {}
101 
103  void write_povray(std::ofstream& out,const ParametersSave&,const ParametersTerrain&) const;
104 };
105 
108 {
109  public:
110 
112  TriangleMeshTerrainFlat(const ParametersTerrain& parameters,Progress* progress);
113 
116  {}
117 
119  void write_povray(std::ofstream& out,const ParametersSave&,const ParametersTerrain&) const;
120 };
121 
122 #endif