~ubuntu-branches/debian/squeeze/stellarium/squeeze

« back to all changes in this revision

Viewing changes to src/draw.h

  • Committer: Bazaar Package Importer
  • Author(s): Cédric Delfosse
  • Date: 2008-05-19 21:28:23 UTC
  • mfrom: (3.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080519212823-m5nfiuntxstxzxj7
Tags: 0.9.1-4
Add libxcursor-dev, libxfixes-dev, libxinerama-dev, libqt4-opengl-dev to
build-deps (Closes: #479906)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Stellarium
3
 
 * Copyright (C) 2002 Fabien Chereau
4
 
 * 
5
 
 * This program is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU General Public License
7
 
 * as published by the Free Software Foundation; either version 2
8
 
 * of the License, or (at your option) any later version.
9
 
 * 
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 * 
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 */
19
 
 
20
 
#ifndef __DRAW_H__
21
 
#define __DRAW_H__
22
 
 
23
 
#include <string>
24
 
#include <fstream>
25
 
#include "stellarium.h"
26
 
#include "s_font.h"
27
 
#include "projector.h"
28
 
#include "navigator.h"
29
 
#include "tone_reproductor.h"
30
 
#include "fader.h"
31
 
#include "translator.h"
32
 
 
33
 
// Class which manages a grid to display in the sky
34
 
class SkyGrid
35
 
{
36
 
public:
37
 
        enum SKY_GRID_TYPE
38
 
        {
39
 
                EQUATORIAL,
40
 
                ALTAZIMUTAL
41
 
        };
42
 
        // Create and precompute positions of a SkyGrid
43
 
        SkyGrid(SKY_GRID_TYPE grid_type = EQUATORIAL, unsigned int _nb_meridian = 24, unsigned int _nb_parallel = 17,
44
 
         double _radius = 1., unsigned int _nb_alt_segment = 18, unsigned int _nb_azi_segment = 50);
45
 
    virtual ~SkyGrid();
46
 
        void draw(const Projector* prj) const;
47
 
        void set_font(float font_size, const string& font_name);
48
 
        void setColor(const Vec3f& c) {color = c;}
49
 
        const Vec3f& getColor() {return color;}
50
 
        void update(int delta_time) {fader.update(delta_time);}
51
 
        void set_fade_duration(float duration) {fader.set_duration((int)(duration*1000.f));}
52
 
        void setFlagshow(bool b){fader = b;}
53
 
        bool getFlagshow(void) const {return fader;}
54
 
        void set_top_transparancy(bool b) { transparent_top= b; }
55
 
private:
56
 
        unsigned int nb_meridian;
57
 
        unsigned int nb_parallel;
58
 
        double radius;
59
 
        unsigned int nb_alt_segment;
60
 
        unsigned int nb_azi_segment;
61
 
        bool transparent_top;
62
 
        Vec3f color;
63
 
        Vec3f** alt_points;
64
 
        Vec3f** azi_points;
65
 
        bool (Projector::*proj_func)(const Vec3d&, Vec3d&) const;
66
 
        s_font* font;
67
 
        SKY_GRID_TYPE gtype;
68
 
        LinearFader fader;
69
 
};
70
 
 
71
 
 
72
 
// Class which manages a line to display around the sky like the ecliptic line
73
 
class SkyLine
74
 
{
75
 
public:
76
 
        enum SKY_LINE_TYPE
77
 
        {
78
 
                EQUATOR,
79
 
                ECLIPTIC,
80
 
                LOCAL,
81
 
                MERIDIAN
82
 
        };
83
 
        // Create and precompute positions of a SkyGrid
84
 
        SkyLine(SKY_LINE_TYPE _line_type = EQUATOR, double _radius = 1., unsigned int _nb_segment = 48);
85
 
    virtual ~SkyLine();
86
 
        void draw(const Projector* prj) const;
87
 
        void setColor(const Vec3f& c) {color = c;}
88
 
        const Vec3f& getColor() {return color;}
89
 
        void update(int delta_time) {fader.update(delta_time);}
90
 
        void set_fade_duration(float duration) {fader.set_duration((int)(duration*1000.f));}
91
 
        void setFlagshow(bool b){fader = b;}
92
 
        bool getFlagshow(void) const {return fader;}
93
 
        void set_font(float font_size, const string& font_name);
94
 
 
95
 
private:
96
 
        double radius;
97
 
        unsigned int nb_segment;
98
 
        SKY_LINE_TYPE line_type;
99
 
        Vec3f color;
100
 
        Vec3f* points;
101
 
        bool (Projector::*proj_func)(const Vec3d&, Vec3d&) const;
102
 
        LinearFader fader;
103
 
        s_font * font;
104
 
};
105
 
 
106
 
// Class which manages the cardinal points displaying
107
 
class Cardinals
108
 
{
109
 
public:
110
 
        Cardinals(float _radius = 1.);
111
 
    virtual ~Cardinals();
112
 
        void draw(const Projector* prj, double latitude, bool gravityON = false) const;
113
 
        void setColor(const Vec3f& c) {color = c;}
114
 
        Vec3f get_color() {return color;}
115
 
        void set_font(float font_size, const string& font_name);
116
 
        void translateLabels(Translator& trans);  // for i18n
117
 
        void update(int delta_time) {fader.update(delta_time);}
118
 
        void set_fade_duration(float duration) {fader.set_duration((int)(duration*1000.f));}
119
 
        void setFlagShow(bool b){fader = b;}
120
 
        bool getFlagShow(void) const {return fader;}
121
 
 
122
 
private:
123
 
        float radius;
124
 
        s_font* font;   
125
 
        Vec3f color;
126
 
        wstring sNorth, sSouth, sEast, sWest;
127
 
        LinearFader fader;
128
 
};
129
 
 
130
 
// Class which manages the displaying of the Milky Way
131
 
class MilkyWay
132
 
{
133
 
public:
134
 
        MilkyWay(float _radius = 1.);
135
 
    virtual ~MilkyWay();
136
 
        void draw(ToneReproductor * eye, const Projector* prj, const Navigator* nav) const;
137
 
        void update(int delta_time) {fader.update(delta_time);}
138
 
        void set_intensity(float _intensity);
139
 
        float get_intensity() { return intensity; };
140
 
        void set_texture(const string& tex_file, bool blend = false);
141
 
        void setColor(const Vec3f& c) { color=c;}
142
 
        void draw_chart(ToneReproductor * eye, const Projector* prj, const Navigator* nav);
143
 
        void setFlagShow(bool b){fader = b;}
144
 
        bool getFlagShow(void) const {return fader;}
145
 
        
146
 
private:
147
 
        float radius;
148
 
        s_texture* tex;
149
 
        Vec3f color;
150
 
        float intensity;
151
 
        float tex_avg_luminance;
152
 
        LinearFader fader;
153
 
};
154
 
 
155
 
// Class which manages the displaying of the Milky Way
156
 
class Draw
157
 
{
158
 
public:
159
 
        // Draw a point... (used for tests)
160
 
        static void drawPoint(float X,float Y,float Z);
161
 
};
162
 
 
163
 
#endif // __DRAW_H__