diff -urN wf-/data.c wf/data.c --- wf-/data.c Fri Jan 8 00:00:00 2016 +++ wf/data.c Fri Jan 8 02:00:00 2016 @@ -12,10 +12,13 @@ CASE_RET(type_none); CASE_RET(type_wire_frame); CASE_RET(type_bar); + CASE_RET(type_bars); CASE_RET(type_cross); CASE_RET(type_square); CASE_RET(type_cube); CASE_RET(type_circle); + CASE_RET(type_circle_y); + CASE_RET(type_circle_x); CASE_RET(type_ball); CASE_RET(type_arc); CASE_RET(type_octahedron); @@ -188,6 +191,15 @@ } static void +bars_draw(pos_t *ps, prm_t *prm) +{ + data_t data = { type_bar, ps }; + if(d3_eq_zero(&ps[0]) && d3_eq_zero(&ps[1])) return; + data_draw(&data, prm); + bars_draw(&ps[2], prm); +} + +static void cross_draw(pos_t *p2, prm_t *prm) { data_t data = { type_bar, p2 }; @@ -266,6 +278,24 @@ } static void +circle_y_draw(struct circle *c, prm_t *prm) +{ + data_t data = { type_circle, c }; + struct rot rot = { .l=LINE_X, .deg=90 }; + data_t op = { type_rot, &rot }; + op_data_draw(&op, &data, prm); +} + +static void +circle_x_draw(struct circle *c, prm_t *prm) +{ + data_t data = { type_circle, c }; + struct rot rot = { .l=LINE_Y, .deg=90 }; + data_t op = { type_rot, &rot }; + op_data_draw(&op, &data, prm); +} + +static void ball_draw(struct ball *ball, prm_t *prm) { data_t op = { type_arr, (data_t[]){ @@ -364,6 +394,9 @@ case type_bar: bar_draw(data->p, prm); break; + case type_bars: + bars_draw(data->p, prm); + break; case type_cross: cross_draw(data->p, prm); break; @@ -375,6 +408,12 @@ break; case type_circle: circle_draw(data->p, prm); + break; + case type_circle_y: + circle_y_draw(data->p, prm); + break; + case type_circle_x: + circle_x_draw(data->p, prm); break; case type_ball: ball_draw(data->p, prm); diff -urN wf-/data.h wf/data.h --- wf-/data.h Fri Jan 8 00:00:00 2016 +++ wf/data.h Fri Jan 8 02:00:00 2016 @@ -14,10 +14,14 @@ #define type_wire_frame 0 #define type_bar 1 +#define type_bars 20 #define type_cross 2 #define type_square 3 #define type_cube 4 #define type_circle 5 +#define type_circle_y 21 +#define type_circle_x 22 + #define type_ball 6 #define type_arc 7 #define type_octahedron 8 diff -urN wf-/wf_ex.c wf/wf_ex.c --- wf-/wf_ex.c Fri Jan 8 00:00:00 2016 +++ wf/wf_ex.c Fri Jan 8 02:00:00 2016 @@ -19,7 +19,7 @@ double us, sec; if(e->start_sec < 0){ - if(e->load){ + if(e->load || e->liss_p){ while(cui_key_get2() == 0) usleep(1000); } e->start_sec = now_sec(); @@ -421,6 +421,58 @@ { type_end } }}, .data = &(data_t){ type_octahedron } }}; + data_t *clock_frm1 = &(data_t){ type_wire_frame, &(struct wire_frame){ + .n=5, .p=(pos_t[]){{-1,0,-1},{1,0,-1},{1,0,1},{0,0,2},{-1,0,1}}, + .odr=(int[]){0,1,2,3,4,0,-1, -1} }}; + + data_t *clock_house = &(data_t){ type_arr, (data_t[]){ + { type_op_data_set, &(struct op_data_set){ + .op = &(data_t){ type_copy, &(struct copy){ .n={1,2,1}, .init=D3_O, .step={0,2,0} } }, + .data = clock_frm1 }}, + { type_bars, (pos_t[]){ {-1,0,-1},{-1,2,-1},{1,0,-1},{1,2,-1},{1,0,1},{1,2,1}, + {0,0,2},{0,2,2},{-1,0,1},{-1,2,1}, D3_O,D3_O }}, + { type_end } }}; + + data_t *clock_circle = &(data_t){ type_arr, (data_t[]){ + { type_circle_y, &(struct circle){.r=0.8,.n=36} }, + { type_op_data_set, &(struct op_data_set){ + .op = &(data_t){ type_rot_way, &(struct rot_way){ .l=LINE_Y, .deg_way=WAY_V2(0,360, 60,0, 1) }}, + .data = &(data_t){ type_bar, (pos_t[]){ D3_O,{0,0,0.7} }} }}, + { type_end } }}; + + data_t *clock_door = &(data_t){ type_op_data_set, &(struct op_data_set){ + .op = &(data_t){ type_rot_way, &(struct rot_way){ + .l={{-1,0,0},D3_Z}, + .deg_way={.n=4,.vs=(double[]){0,-90,-90,0},.ts=(double[]){0.5,1+1+1,0.5,56},.ps=NULL,.dg=1} }}, + .data = &(data_t){ type_arr, (data_t[]){ + *clock_frm1, + *clock_circle, + { type_end } }} }}; + + data_t *clock_bird = &(data_t){ type_op_data_set, &(struct op_data_set){ + .op = &(data_t){ type_arr, (data_t[]){ + { type_copy_timeshift, &(struct copy_timeshift){.n=5,.init_sec=0,.step_sec=-0.1,.init=D3_O,.step=D3_O} }, + { type_slide_way, &(struct way){ + .n=9, + .ps=(pos_t[]){ {0,1,0},{0,1,0},{0,-2,0},{0,1,0},{0,-2,0},{0,1,0},{0,-2,0},{0,1,0},{0,1,0} }, + .ts=(double[]){0.5, 0.5,0.5, 0.5,0.5, 0.5,0.5, 0.5, 56},.vs=NULL,.dg=3 }}, + { type_zoom, &(d3_t)D3_ALL(0.5) }, + { type_end } }}, + .data = &(data_t){ type_octahedron } }}; + + data_t *clock = &(data_t){ type_op_data_set, &(struct op_data_set){ + .op = &(data_t){ type_arr, (data_t[]){ + { type_timeshift, &(struct timeshift){ .sec=-5, .slide=D3_O } }, + { type_zoom_and_slide, (d3_t[]){ D3_ALL(2),{-20,-20,20} } }, + { type_end } }}, + .data = &(data_t){ type_arr, (data_t[]){ + *clock_house, + *clock_door, + *clock_bird, + { type_end } }} }}; + + wf_init_work_alloc(clock_frm1->p, NULL); + data.type = type_arr; data.p = (data_t[]){ *axyz, @@ -432,6 +484,7 @@ *fireworks, *train, *matryoshka, + *clock, { type_end } }; }