|
116
|
1 /* Iris - visualization plugin for XMMS
|
|
|
2 * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr)
|
|
|
3 *
|
|
|
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.
|
|
|
8 *
|
|
|
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.
|
|
|
13 *
|
|
|
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, Boston, MA 02111-1307, USA.
|
|
|
17 */
|
|
|
18
|
|
|
19 #ifndef IRIS_H
|
|
|
20
|
|
|
21 #include <string.h>
|
|
|
22 #include <glib.h>
|
|
|
23 #include <gtk/gtk.h>
|
|
|
24 #include <GL/gl.h>
|
|
|
25 #include <GL/glx.h>
|
|
|
26 #include <audacious/configdb.h>
|
|
|
27 #include <X11/Xlib.h>
|
|
|
28 #include <X11/extensions/xf86vmode.h>
|
|
|
29
|
|
|
30 typedef struct
|
|
|
31 {
|
|
|
32
|
|
|
33 GLfloat bgc_red;
|
|
|
34 GLfloat bgc_green;
|
|
|
35 GLfloat bgc_blue;
|
|
|
36
|
|
|
37 GLfloat color_red;
|
|
|
38 GLfloat color_green;
|
|
|
39 GLfloat color_blue;
|
|
|
40
|
|
|
41 GLfloat color1_red;
|
|
|
42 GLfloat color1_green;
|
|
|
43 GLfloat color1_blue;
|
|
|
44
|
|
|
45 GLfloat color2_red;
|
|
|
46 GLfloat color2_green;
|
|
|
47 GLfloat color2_blue;
|
|
|
48
|
|
|
49 GLfloat color_flash_red;
|
|
|
50 GLfloat color_flash_green;
|
|
|
51 GLfloat color_flash_blue;
|
|
|
52
|
|
|
53 unsigned int color_mode;
|
|
|
54 unsigned int flash_speed;
|
|
|
55 unsigned int fps;
|
|
|
56
|
|
|
57 // in fullscreen, we are only interested in width and height
|
|
|
58 unsigned int fs_width;
|
|
|
59 unsigned int fs_height;
|
|
|
60
|
|
|
61 unsigned int window_width;
|
|
|
62 unsigned int window_height;
|
|
|
63
|
|
|
64 gboolean bgc_random;
|
|
|
65 gboolean color_random;
|
|
|
66 gboolean color12_random;
|
|
|
67 gboolean flash_random;
|
|
|
68 gboolean color_beat;
|
|
|
69 gboolean change_theme_on_beat;
|
|
|
70
|
|
|
71 gboolean fullscreen;
|
|
|
72 gboolean wireframe;
|
|
|
73
|
|
|
74 gboolean transition;
|
|
|
75 gfloat trans_duration;
|
|
|
76 }
|
|
|
77 iris_config;
|
|
|
78
|
|
|
79 typedef struct
|
|
|
80 {
|
|
|
81 gfloat priority; /* priority of the theme */
|
|
|
82 int transparency; /* transparency can be off (0), on (1) or random (-1) */
|
|
|
83 int wireframe; /* wireframe can be off (0), on (1) or random (-1) */
|
|
|
84 }
|
|
|
85 config_global; /* options implemented by all the themes */
|
|
|
86
|
|
|
87 typedef struct
|
|
|
88 {
|
|
|
89 config_global *global;
|
|
|
90 void *private; /* private config of the theme */
|
|
|
91 }
|
|
|
92 config_theme;
|
|
|
93
|
|
|
94 typedef struct
|
|
|
95 {
|
|
|
96 char *name; /* the name of the theme */
|
|
|
97 char *description; /* what the theme does */
|
|
|
98 char *author; /* who did the theme */
|
|
|
99 char *key; /* key used to get config items in ~/.xmms/config */
|
|
|
100 config_theme *config; /* where the theme config is */
|
|
|
101 config_theme *config_new; /* copy of the theme config used by the configuration widgets */
|
|
|
102 int config_private_size; /* size of the private theme config structure (we can't get it dynamically) */
|
|
|
103 void (*config_read) (ConfigDb * db, char *); /* read the private theme config and put it into the privateconfig */
|
|
|
104 void (*config_write) (ConfigDb * db, char *); /* write the private config into ~/.xmms/config */
|
|
|
105 void (*config_default) (void); /* put default values into private config */
|
|
|
106 void (*config_create) (GtkWidget *); /* create the Gtk widget (into a vbox) to configure the theme */
|
|
|
107 void (*init) (void); /* called once at iris init */
|
|
|
108 void (*cleanup) (void); /* called once at iris cleanup */
|
|
|
109 void (*init_draw_mode) (void); /* called once when iris switch to this theme */
|
|
|
110 GLfloat (*get_x_angle) (void); /* called once when iris switch to this theme to get a camera position to move */
|
|
|
111 void (*draw_one_frame) (gboolean beat); /* draw one frame of the theme */
|
|
|
112 }
|
|
|
113 iris_theme;
|
|
|
114
|
|
|
115 #define NUM_BANDS 16
|
|
|
116 typedef struct {
|
|
|
117 GLfloat data360[360][NUM_BANDS];
|
|
|
118 GLfloat data1[NUM_BANDS];
|
|
|
119 GLfloat loudness;
|
|
|
120 }
|
|
|
121 datas_t;
|
|
|
122
|
|
|
123 typedef struct
|
|
|
124 {
|
|
|
125 GLfloat x;
|
|
|
126 GLfloat z;
|
|
|
127 }
|
|
|
128 xz;
|
|
|
129
|
|
|
130 /* stuff about our window grouped together */
|
|
|
131 typedef struct
|
|
|
132 {
|
|
|
133 // X stuff
|
|
|
134 Display *dpy;
|
|
|
135 int screen;
|
|
|
136 Window window;
|
|
|
137 GLXContext ctx;
|
|
|
138 XSetWindowAttributes attr;
|
|
|
139 Bool fs;
|
|
|
140 XF86VidModeModeInfo deskMode;
|
|
|
141 unsigned int window_x, window_y;
|
|
|
142 unsigned int window_width, window_height;
|
|
|
143 unsigned int fs_width, fs_height;
|
|
|
144
|
|
|
145 // rendering info
|
|
|
146 int glxMajorVersion;
|
|
|
147 int glxMinorVersion;
|
|
|
148 int vidModeMajorVersion;
|
|
|
149 int vidModeMinorVersion;
|
|
|
150 XF86VidModeModeInfo **modes;
|
|
|
151 int modeNum;
|
|
|
152 unsigned int depth;
|
|
|
153 gboolean DRI;
|
|
|
154 gboolean DoubleBuffered;
|
|
|
155 GList *glist;
|
|
|
156 }
|
|
|
157 GLWindow;
|
|
|
158
|
|
|
159 /* config.c */
|
|
|
160 extern GtkWidget *config_window;
|
|
|
161 extern iris_config config;
|
|
|
162 extern iris_config newconfig;
|
|
|
163 extern GLWindow GLWin;
|
|
|
164 extern datas_t datas;
|
|
|
165 extern void iris_first_init (void);
|
|
|
166 extern void iris_configure (void);
|
|
|
167 extern void iris_config_read (void);
|
|
|
168 extern void iris_config_write (iris_config *);
|
|
|
169 extern void iris_set_default_prefs (void);
|
|
|
170 extern void iris_save_window_attributes (void);
|
|
|
171 extern GLvoid init_gl (GLvoid);
|
|
|
172
|
|
|
173 /* color.c */
|
|
|
174 extern void get_color (GLfloat *, GLfloat *, GLfloat *, GLfloat *);
|
|
|
175
|
|
|
176 /* 3Dstuff.c */
|
|
|
177 extern void bar_top_or_bottom (GLfloat height, xz * xz1, xz * xz2, xz * xz3,
|
|
|
178 xz * xz4);
|
|
|
179 extern void bar_side (GLfloat height, xz * xz1, xz * xz2);
|
|
|
180 extern void bar_full (GLfloat height, xz * xz1, xz * xz2, xz * xz3, xz * xz4);
|
|
|
181
|
|
|
182 /* theme.c */
|
|
|
183 #define THEME_NUMBER 12
|
|
|
184 extern void theme_register (void);
|
|
|
185 extern iris_theme theme[THEME_NUMBER];
|
|
|
186 extern void theme_config_init (void);
|
|
|
187 extern void theme_config_global_default (int);
|
|
|
188 extern void theme_config_global_read (ConfigDb *, char *, int);
|
|
|
189 extern void theme_config_global_write (ConfigDb *, char *, int);
|
|
|
190 extern void theme_config_apply(int num);
|
|
|
191 extern void theme_config_global_widgets(GtkWidget *, int);
|
|
|
192 extern void theme_about(GtkWidget *, int);
|
|
|
193
|
|
|
194 /* transition.c */
|
|
|
195 extern void init_theme_transition ();
|
|
|
196 extern void theme_transition ();
|
|
|
197
|
|
|
198 #endif
|