summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-05-10 17:26:16 +0200
committerLars-Dominik Braun <lars@6xq.net>2015-05-10 17:26:16 +0200
commita6a437ac1a51f091da4c00b12ad69fac04425435 (patch)
tree6bed5e79ed6c43db8676f10651a3c2a5de98b485
parente59d1fe31732b50401b3b790d31fa971eff9d762 (diff)
downloadpucket-a6a437ac1a51f091da4c00b12ad69fac04425435.tar.gz
pucket-a6a437ac1a51f091da4c00b12ad69fac04425435.tar.bz2
pucket-a6a437ac1a51f091da4c00b12ad69fac04425435.zip
Refactor initialize_xforms
-rw-r--r--flam3.c62
-rw-r--r--variations.c160
-rw-r--r--variations.h1
3 files changed, 61 insertions, 162 deletions
diff --git a/flam3.c b/flam3.c
index 3a113b8..616fe8c 100644
--- a/flam3.c
+++ b/flam3.c
@@ -490,6 +490,62 @@ void flam3_copy_params(flam3_xform * restrict dest, flam3_xform * restrict src,
}
}
+static void initialize_xform(flam3_xform * const xf) {
+ memset (xf, 0, sizeof (*xf));
+
+ xf->color_speed = 0.5;
+ xf->animate = 1.0;
+ xf->opacity = 1.0;
+ xf->var[0] = 1.0;
+ xf->c[0][0] = 1.0;
+ xf->c[1][1] = 1.0;
+ xf->post[0][0] = 1.0;
+ xf->post[1][1] = 1.0;
+ xf->blob_high = 1.0;
+ xf->blob_waves = 1.0;
+ xf->bent2_x = 1.0;
+ xf->bent2_y = 1.0;
+ xf->cell_size = 1.0;
+ xf->cpow_r = 1.0;
+ xf->cpow_power = 1.0;
+ xf->curve_xlength = 1.0;
+ xf->curve_ylength = 1.0;
+ xf->oscope_separation = 1.0;
+ xf->oscope_frequency = M_PI;
+ xf->oscope_amplitude = 1.0;
+ xf->wedge_count = 1.0;
+ xf->wedge_sph_count = 1.0;
+ xf->wedge_julia_power = 1.0;
+ xf->wedge_julia_count = 1.0;
+ xf->wedgeJulia_cn = 0.5;
+ xf->wedgeJulia_rN = 1.0;
+ xf->auger_freq = 1.0;
+ xf->auger_weight = 0.5;
+ xf->auger_scale = 1.0;
+ xf->julian_power = 1.0;
+ xf->julian_dist = 1.0;
+ xf->julian_rN = 1.0;
+ xf->julian_cn = 0.5;
+ xf->juliascope_power = 1.0;
+ xf->juliascope_dist = 1.0;
+ xf->juliascope_rN = 1.0;
+ xf->juliascope_cn = 0.5;
+ xf->radialBlur_zoomvar = 1.0;
+ xf->pie_slices = 6.0;
+ xf->pie_thickness = 0.5;
+ xf->ngon_sides = 5;
+ xf->ngon_power = 3;
+ xf->ngon_circle = 1;
+ xf->ngon_corners = 2;
+ xf->curl_c1 = 1.0;
+ xf->rectangles_x = 1.0;
+ xf->rectangles_y = 1.0;
+ xf->super_shape_n1 = 1.0;
+ xf->super_shape_n2 = 1.0;
+ xf->super_shape_n3 = 1.0;
+ xf->conic_eccentricity = 1.0;
+}
+
/* Xform support functions */
void flam3_add_xforms(flam3_genome *thiscp, int num_to_add, int interp_padding, int final_flag) {
@@ -510,7 +566,11 @@ void flam3_add_xforms(flam3_genome *thiscp, int num_to_add, int interp_padding,
thiscp->num_xforms += num_to_add;
/* Initialize all the new xforms */
- initialize_xforms(thiscp, old_num);
+ for (i = old_num; i < thiscp->num_xforms; i++) {
+ flam3_xform * const xf = &thiscp->xform[i];
+ initialize_xform (xf);
+ xf->color = i&1;
+ }
/* Set the padding flag for the new xforms */
if (interp_padding) {
diff --git a/variations.c b/variations.c
index befc0cb..17017cd 100644
--- a/variations.c
+++ b/variations.c
@@ -2289,163 +2289,3 @@ int apply_xform(const flam3_xform * const xf, const unsigned int fn,
}
}
-void initialize_xforms(flam3_genome *thiscp, int start_here) {
-
- int i,j;
- for (i = start_here ; i < thiscp->num_xforms ; i++) {
- thiscp->xform[i].padding = 0;
- thiscp->xform[i].density = 0.0;
- thiscp->xform[i].color_speed = 0.5;
- thiscp->xform[i].animate = 1.0;
- thiscp->xform[i].color = i&1;
- thiscp->xform[i].opacity = 1.0;
- thiscp->xform[i].var[0] = 1.0;
- thiscp->xform[i].motion_freq = 0;
- thiscp->xform[i].motion_func = 0;
- for (j = 1; j < flam3_nvariations; j++)
- thiscp->xform[i].var[j] = 0.0;
- thiscp->xform[i].c[0][0] = 1.0;
- thiscp->xform[i].c[0][1] = 0.0;
- thiscp->xform[i].c[1][0] = 0.0;
- thiscp->xform[i].c[1][1] = 1.0;
- thiscp->xform[i].c[2][0] = 0.0;
- thiscp->xform[i].c[2][1] = 0.0;
- thiscp->xform[i].post[0][0] = 1.0;
- thiscp->xform[i].post[0][1] = 0.0;
- thiscp->xform[i].post[1][0] = 0.0;
- thiscp->xform[i].post[1][1] = 1.0;
- thiscp->xform[i].post[2][0] = 0.0;
- thiscp->xform[i].post[2][1] = 0.0;
- thiscp->xform[i].wind[0] = 0.0;
- thiscp->xform[i].wind[1] = 0.0;
- thiscp->xform[i].blob_low = 0.0;
- thiscp->xform[i].blob_high = 1.0;
- thiscp->xform[i].blob_waves = 1.0;
- thiscp->xform[i].pdj_a = 0.0;
- thiscp->xform[i].pdj_b = 0.0;
- thiscp->xform[i].pdj_c = 0.0;
- thiscp->xform[i].pdj_d = 0.0;
- thiscp->xform[i].fan2_x = 0.0;
- thiscp->xform[i].fan2_y = 0.0;
- thiscp->xform[i].rings2_val = 0.0;
- thiscp->xform[i].perspective_angle = 0.0;
- thiscp->xform[i].perspective_dist = 0.0;
- thiscp->xform[i].persp_vsin = 0.0;
- thiscp->xform[i].persp_vfcos = 0.0;
- thiscp->xform[i].radial_blur_angle = 0.0;
- thiscp->xform[i].disc2_rot = 0.0;
- thiscp->xform[i].disc2_twist = 0.0;
- thiscp->xform[i].disc2_sinadd = 0.0;
- thiscp->xform[i].disc2_cosadd = 0.0;
- thiscp->xform[i].disc2_timespi = 0.0;
- thiscp->xform[i].flower_petals = 0.0;
- thiscp->xform[i].flower_holes = 0.0;
- thiscp->xform[i].parabola_height = 0.0;
- thiscp->xform[i].parabola_width = 0.0;
- thiscp->xform[i].bent2_x = 1.0;
- thiscp->xform[i].bent2_y = 1.0;
- thiscp->xform[i].bipolar_shift = 0.0;
- thiscp->xform[i].cell_size = 1.0;
- thiscp->xform[i].cpow_r = 1.0;
- thiscp->xform[i].cpow_i = 0.0;
- thiscp->xform[i].cpow_power = 1.0;
- thiscp->xform[i].curve_xamp = 0.0;
- thiscp->xform[i].curve_yamp = 0.0;
- thiscp->xform[i].curve_xlength = 1.0;
- thiscp->xform[i].curve_ylength = 1.0;
- thiscp->xform[i].escher_beta = 0.0;
- thiscp->xform[i].lazysusan_space = 0.0;
- thiscp->xform[i].lazysusan_twist = 0.0;
- thiscp->xform[i].lazysusan_spin = 0.0;
- thiscp->xform[i].lazysusan_x = 0.0;
- thiscp->xform[i].lazysusan_y = 0.0;
- thiscp->xform[i].modulus_x = 0.0;
- thiscp->xform[i].modulus_y = 0.0;
- thiscp->xform[i].oscope_separation = 1.0;
- thiscp->xform[i].oscope_frequency = M_PI;
- thiscp->xform[i].oscope_amplitude = 1.0;
- thiscp->xform[i].oscope_damping = 0.0;
- thiscp->xform[i].popcorn2_c = 0.0;
- thiscp->xform[i].popcorn2_x = 0.0;
- thiscp->xform[i].popcorn2_y = 0.0;
- thiscp->xform[i].separation_x = 0.0;
- thiscp->xform[i].separation_xinside = 0.0;
- thiscp->xform[i].separation_y = 0.0;
- thiscp->xform[i].separation_yinside = 0.0;
- thiscp->xform[i].split_xsize = 0.0;
- thiscp->xform[i].split_ysize = 0.0;
- thiscp->xform[i].splits_x = 0.0;
- thiscp->xform[i].splits_y = 0.0;
- thiscp->xform[i].stripes_space = 0.0;
- thiscp->xform[i].stripes_warp = 0.0;
- thiscp->xform[i].wedge_angle = 0.0;
- thiscp->xform[i].wedge_hole = 0.0;
- thiscp->xform[i].wedge_count = 1.0;
- thiscp->xform[i].wedge_swirl = 0.0;
- thiscp->xform[i].wedge_sph_angle = 0.0;
- thiscp->xform[i].wedge_sph_hole = 0.0;
- thiscp->xform[i].wedge_sph_count = 1.0;
- thiscp->xform[i].wedge_sph_swirl = 0.0;
-
- thiscp->xform[i].wedge_julia_power = 1.0;
- thiscp->xform[i].wedge_julia_dist = 0.0;
- thiscp->xform[i].wedge_julia_count = 1.0;
- thiscp->xform[i].wedge_julia_angle = 0.0;
- thiscp->xform[i].wedgeJulia_cf = 0.0;
- thiscp->xform[i].wedgeJulia_cn = 0.5;
- thiscp->xform[i].wedgeJulia_rN = 1.0;
- thiscp->xform[i].whorl_inside = 0.0;
- thiscp->xform[i].whorl_outside = 0.0;
-
- thiscp->xform[i].waves2_scalex = 0.0;
- thiscp->xform[i].waves2_scaley = 0.0;
- thiscp->xform[i].waves2_freqx = 0.0;
- thiscp->xform[i].waves2_freqy = 0.0;
-
- thiscp->xform[i].auger_freq = 1.0;
- thiscp->xform[i].auger_weight = 0.5;
- thiscp->xform[i].auger_sym = 0.0;
- thiscp->xform[i].auger_scale = 1.0;
-
- thiscp->xform[i].flux_spread = 0.0;
-
- thiscp->xform[i].julian_power = 1.0;
- thiscp->xform[i].julian_dist = 1.0;
- thiscp->xform[i].julian_rN = 1.0;
- thiscp->xform[i].julian_cn = 0.5;
- thiscp->xform[i].juliascope_power = 1.0;
- thiscp->xform[i].juliascope_dist = 1.0;
- thiscp->xform[i].juliascope_rN = 1.0;
- thiscp->xform[i].juliascope_cn = 0.5;
- thiscp->xform[i].radialBlur_spinvar = 0.0;
- thiscp->xform[i].radialBlur_zoomvar = 1.0;
- thiscp->xform[i].pie_slices = 6.0;
- thiscp->xform[i].pie_rotation = 0.0;
- thiscp->xform[i].pie_thickness = 0.5;
- thiscp->xform[i].ngon_sides = 5;
- thiscp->xform[i].ngon_power = 3;
- thiscp->xform[i].ngon_circle = 1;
- thiscp->xform[i].ngon_corners = 2;
- thiscp->xform[i].curl_c1 = 1.0;
- thiscp->xform[i].curl_c2 = 0.0;
- thiscp->xform[i].rectangles_x = 1.0;
- thiscp->xform[i].rectangles_y = 1.0;
- thiscp->xform[i].super_shape_rnd = 0.0;
- thiscp->xform[i].super_shape_m = 0.0;
- thiscp->xform[i].super_shape_n1 = 1.0;
- thiscp->xform[i].super_shape_n2 = 1.0;
- thiscp->xform[i].super_shape_n3 = 1.0;
- thiscp->xform[i].super_shape_holes = 0.0;
- thiscp->xform[i].conic_eccentricity = 1.0;
- thiscp->xform[i].conic_holes = 0.0;
-
- thiscp->xform[i].mobius_re_a = 0.0;
- thiscp->xform[i].mobius_re_b = 0.0;
- thiscp->xform[i].mobius_re_c = 0.0;
- thiscp->xform[i].mobius_re_d = 0.0;
- thiscp->xform[i].mobius_im_a = 0.0;
- thiscp->xform[i].mobius_im_b = 0.0;
- thiscp->xform[i].mobius_im_c = 0.0;
- thiscp->xform[i].mobius_im_d = 0.0;
- }
-}
diff --git a/variations.h b/variations.h
index 1aa7a7a..b1c3d42 100644
--- a/variations.h
+++ b/variations.h
@@ -24,5 +24,4 @@ int prepare_precalc_flags(flam3_genome *);
int apply_xform(const flam3_xform * const xf, const unsigned int fn,
const double4 p, double4 *q_ret, randctx * const rc);
-void initialize_xforms(flam3_genome *thiscp, int start_here);