- /* Set up parameter movements for the different forcefields */
- name[1] = "Velocity";
- op[1] = 1; damp[1] = .999; force[1] = .002;
- name[2] = "Rotation";
- op[2] = 0; damp[2] = .999; force[2] = .002;
- name[3] = "Drip";
- op[3] = 1; damp[3] = .999; force[3] = .005;
- name[4] = "Dribble";
- op[4] = 1; damp[4] = .999; force[4] = .005;
- name[5] = "Slide";
- op[5] = 0; damp[5] = .999; force[5] = .002;
- name[6] = "Accelerate";
- op[6] = 1.0; damp[6] = .999; force[6] = .005;
- name[7] = "xDisplace";
- op[7] = 0; damp[7] = .999; force[7] = .005;
- name[8] = "yDisplace";
- op[8] = 0; damp[8] = .999; force[8] = .005;
- /* 0 and 9 are options for splitting displacements [no var] */
- name[0] = "Split";
- op[0] = 0; damp[0] = 0; force[0] = 0;
- name[9] = "2d/3d split";
- op[9] = 0; damp[9] = 0; force[9] = 0;
+static unsigned long
+whirlwindwarp_draw (Display *dpy, Window window, void *closure)
+{
+ struct state *st = (struct state *) closure;
+
+ /* time_t lastframe = time((time_t) 0); */
+
+ if (!st->initted) {
+ st->initted = 1;
+
+ XClearWindow (st->dpy, st->window);
+ XGetWindowAttributes (st->dpy, st->window, &st->xgwa);
+ st->scrwid = st->xgwa.width;
+ st->scrhei = st->xgwa.height;
+
+ st->starsize=st->scrhei/480;
+ if (st->starsize<=0)
+ st->starsize=1;
+
+ /* Setup colours */
+ hsv_to_rgb (0.0, 0.0, 0.0, &st->bgcolor.red, &st->bgcolor.green, &st->bgcolor.blue);
+ st->got_color = XAllocColor (st->dpy, st->xgwa.colormap, &st->bgcolor);
+ st->colsavailable=0;
+ for (st->p=0;st->p<st->ps;st->p++) {
+ if (!mono_p)
+ hsv_to_rgb (random()%360, .6+.4*myrnd(), .6+.4*myrnd(), &st->color[st->p].red, &st->color[st->p].green, &st->color[st->p].blue);
+ /* hsv_to_rgb (random()%360, 1.0, 1.0, &color[p].red, &color[p].green, &color[p].blue); for stronger colours! */
+ if ((!mono_p) && (st->got_color = XAllocColor (st->dpy, st->xgwa.colormap, &st->color[st->p]))) {
+ st->colsavailable=st->p;
+ } else {
+ if (st->colsavailable>0) /* assign colours from those already allocated */
+ st->color[st->p]=st->color[ st->p % st->colsavailable ];
+ else
+ st->color[st->p].pixel=st->default_fg_pixel;
+ }
+ }
+
+ /* Set up central (optimal) points for each different forcefield */
+ st->op[1] = 1; st->name[1] = "Warp";
+ st->op[2] = 0; st->name[2] = "Rotation";
+ st->op[3] = 1; st->name[3] = "Horizontal asymptote";
+ st->op[4] = 0; st->name[4] = "Vertical asymptote";
+ st->op[5] = 1; st->name[5] = "Vertical asymptote right";
+ st->op[6] = 1; st->name[6] = "Squirge x";
+ st->op[7] = 1; st->name[7] = "Squirge y";
+ st->op[0] = 0; st->name[0] = "Split number (inactive)";
+ st->op[8] = 0; st->name[8] = "Split velocity x";
+ st->op[9] = 0; st->name[9] = "Split velocity y";
+ st->op[10] = 0; st->name[10] = "Horizontal wave amplitude";
+ st->op[11] = myrnd()*3.141; st->name[11] = "Horizontal wave phase (inactive)";
+ st->op[12] = 0.01; st->name[12] = "Horizontal wave frequency (inactive)";
+ st->op[13] = 0; st->name[13] = "Vertical wave amplitude";
+ st->op[14] = myrnd()*3.141; st->name[14] = "Vertical wave phase (inactive)";
+ st->op[15] = 0.01; st->name[15] = "Vertical wave frequency (inactive)";