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 #include "parameters_render.h"
21 
22 #include "xyz.h"
23 
options()24 boost::program_options::options_description ParametersRender::options()
25 {
26   boost::program_options::options_description desc("Render options");
27   desc.add_options()
28     ("display-list,d","use display list rendering")
29     ("wireframe,w","render in wireframe mode")
30     ("invert-mouse-y,y","invert mouse-y in flight mode");
31   return desc;
32 }
33 
ParametersRender(const boost::program_options::variables_map & opts)34 ParametersRender::ParametersRender(const boost::program_options::variables_map& opts)
35   :wireframe(opts.count("wireframe"))
36   ,display_list(opts.count("display-list"))
37   ,joystick_mouse(!opts.count("invert-mouse-y"))
38   ,ambient(0.1f)
39   ,illumination_azimuth(-M_PI/3)
40   ,illumination_elevation(M_PI/6)
41   ,background_colour_low(0.25f,0.25f,1.0f,0.0f)
42   ,background_colour_high(0.0f,0.0f,0.0f,0.0f)
43   ,fps_target(60.0f)
44 {}
45 
~ParametersRender()46 ParametersRender::~ParametersRender()
47 {}
48 
illumination_direction() const49 const XYZ ParametersRender::illumination_direction() const
50 {
51   return XYZ
52     (
53      cos(illumination_azimuth)*cos(illumination_elevation),
54      sin(illumination_azimuth)*cos(illumination_elevation),
55      sin(illumination_elevation)
56      );
57 }
58