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 /*! \mainpage Fracplanet : fractal terrain generator
21 
22   \author Tim Day
23 
24   \section introduction Introduction
25   "Fracplanet" is an interactive tool for generating fractal planets and terrains.
26   It can output the generated meshes to files suitable for use by POV-Ray.
27 
28   \todo For new features to be added, see the TODO file.
29  */
30 
31 #include "fracplanet_main.h"
32 
33 //! Application code
34 /*! Currently this simply creates a TriangleMesh object of some sort,
35   then passes it to a viewer.
36  */
main(int argc,char * argv[])37 int main(int argc,char* argv[])
38 {
39   QApplication app(argc,argv);
40 
41   boost::program_options::variables_map opts;
42   try
43     {
44       boost::program_options::options_description opt_desc
45 	("Recognised options (besides Qt standards):");
46 
47       opt_desc.add_options()
48 	("help,h","show list of recognised options")
49 	("verbose,v","verbose output to stderr")
50 	;
51 
52       opt_desc.add(ParametersRender::options());
53 
54       boost::program_options::store
55 	(
56 	 boost::program_options::parse_command_line(argc,argv,opt_desc),
57 	 opts
58 	 );
59       boost::program_options::notify(opts);
60 
61       if (opts.count("help"))
62 	{
63 	  std::cerr << opt_desc << std::endl;
64 	  return 1;
65 	}
66     }
67   catch (boost::program_options::error& e)
68     {
69       std::cerr << "Bad command line: " << e.what() << std::endl;
70       std::cerr << "Use -h or --help to list recognised options" << std::endl;
71       return 1;
72     }
73 
74   const bool verbose=opts.count("verbose");
75 
76   if (verbose)
77     std::cerr << "Setting up...\n";
78 
79   FracplanetMain*const main_widget=new FracplanetMain(0,&app,opts,verbose);
80 
81   if (verbose)
82     std::cerr << "...setup completed\n";
83 
84   main_widget->show();
85 
86   if (verbose)
87     {
88       std::cerr << "Fracplanet:" << std::endl;
89       std::cerr << "  sizeof(ByteRGBA) is " << sizeof(ByteRGBA) << " (4 is good)" << std::endl;
90       std::cerr << "  sizeof(Vertex)   is " << sizeof(Vertex) << " (32 is good)" << std::endl;
91       std::cerr << "  sizeof(Triangle) is " << sizeof(Triangle) << " (12 is good)" << std::endl;
92     }
93 
94   main_widget->regenerate();
95 
96   return app.exec();
97 }
98