1 /* GLBUBBLES (C) 1998 Richard W.M. Jones. */
3 #ifndef __bubbles3d_h__
4 #define __bubbles3d_h__
8 # include "xlockmoreI.h" /* from the xscreensaver distribution */
9 #else /* !STANDALONE */
10 # include "xlock.h" /* from the xlockmore distribution */
11 #endif /* !STANDALONE */
14 # include <OpenGL/gl.h>
15 # include <OpenGL/glu.h>
21 /* Static configuration. */
22 #define GLB_SLOW_GL 0 /* Set this if you have a slow GL
23 * implementation. If you have an accelerated
24 * graphics card, set this to 0.
26 #define GLB_VERTICES_EPSILON 0.0005 /* How close are identical vertices? */
28 /* Configuration structure. */
30 int transparent_p; /* Whether to use alpha blending */
32 int subdivision_depth; /* Controls how many triangles are in
33 * each bubble. 2 and 3 are good values.
35 int nr_nudge_axes; /* Number of directions in which each
36 * bubble gets stretched. Values between
37 * 3 and 7 seem to produce good results.
39 GLfloat nudge_angle_factor; /* Max. amount of rotation in nudge angles.
40 * Controls the amount of `wobble' we see,
41 * and 0.3 seems to work well.
43 GLfloat nudge_factor; /* Max. displacement of any single nudge.
44 * Controls the amount of the wobble. Depends
45 * on NR_NUDGE_AXES, and must not exceed
46 * 1 / NR_NUDGE_AXES. 0.1 is good.
48 GLfloat rotation_factor; /* Max. amount by which bubbles rotate. */
49 int create_bubbles_every; /* How often to create new bubbles. */
50 int max_bubbles; /* Max. number of bubbles to create. */
51 double p_bubble_group[4]; /* Probabilities of creating 1, 2, 3, 4
52 * bubbles in a group. Cumulative.
54 GLfloat max_size; /* Max. size. */
55 GLfloat min_size; /* Min. size of bubbles. */
56 GLfloat max_speed; /* Max. speed. */
57 GLfloat min_speed; /* Min. speed of bubbles. */
58 GLfloat scale_factor; /* Factor by which bubbles scale from bottom
59 * of screen to top. 1.5 - 2.0 are OK.
61 GLfloat screen_bottom; /* Bottom of screen. */
62 GLfloat screen_top; /* Top of screen. */
63 GLfloat bg_colour[4]; /* Background colour. */
64 GLfloat bubble_colour[4]; /* Colour of the bubbles. */
69 extern struct glb_config glb_config;
71 #define glb_drand() ((double)LRAND() / (double)MAXRAND)
73 /*-- From glb_sphere.c. --*/
74 typedef struct glb_data glb_data;
75 typedef GLfloat glb_vertex[3];
76 typedef GLuint glb_triangle[3];
77 extern glb_data * glb_sphere_init(void);
78 extern glb_vertex *glb_sphere_get_vertices(glb_data *, int *nr_vertices);
79 extern glb_triangle *glb_sphere_get_triangles(glb_data *, int *nr_triangles);
80 extern void glb_sphere_end(glb_data *);
82 /*-- From glb_bubble.c. --*/
83 extern void *glb_bubble_new(glb_data *d,
84 GLfloat x, GLfloat y, GLfloat z, GLfloat scale,
85 GLfloat y_incr, GLfloat scale_incr);
86 extern void glb_bubble_delete(void *);
87 extern void glb_bubble_step(void *);
88 extern void glb_bubble_draw(glb_data *d, void *);
89 extern GLfloat glb_bubble_get_y(void *);
91 /*-- From glb_draw.c. --*/
92 extern void *glb_draw_init(void);
93 extern void glb_draw_step(void *);
94 extern void glb_draw_end(void *);
96 #endif /* __bubbles3d_h__ */