diff -urN wf-/data.c wf/data.c --- wf-/data.c Wed Jan 6 00:00:00 2016 +++ wf/data.c Fri Jan 8 00:00:00 2016 @@ -43,6 +43,7 @@ CASE_RET(type_copy_mirror); CASE_RET(type_copy_timeshift); CASE_RET(type_copy_timeshift_rot); + CASE_RET(type_recursive); CASE_RET(type_test_conv); default: break; } @@ -663,6 +664,23 @@ } } +static void +op_data_recursive(struct recursive *r, data_t *data, prm_t *prm) +{ + data_t op = { type_arr, (data_t[]){ + *r->op, + { type_recursive, r }, + { type_end } }}; + + if(r->cnt >= r->n){ + r->cnt = 0; + return; + } + data_draw(data, prm); + r->cnt++; + op_data_draw(&op, data, prm); +} + void op_data_draw(data_t *op, data_t *data, prm_t *prm) { @@ -745,6 +763,10 @@ break; case type_copy_timeshift_rot: op_data_copy_timeshift_rot(op->p, data, prm); + break; + + case type_recursive: + op_data_recursive(op->p, data, prm); break; case type_none: diff -urN wf-/data.h wf/data.h --- wf-/data.h Wed Jan 6 00:00:00 2016 +++ wf/data.h Fri Jan 8 00:00:00 2016 @@ -50,6 +50,8 @@ #define type_copy_timeshift 204 #define type_copy_timeshift_rot 205 +#define type_recursive 220 + #define type_test_conv 254 @@ -162,6 +164,11 @@ double init_sec, step_sec; line_t l; double init_deg, step_deg; +}; + +struct recursive{ + data_t *op; + int n, cnt; }; typedef struct{ diff -urN wf-/wf_ex.c wf/wf_ex.c --- wf-/wf_ex.c Thu Jan 7 00:00:00 2016 +++ wf/wf_ex.c Fri Jan 8 00:00:00 2016 @@ -407,6 +407,20 @@ { type_end } }}, .data = &(data_t){ type_cube } }}; + data_t *matryoshka = &(data_t){ type_op_data_set, &(struct op_data_set){ + .op = &(data_t){ type_arr, (data_t[]){ + { type_slide, &(d3_t){20,20,20} }, + { type_recursive, &(struct recursive){ + .op = &(data_t){ type_arr, (data_t[]){ + { type_zoom, &(d3_t)D3_ALL(0.8) }, + { type_rot_way, &(struct rot_way){.l=LINE_Z,.deg_way=WAY_V2(0,90, 3,3, 3) }}, + { type_end } }}, + .n=20, .cnt=0 }}, + { type_rdiv, &(struct rdiv){ .n=8, .rate=0.3 } }, + { type_zoom, &(d3_t)D3_ALL(20) }, + { type_end } }}, + .data = &(data_t){ type_octahedron } }}; + data.type = type_arr; data.p = (data_t[]){ *axyz, @@ -417,6 +431,7 @@ *half_pipe, *fireworks, *train, + *matryoshka, { type_end } }; }