began for maemo
[xscreensaver] / xscreensaver / hacks / glx / rotator.h
1 /* xscreensaver, Copyright (c) 1998-2002 Jamie Zawinski <jwz@jwz.org>
2  *
3  * Permission to use, copy, modify, distribute, and sell this software and its
4  * documentation for any purpose is hereby granted without fee, provided that
5  * the above copyright notice appear in all copies and that both that
6  * copyright notice and this permission notice appear in supporting
7  * documentation.  No representations are made about the suitability of this
8  * software for any purpose.  It is provided "as is" without express or 
9  * implied warranty.
10  */
11
12 #ifndef __ROTATOR_H__
13 #define __ROTATOR_H__
14
15 typedef struct rotator rotator;
16
17 /* Returns a rotator object, which encapsulates rotation and motion state.
18
19    spin_[xyz]_speed indicates the relative speed of rotation.
20    Specify 0 if you don't want any rotation around that axis.
21
22    spin_accel specifies a scaling factor for the acceleration that is
23    randomly applied to spin: if you want the speed to change faster,
24    make this > 1.
25
26    wander_speed indicates the relative speed through space.
27
28    If randomize_initial_state_p is true, then the initial position and
29    rotation will be randomized (even if the spin speeds are 0.)  If it
30    is false, then all values will be initially zeroed.
31  */
32 extern rotator *make_rotator (double spin_x_speed,
33                               double spin_y_speed,
34                               double spin_z_speed,
35                               double spin_accel,
36                               double wander_speed,
37                               int randomize_initial_state_p);
38
39 /* Rotates one step, and returns the new rotation values.
40    x, y, and z range from 0.0-1.0, the fraction through the circle
41    (*not* radians or degrees!)
42    If `update_p' is non-zero, then (maybe) rotate first.
43  */
44 extern void get_rotation (rotator *rot,
45                           double *x_ret, double *y_ret, double *z_ret,
46                           int update_p);
47
48 /* Moves one step, and returns the new position values.
49    x, y, and z range from 0.0-1.0, the fraction through space:
50    scale those values as needed.
51    If `update_p' is non-zero, then (maybe) move first.
52  */
53 extern void get_position (rotator *rot,
54                           double *x_ret, double *y_ret, double *z_ret,
55                           int update_p);
56
57 /* Destroys and frees a `rotator' object. */
58 extern void free_rotator (rotator *r);
59
60 #endif /* __ROTATOR_H__ */