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 
20 /*! \file
21   \brief Interface for class TriangleMeshCloud and derived classes.
22 */
23 
24 #ifndef _triangle_mesh_cloud_h_
25 #define _triangle_mesh_cloud_h_
26 
27 #include "common.h"
28 #include "image.h"
29 #include "parameters_cloud.h"
30 #include "triangle_mesh.h"
31 
32 //! This class holds all the cloud-related methods.
33 /*! It's intended to be used as a "mix-in", adding cloud generating
34   functionality to cloud objects subclassed from simpler geometries.
35   \todo Ugh!!!  This is really yucky use of multiple inheritance.  Better for these terrain types to have-a TriangleMesh.
36  */
37 class TriangleMeshCloud : virtual public TriangleMesh
38 {
39  public:
40 
41   //! Constructor.
42   TriangleMeshCloud(Progress* progress);
43 
44   //! Destructor.
45   ~TriangleMeshCloud();
46 
47   //! Dump mesh to file for POV-Ray
48   void write_povray(std::ofstream& out,const ParametersSave&,const ParametersCloud&) const;
49 
50   //! Dump mesh to file for Blender
51   void write_blender(std::ofstream& out,const ParametersSave&,const ParametersCloud&,const std::string& mesh_name) const;
52 
53   //! Render the mesh onto a raster image.
54   /*! The only interesting thing with clouds is their alpha, so render a greyscale.
55   */
56   void render_texture(Raster<uchar>&) const;
57 
58  protected:
59 
60   void do_cloud(const ParametersCloud& parameters);
61 };
62 
63 //! Class constructing specific case of a planetary cloud.
64 class TriangleMeshCloudPlanet : public TriangleMeshSubdividedIcosahedron, virtual public TriangleMeshCloud
65 {
66  public:
67   //! Constructor.
68   TriangleMeshCloudPlanet(const ParametersCloud& param,Progress* progress);
69 
70   //! Destructor.
~TriangleMeshCloudPlanet()71   ~TriangleMeshCloudPlanet()
72     {}
73 };
74 
75 //! Class constructing specific case of a flat-base terrain area.
76 class TriangleMeshCloudFlat : public TriangleMeshFlat, virtual public TriangleMeshCloud
77 {
78  public:
79   //! Constructor.
80   TriangleMeshCloudFlat(const ParametersCloud& parameters,Progress* progress);
81 
82   //! Destructor.
~TriangleMeshCloudFlat()83   ~TriangleMeshCloudFlat()
84     {}
85 };
86 
87 #endif
88