409
|
1 #include "paranormal.h"
|
|
2 #include "actuators.h"
|
|
3
|
|
4 struct pn_actuator *
|
|
5 rovascope_get_random_colourmap(void)
|
|
6 {
|
|
7 struct pn_actuator *out;
|
|
8
|
|
9 srand(time(NULL));
|
|
10
|
|
11 out = create_actuator("cmap_bwgradient");
|
|
12 out->options[2].val.cval.r = 255 - rand() % 255;
|
|
13 out->options[2].val.cval.g = 255 - rand() % 255;
|
|
14 out->options[2].val.cval.b = 255 - rand() % 255;
|
|
15
|
|
16 return out;
|
|
17 }
|
|
18
|
|
19 struct pn_actuator *
|
419
|
20 rovascope_get_random_transform(void)
|
|
21 {
|
|
22 struct pn_actuator *out;
|
|
23 gchar *candidates[] = {
|
|
24 "d = cos(d) ^ 2;",
|
|
25 "r = sin(r);",
|
|
26 "r = sin(r); d = cos(d) ^ 2;",
|
|
27 };
|
|
28
|
|
29 srand(time(NULL));
|
|
30
|
|
31 out = create_actuator("xform_movement");
|
|
32 out->options[0].val.sval =
|
|
33 g_strdup(candidates[rand() % G_N_ELEMENTS(candidates)]);
|
|
34
|
|
35 return out;
|
|
36 }
|
|
37
|
|
38 struct pn_actuator *
|
409
|
39 rovascope_get_random_general(void)
|
|
40 {
|
|
41 struct pn_actuator *out;
|
|
42
|
|
43 gchar *candidates[] = {
|
|
44 "general_fade", "general_blur", "general_mosaic",
|
419
|
45 "general_flip", "general_fade", "general_fade",
|
409
|
46 };
|
|
47
|
|
48 out = create_actuator(candidates[rand() % G_N_ELEMENTS(candidates)]);
|
|
49
|
|
50 return out;
|
|
51 }
|
|
52
|
|
53 struct pn_actuator *
|
|
54 rovascope_get_random_normal_scope(void)
|
|
55 {
|
|
56 struct pn_actuator *out;
|
|
57
|
|
58 gchar *candidates[] = {
|
|
59 "wave_horizontal", "wave_vertical", "wave_radial",
|
|
60 };
|
|
61
|
410
|
62 out = create_actuator(candidates[rand() % G_N_ELEMENTS(candidates)]);
|
409
|
63
|
|
64 return out;
|
|
65 }
|
|
66
|
|
67 struct pn_actuator *
|
|
68 rovascope_get_random_actuator(void)
|
|
69 {
|
|
70 struct pn_actuator *out;
|
|
71 struct pn_actuator *(*func)();
|
|
72
|
|
73 void *candidates[] = {
|
|
74 rovascope_get_random_colourmap,
|
|
75 rovascope_get_random_general,
|
|
76 rovascope_get_random_normal_scope,
|
419
|
77 rovascope_get_random_transform,
|
409
|
78 };
|
|
79
|
419
|
80 func = candidates[rand() % G_N_ELEMENTS(candidates)];
|
409
|
81 out = func();
|
|
82
|
|
83 return out;
|
|
84 }
|