2 * Copyright (C) 2005 Liam Girdwood
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "solar_system.h"
21 #include "solar_object.h"
27 #define LABEL_FONT_SIZE 15.0
29 void planets_render(Sky
*sky
)
31 struct render_object
*rc
= &sky
->robject
;
32 struct projection
*proj
= &sky
->projection
;
33 struct render_flags
*rm
= &sky
->solar_system_settings
.planets
;
34 struct tile_array
*ta
= sky
->tile
;
36 /* planet label fonts */
37 cairo_select_font_face (rc
->cr
, "Sans", CAIRO_FONT_SLANT_NORMAL
,
38 CAIRO_FONT_WEIGHT_NORMAL
);
39 cairo_set_font_size (rc
->cr
, LABEL_FONT_SIZE
);
41 mercury
.update_cache(rc
);
42 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
44 if (projection_is_visible0(proj
, rc
)) {
45 mercury
.render(rc
, rm
);
46 if (rc
->type
== RT_FULL
)
47 tile_add_object(ta
, rc
);
50 venus
.update_cache(rc
);
51 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
53 if (projection_is_visible0(proj
, rc
)) {
55 if (rc
->type
== RT_FULL
)
56 tile_add_object(ta
, rc
);
59 mars
.update_cache(rc
);
60 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
62 if (projection_is_visible0(proj
, rc
)) {
64 if (rc
->type
== RT_FULL
)
65 tile_add_object(ta
, rc
);
68 jupiter
.update_cache(rc
);
69 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
71 if (projection_is_visible0(proj
, rc
)) {
72 jupiter
.render(rc
, rm
);
73 if (rc
->type
== RT_FULL
)
74 tile_add_object(ta
, rc
);
77 saturn
.update_cache(rc
);
78 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
80 if (projection_is_visible0(proj
, rc
)) {
81 saturn
.render(rc
, rm
);
82 if (rc
->type
== RT_FULL
)
83 tile_add_object(ta
, rc
);
86 uranus
.update_cache(rc
);
87 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
89 if (projection_is_visible0(proj
, rc
)) {
90 uranus
.render(rc
, rm
);
91 if (rc
->type
== RT_FULL
)
92 tile_add_object(ta
, rc
);
95 neptune
.update_cache(rc
);
96 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
98 if (projection_is_visible0(proj
, rc
)) {
99 neptune
.render(rc
, rm
);
100 if (rc
->type
== RT_FULL
)
101 tile_add_object(ta
, rc
);
104 pluto
.update_cache(rc
);
105 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
107 if (projection_is_visible0(proj
, rc
)) {
108 pluto
.render(rc
, rm
);
109 if (rc
->type
== RT_FULL
)
110 tile_add_object(ta
, rc
);
114 void solar_render(Sky
*sky
)
116 struct render_object
*rc
= &sky
->robject
;
117 struct projection
*proj
= &sky
->projection
;
118 struct render_flags
*rm
= &sky
->solar_system_settings
.solar
;
119 struct tile_array
*ta
= sky
->tile
;
121 /* planet label fonts */
122 cairo_select_font_face (rc
->cr
, "Sans", CAIRO_FONT_SLANT_NORMAL
,
123 CAIRO_FONT_WEIGHT_NORMAL
);
124 cairo_set_font_size (rc
->cr
, LABEL_FONT_SIZE
);
126 solar
.update_cache(rc
);
127 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
129 if (projection_is_visible0(proj
, rc
)) {
130 solar
.render(rc
, rm
);
131 if (rc
->type
== RT_FULL
)
132 tile_add_object(ta
, rc
);
136 void lunar_render(Sky
*sky
)
138 struct render_object
*rc
= &sky
->robject
;
139 struct projection
*proj
= &sky
->projection
;
140 struct render_flags
*rm
= &sky
->solar_system_settings
.lunar
;
141 struct tile_array
*ta
= sky
->tile
;
143 /* planet label fonts */
144 cairo_select_font_face (rc
->cr
, "Sans", CAIRO_FONT_SLANT_NORMAL
,
145 CAIRO_FONT_WEIGHT_NORMAL
);
146 cairo_set_font_size (rc
->cr
, LABEL_FONT_SIZE
);
148 lunar
.update_cache(rc
);
149 proj
->trans
->sky_to_proj_equ(proj
, &rc
->coord
[0]);
151 if (projection_is_visible0(proj
, rc
)) {
152 lunar
.render(rc
, rm
);
153 if (rc
->type
== RT_FULL
)
154 tile_add_object(ta
, rc
);