1 /**
2  * Mandelbulber v2, a 3D fractal generator       ,=#MKNmMMKmmßMNWy,
3  *                                             ,B" ]L,,p%%%,,,§;, "K
4  * Copyright (C) 2014-20 Mandelbulber Team     §R-==%w["'~5]m%=L.=~5N
5  *                                        ,=mm=§M ]=4 yJKA"/-Nsaj  "Bw,==,,
6  * This file is part of Mandelbulber.    §R.r= jw",M  Km .mM  FW ",§=ß., ,TN
7  *                                     ,4R =%["w[N=7]J '"5=],""]]M,w,-; T=]M
8  * Mandelbulber is free software:     §R.ß~-Q/M=,=5"v"]=Qf,'§"M= =,M.§ Rz]M"Kw
9  * you can redistribute it and/or     §w "xDY.J ' -"m=====WeC=\ ""%""y=%"]"" §
10  * modify it under the terms of the    "§M=M =D=4"N #"%==A%p M§ M6  R' #"=~.4M
11  * GNU General Public License as        §W =, ][T"]C  §  § '§ e===~ U  !§[Z ]N
12  * published by the                    4M",,Jm=,"=e~  §  §  j]]""N  BmM"py=ßM
13  * Free Software Foundation,          ]§ T,M=& 'YmMMpM9MMM%=w=,,=MT]M m§;'§,
14  * either version 3 of the License,    TWw [.j"5=~N[=§%=%W,T ]R,"=="Y[LFT ]N
15  * or (at your option)                   TW=,-#"%=;[  =Q:["V""  ],,M.m == ]N
16  * any later version.                      J§"mr"] ,=,," =="""J]= M"M"]==ß"
17  *                                          §= "=C=4 §"eM "=B:m|4"]#F,§~
18  * Mandelbulber is distributed in            "9w=,,]w em%wJ '"~" ,=,,ß"
19  * the hope that it will be useful,                 . "K=  ,=RMMMßM"""
20  * but WITHOUT ANY WARRANTY;                            .'''
21  * without even the implied warranty
22  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23  *
24  * See the GNU General Public License for more details.
25  * You should have received a copy of the GNU General Public License
26  * along with Mandelbulber. If not, see <http://www.gnu.org/licenses/>.
27  *
28  * ###########################################################################
29  *
30  * Authors: Krzysztof Marczak (buddhi1980@gmail.com), Rayan Hitchman
31  *
32  * cOldSettings class - importing settings from old Mandelbulber (v1.21)
33  */
34 
35 #include "old_settings.hpp"
36 
37 #include "camera_target.hpp"
38 #include "color_gradient.h"
39 #include "error_message.hpp"
40 #include "fractal_container.hpp"
41 #include "fractparams.hpp"
42 #include "initparameters.hpp"
43 #include "system_directories.hpp"
44 #include "write_log.hpp"
45 
46 #include "formula/definition/all_fractal_list.hpp"
47 
48 namespace oldSettings
49 {
50 
51 const char *axis_names[] = {"X", "Y", "Z"};
52 const char *component_names[] = {"alfa", "beta", "gamma"};
53 
cOldSettings()54 cOldSettings::cOldSettings()
55 {
56 	oldData = new sParamRender;
57 	paletteLoadedFromSettingsFile = false;
58 }
59 
~cOldSettings()60 cOldSettings::~cOldSettings()
61 {
62 	delete oldData;
63 }
64 
LoadSettings(const QString & filename)65 bool cOldSettings::LoadSettings(const QString &filename)
66 {
67 	QString defaultsFilename =
68 		systemDirectories.sharedDir + "data" + QDir::separator() + "mandelbulber_1.21_defaults.fract";
69 
70 	if (QFileInfo::exists(defaultsFilename))
71 	{
72 		LoadSettings2(defaultsFilename);
73 	}
74 	else
75 	{
76 		cErrorMessage::showMessage(QObject::tr("Can't import old settings\n")
77 																 + QObject::tr("File with default values doesn't exist\n")
78 																 + defaultsFilename,
79 			cErrorMessage::errorMessage);
80 		return false;
81 	}
82 	return LoadSettings2(filename);
83 }
84 
LoadSettings2(const QString & filename)85 bool cOldSettings::LoadSettings2(const QString &filename)
86 {
87 	paletteLoadedFromSettingsFile = false;
88 
89 	char str1[100];
90 	char str2[2000];
91 
92 	FILE *fileSettings;
93 	fileSettings = fopen(filename.toLocal8Bit(), "r");
94 
95 	int lineCounter = 0;
96 
97 	oldData->settingsVersion = -1;
98 
99 	if (fileSettings)
100 	{
101 		while (!feof(fileSettings))
102 		{
103 			lineCounter++;
104 			int c = fscanf(fileSettings, "%s", str1);
105 			if (c > 0)
106 			{
107 				c = fscanf(fileSettings, "%[ ]", str2);
108 				c = fscanf(fileSettings, "%[^;]", str2);
109 
110 				LoadOneSetting(str1, str2, oldData);
111 				c = fscanf(fileSettings, "%[^\n]", str2);
112 			}
113 		}
114 		fclose(fileSettings);
115 
116 		return true;
117 	}
118 	else
119 	{
120 		// printf("Can't open settings file: %s\n", filename);
121 		return false;
122 	}
123 }
124 
atof2(const char * str)125 double cOldSettings::atof2(const char *str)
126 {
127 	QString string(str);
128 	string = string.replace(',', '.');
129 	return string.toDouble();
130 }
131 
GetPaletteFromString(sRGB * palette,const char * paletteString)132 void cOldSettings::GetPaletteFromString(sRGB *palette, const char *paletteString)
133 {
134 	int index = 0;
135 	for (int i = 0; i < 2000; i++)
136 	{
137 		int colour = 0;
138 		sscanf(&paletteString[i], "%x", reinterpret_cast<unsigned int *>(&colour));
139 		sRGB rgbColour;
140 		rgbColour.R = colour / 65536;
141 		rgbColour.G = (colour / 256) % 256;
142 		rgbColour.B = colour % 256;
143 		palette[index] = rgbColour;
144 		// printf("R = %d, G = %d, B = %d\n", rgbColour.R, rgbColour.G, rgbColour.B);
145 
146 		while (i < 2000 && paletteString[i] != ' ')
147 		{
148 			i++;
149 		}
150 		index++;
151 		if (index == 256)
152 		{
153 			paletteLoadedFromSettingsFile = true;
154 			break;
155 		}
156 	}
157 }
158 
LoadOneSetting(const char * str1,const char * str2,sParamRender * params)159 bool cOldSettings::LoadOneSetting(const char *str1, const char *str2, sParamRender *params)
160 {
161 	// ****** this function is taken directly from Mandelbulber v1.21 *******
162 
163 	char str3[100];
164 
165 	if (!strcmp(str1, "Mandelbulber"))
166 		params->settingsVersion = atof2(str2);
167 	else if (!strcmp(str1, "image_width"))
168 		params->image_width = atoi(str2);
169 	else if (!strcmp(str1, "image_height"))
170 		params->image_height = atoi(str2);
171 	else if (!strcmp(str1, "tiles"))
172 		params->noOfTiles = atoi(str2);
173 	else if (!strcmp(str1, "x_min"))
174 		params->fractal.doubles.amin = atof2(str2);
175 	else if (!strcmp(str1, "x_max"))
176 		params->fractal.doubles.amax = atof2(str2);
177 	else if (!strcmp(str1, "y_min"))
178 		params->fractal.doubles.bmin = atof2(str2);
179 	else if (!strcmp(str1, "y_max"))
180 		params->fractal.doubles.bmax = atof2(str2);
181 	else if (!strcmp(str1, "z_min"))
182 		params->fractal.doubles.cmin = atof2(str2);
183 	else if (!strcmp(str1, "z_max"))
184 		params->fractal.doubles.cmax = atof2(str2);
185 	else if (!strcmp(str1, "view_point_x"))
186 		params->doubles.vp.x = atof2(str2);
187 	else if (!strcmp(str1, "view_point_y"))
188 		params->doubles.vp.y = atof2(str2);
189 	else if (!strcmp(str1, "view_point_z"))
190 		params->doubles.vp.z = atof2(str2);
191 	else if (!strcmp(str1, "angle_alfa"))
192 		params->doubles.alpha = atof2(str2) / 180.0 * M_PI;
193 	else if (!strcmp(str1, "angle_beta"))
194 		params->doubles.beta = atof2(str2) / 180.0 * M_PI;
195 	else if (!strcmp(str1, "angle_gamma"))
196 		params->doubles.gamma = atof2(str2) / 180.0 * M_PI;
197 	else if (!strcmp(str1, "zoom"))
198 		params->doubles.zoom = atof2(str2);
199 	else if (!strcmp(str1, "perspective"))
200 		params->doubles.persp = atof2(str2);
201 	else if (!strcmp(str1, "formula"))
202 		params->fractal.formula = enumOldFractalFormula(atoi(str2));
203 	else if (!strcmp(str1, "power"))
204 		params->fractal.doubles.power = atof2(str2);
205 	else if (!strcmp(str1, "N"))
206 		params->fractal.doubles.N = atoi(str2);
207 	else if (!strcmp(str1, "minN"))
208 		params->fractal.minN = atoi(str2);
209 	else if (!strcmp(str1, "fractal_constant_factor"))
210 		params->fractal.doubles.constantFactor = atof2(str2);
211 	else if (!strcmp(str1, "quality"))
212 		params->doubles.quality = atof2(str2);
213 	else if (!strcmp(str1, "smoothness"))
214 		params->doubles.smoothness = atof2(str2);
215 	else if (!strcmp(str1, "julia_mode"))
216 		params->fractal.juliaMode = atoi(str2);
217 	else if (!strcmp(str1, "julia_a"))
218 		params->fractal.doubles.julia.x = atof2(str2);
219 	else if (!strcmp(str1, "julia_b"))
220 		params->fractal.doubles.julia.y = atof2(str2);
221 	else if (!strcmp(str1, "julia_c"))
222 		params->fractal.doubles.julia.z = atof2(str2);
223 	else if (!strcmp(str1, "tglad_folding_mode"))
224 		params->fractal.tgladFoldingMode = atoi(str2);
225 	else if (!strcmp(str1, "folding_limit"))
226 		params->fractal.doubles.foldingLimit = atof2(str2);
227 	else if (!strcmp(str1, "folding_value"))
228 		params->fractal.doubles.foldingValue = atof2(str2);
229 	else if (!strcmp(str1, "spherical_folding_mode"))
230 		params->fractal.sphericalFoldingMode = atoi(str2);
231 	else if (!strcmp(str1, "spherical_folding_fixed"))
232 		params->fractal.doubles.foldingSphericalFixed = atof2(str2);
233 	else if (!strcmp(str1, "spherical_folding_min"))
234 		params->fractal.doubles.foldingSphericalMin = atof2(str2);
235 	else if (!strcmp(str1, "iteration_threshold_mode"))
236 		params->fractal.iterThresh = atoi(str2);
237 	else if (!strcmp(str1, "analityc_DE_mode"))
238 		params->fractal.analyticDE = atoi(str2);
239 	else if (!strcmp(str1, "DE_factor"))
240 		params->doubles.DE_factor = atof2(str2);
241 	else if (!strcmp(str1, "brightness"))
242 		params->doubles.imageAdjustments.brightness = atof2(str2);
243 	else if (!strcmp(str1, "contrast"))
244 		params->doubles.imageAdjustments.contrast = atof2(str2);
245 	else if (!strcmp(str1, "gamma"))
246 		params->doubles.imageAdjustments.imageGamma = atof2(str2);
247 	else if (!strcmp(str1, "hdr"))
248 		params->imageSwitches.hdrEnabled = atoi(str2);
249 	else if (!strcmp(str1, "ambient"))
250 		params->doubles.imageAdjustments.ambient = atof2(str2);
251 	else if (!strcmp(str1, "reflect"))
252 		params->doubles.imageAdjustments.reflect = atof2(str2);
253 	else if (!strcmp(str1, "shadows_intensity"))
254 		params->doubles.imageAdjustments.directLight = atof2(str2);
255 	else if (!strcmp(str1, "shadows_cone_angle"))
256 		params->doubles.shadowConeAngle = atof2(str2);
257 	else if (!strcmp(str1, "ambient_occlusion"))
258 		params->doubles.imageAdjustments.globalIlum = atof2(str2);
259 	else if (!strcmp(str1, "ambient_occlusion_quality"))
260 		params->globalIlumQuality = atoi(str2);
261 	else if (!strcmp(str1, "ambient_occlusion_fast_tune"))
262 		params->doubles.fastAoTune = atof2(str2);
263 	else if (!strcmp(str1, "shading"))
264 		params->doubles.imageAdjustments.shading = atof2(str2);
265 	else if (!strcmp(str1, "specular"))
266 		params->doubles.imageAdjustments.specular = atof2(str2);
267 	else if (QString(str1).startsWith("glow_"))
268 	{
269 		if (!strcmp(str1, "glow_intensity"))
270 			params->doubles.imageAdjustments.glow_intensity = atof2(str2);
271 		else if (!strcmp(str1, "glow_color_1_R"))
272 			params->effectColours.glow_color1.R = atoi(str2);
273 		else if (!strcmp(str1, "glow_color_1_G"))
274 			params->effectColours.glow_color1.G = atoi(str2);
275 		else if (!strcmp(str1, "glow_color_1_B"))
276 			params->effectColours.glow_color1.B = atoi(str2);
277 		else if (!strcmp(str1, "glow_color_2_R"))
278 			params->effectColours.glow_color2.R = atoi(str2);
279 		else if (!strcmp(str1, "glow_color_2_G"))
280 			params->effectColours.glow_color2.G = atoi(str2);
281 		else if (!strcmp(str1, "glow_color_2_B"))
282 			params->effectColours.glow_color2.B = atoi(str2);
283 	}
284 	else if (QString(str1).startsWith("background_color_"))
285 	{
286 		if (!strcmp(str1, "background_color_1_R"))
287 			params->background_color1.R = atoi(str2);
288 		else if (!strcmp(str1, "background_color_1_G"))
289 			params->background_color1.G = atoi(str2);
290 		else if (!strcmp(str1, "background_color_1_B"))
291 			params->background_color1.B = atoi(str2);
292 		else if (!strcmp(str1, "background_color_2_R"))
293 			params->background_color2.R = atoi(str2);
294 		else if (!strcmp(str1, "background_color_2_G"))
295 			params->background_color2.G = atoi(str2);
296 		else if (!strcmp(str1, "background_color_2_B"))
297 			params->background_color2.B = atoi(str2);
298 		else if (!strcmp(str1, "background_color_3_R"))
299 			params->background_color3.R = atoi(str2);
300 		else if (!strcmp(str1, "background_color_3_G"))
301 			params->background_color3.G = atoi(str2);
302 		else if (!strcmp(str1, "background_color_3_B"))
303 			params->background_color3.B = atoi(str2);
304 	}
305 	else if (QString(str1).startsWith("fog_colour_"))
306 	{
307 		if (!strcmp(str1, "fog_colour_1_R"))
308 			params->fogColour1.R = atoi(str2);
309 		else if (!strcmp(str1, "fog_colour_1_G"))
310 			params->fogColour1.G = atoi(str2);
311 		else if (!strcmp(str1, "fog_colour_1_B"))
312 			params->fogColour1.B = atoi(str2);
313 		else if (!strcmp(str1, "fog_colour_2_R"))
314 			params->fogColour2.R = atoi(str2);
315 		else if (!strcmp(str1, "fog_colour_2_G"))
316 			params->fogColour2.G = atoi(str2);
317 		else if (!strcmp(str1, "fog_colour_2_B"))
318 			params->fogColour2.B = atoi(str2);
319 		else if (!strcmp(str1, "fog_colour_3_R"))
320 			params->fogColour3.R = atoi(str2);
321 		else if (!strcmp(str1, "fog_colour_3_G"))
322 			params->fogColour3.G = atoi(str2);
323 		else if (!strcmp(str1, "fog_colour_3_B"))
324 			params->fogColour3.B = atoi(str2);
325 	}
326 	else if (!strcmp(str1, "textured_background"))
327 		params->texturedBackground = atoi(str2);
328 	else if (!strcmp(str1, "background_as_fuldome"))
329 		params->background_as_fulldome = atoi(str2);
330 	else if (!strcmp(str1, "shadows_enabled"))
331 		params->shadow = atoi(str2);
332 	else if (!strcmp(str1, "ambient_occlusion_enabled"))
333 		params->global_ilumination = atoi(str2);
334 	else if (!strcmp(str1, "fast_ambient_occlusion_mode"))
335 		params->fastGlobalIllumination = atoi(str2);
336 	else if (!strcmp(str1, "fractal_color"))
337 		params->imageSwitches.coloringEnabled = atoi(str2);
338 	else if (!strcmp(str1, "coloring_random_seed"))
339 		params->coloring_seed = atoi(str2);
340 	else if (!strcmp(str1, "coloring_saturation"))
341 		params->doubles.colourSaturation = atof2(str2);
342 	else if (!strcmp(str1, "coloring_speed"))
343 		params->doubles.imageAdjustments.coloring_speed = atof2(str2);
344 	else if (!strcmp(str1, "coloring_palette_offset"))
345 		params->doubles.imageAdjustments.paletteOffset = atof2(str2);
346 	else if (!strcmp(str1, "slow_shading"))
347 		params->slowShading = atoi(str2);
348 	else if (!strcmp(str1, "limits_enabled"))
349 		params->fractal.limits_enabled = atoi(str2);
350 	else if (QString(str1).startsWith("post_"))
351 	{
352 		if (!strcmp(str1, "post_fog_enabled"))
353 			params->imageSwitches.fogEnabled = atoi(str2);
354 		else if (!strcmp(str1, "post_fog_visibility"))
355 			params->doubles.imageAdjustments.fogVisibility = atof2(str2);
356 		else if (!strcmp(str1, "post_fog_color_R"))
357 			params->effectColours.fogColor.R = atoi(str2);
358 		else if (!strcmp(str1, "post_fog_color_G"))
359 			params->effectColours.fogColor.G = atoi(str2);
360 		else if (!strcmp(str1, "post_fog_color_B"))
361 			params->effectColours.fogColor.B = atoi(str2);
362 		else if (!strcmp(str1, "post_SSAO_enabled"))
363 			params->SSAOEnabled = atoi(str2);
364 		else if (!strcmp(str1, "post_SSAO_quality"))
365 			params->SSAOQuality = atoi(str2);
366 		else if (!strcmp(str1, "post_DOF_enabled"))
367 			params->DOFEnabled = atoi(str2);
368 		else if (!strcmp(str1, "post_DOF_focus"))
369 			params->doubles.DOFFocus = atof2(str2);
370 		else if (!strcmp(str1, "post_DOF_radius"))
371 			params->doubles.DOFRadius = atof2(str2);
372 	}
373 	else if (QString(str1).startsWith("main_light_"))
374 	{
375 		if (!strcmp(str1, "main_light_intensity"))
376 			params->doubles.imageAdjustments.mainLightIntensity = atof2(str2);
377 		else if (!strcmp(str1, "main_light_alfa"))
378 			params->doubles.mainLightAlpha = atof2(str2);
379 		else if (!strcmp(str1, "main_light_beta"))
380 			params->doubles.mainLightBeta = atof2(str2);
381 		else if (!strcmp(str1, "main_light_colour_R"))
382 			params->effectColours.mainLightColour.R = atoi(str2);
383 		else if (!strcmp(str1, "main_light_colour_G"))
384 			params->effectColours.mainLightColour.G = atoi(str2);
385 		else if (!strcmp(str1, "main_light_colour_B"))
386 			params->effectColours.mainLightColour.B = atoi(str2);
387 	}
388 	else if (QString(str1).startsWith("aux_light_"))
389 	{
390 		if (!strcmp(str1, "aux_light_intensity"))
391 			params->doubles.auxLightIntensity = atof2(str2);
392 		else if (!strcmp(str1, "aux_light_random_seed"))
393 			params->auxLightRandomSeed = atoi(str2);
394 		else if (!strcmp(str1, "aux_light_number"))
395 			params->auxLightNumber = atoi(str2);
396 		else if (!strcmp(str1, "aux_light_max_dist"))
397 			params->doubles.auxLightMaxDist = atof2(str2);
398 		else if (!strcmp(str1, "aux_light_distribution_radius"))
399 			params->doubles.auxLightDistributionRadius = atof2(str2);
400 		else if (!strcmp(str1, "aux_light_predefined_1_x"))
401 			params->doubles.auxLightPre[0].x = atof2(str2);
402 		else if (!strcmp(str1, "aux_light_predefined_1_y"))
403 			params->doubles.auxLightPre[0].y = atof2(str2);
404 		else if (!strcmp(str1, "aux_light_predefined_1_z"))
405 			params->doubles.auxLightPre[0].z = atof2(str2);
406 		else if (!strcmp(str1, "aux_light_predefined_1_intensity"))
407 			params->doubles.auxLightPreIntensity[0] = atof2(str2);
408 		else if (!strcmp(str1, "aux_light_predefined_2_x"))
409 			params->doubles.auxLightPre[1].x = atof2(str2);
410 		else if (!strcmp(str1, "aux_light_predefined_2_y"))
411 			params->doubles.auxLightPre[1].y = atof2(str2);
412 		else if (!strcmp(str1, "aux_light_predefined_2_z"))
413 			params->doubles.auxLightPre[1].z = atof2(str2);
414 		else if (!strcmp(str1, "aux_light_predefined_2_intensity"))
415 			params->doubles.auxLightPreIntensity[1] = atof2(str2);
416 		else if (!strcmp(str1, "aux_light_predefined_3_x"))
417 			params->doubles.auxLightPre[2].x = atof2(str2);
418 		else if (!strcmp(str1, "aux_light_predefined_3_y"))
419 			params->doubles.auxLightPre[2].y = atof2(str2);
420 		else if (!strcmp(str1, "aux_light_predefined_3_z"))
421 			params->doubles.auxLightPre[2].z = atof2(str2);
422 		else if (!strcmp(str1, "aux_light_predefined_3_intensity"))
423 			params->doubles.auxLightPreIntensity[2] = atof2(str2);
424 		else if (!strcmp(str1, "aux_light_predefined_4_x"))
425 			params->doubles.auxLightPre[3].x = atof2(str2);
426 		else if (!strcmp(str1, "aux_light_predefined_4_y"))
427 			params->doubles.auxLightPre[3].y = atof2(str2);
428 		else if (!strcmp(str1, "aux_light_predefined_4_z"))
429 			params->doubles.auxLightPre[3].z = atof2(str2);
430 		else if (!strcmp(str1, "aux_light_predefined_4_intensity"))
431 			params->doubles.auxLightPreIntensity[3] = atof2(str2);
432 		else if (!strcmp(str1, "aux_light_predefined_1_enabled"))
433 			params->auxLightPreEnabled[0] = atoi(str2);
434 		else if (!strcmp(str1, "aux_light_predefined_2_enabled"))
435 			params->auxLightPreEnabled[1] = atoi(str2);
436 		else if (!strcmp(str1, "aux_light_predefined_3_enabled"))
437 			params->auxLightPreEnabled[2] = atoi(str2);
438 		else if (!strcmp(str1, "aux_light_predefined_4_enabled"))
439 			params->auxLightPreEnabled[3] = atoi(str2);
440 		else if (!strcmp(str1, "aux_light_predefined_1_colour_R"))
441 			params->auxLightPreColour[0].R = atoi(str2);
442 		else if (!strcmp(str1, "aux_light_predefined_1_colour_G"))
443 			params->auxLightPreColour[0].G = atoi(str2);
444 		else if (!strcmp(str1, "aux_light_predefined_1_colour_B"))
445 			params->auxLightPreColour[0].B = atoi(str2);
446 		else if (!strcmp(str1, "aux_light_predefined_2_colour_R"))
447 			params->auxLightPreColour[1].R = atoi(str2);
448 		else if (!strcmp(str1, "aux_light_predefined_2_colour_G"))
449 			params->auxLightPreColour[1].G = atoi(str2);
450 		else if (!strcmp(str1, "aux_light_predefined_2_colour_B"))
451 			params->auxLightPreColour[1].B = atoi(str2);
452 		else if (!strcmp(str1, "aux_light_predefined_3_colour_R"))
453 			params->auxLightPreColour[2].R = atoi(str2);
454 		else if (!strcmp(str1, "aux_light_predefined_3_colour_G"))
455 			params->auxLightPreColour[2].G = atoi(str2);
456 		else if (!strcmp(str1, "aux_light_predefined_3_colour_B"))
457 			params->auxLightPreColour[2].B = atoi(str2);
458 		else if (!strcmp(str1, "aux_light_predefined_4_colour_R"))
459 			params->auxLightPreColour[3].R = atoi(str2);
460 		else if (!strcmp(str1, "aux_light_predefined_4_colour_G"))
461 			params->auxLightPreColour[3].G = atoi(str2);
462 		else if (!strcmp(str1, "aux_light_predefined_4_colour_B"))
463 			params->auxLightPreColour[3].B = atoi(str2);
464 		else if (!strcmp(str1, "aux_light_visibility"))
465 			params->doubles.auxLightVisibility = atof2(str2);
466 		else if (!strcmp(str1, "aux_light_random_center_X"))
467 			params->doubles.auxLightRandomCenter.x = atof2(str2);
468 		else if (!strcmp(str1, "aux_light_random_center_Y"))
469 			params->doubles.auxLightRandomCenter.y = atof2(str2);
470 		else if (!strcmp(str1, "aux_light_random_center_Z"))
471 			params->doubles.auxLightRandomCenter.z = atof2(str2);
472 	}
473 	else if (QString(str1).startsWith("IFS_"))
474 	{
475 		if (!strcmp(str1, "IFS_scale"))
476 			params->fractal.IFS.doubles.scale = atof2(str2);
477 		else if (!strcmp(str1, "IFS_rot_alfa"))
478 			params->fractal.IFS.doubles.rotationAlfa = atof2(str2);
479 		else if (!strcmp(str1, "IFS_rot_beta"))
480 			params->fractal.IFS.doubles.rotationBeta = atof2(str2);
481 		else if (!strcmp(str1, "IFS_rot_gamma"))
482 			params->fractal.IFS.doubles.rotationGamma = atof2(str2);
483 		else if (!strcmp(str1, "IFS_offsetX"))
484 			params->fractal.IFS.doubles.offset.x = atof2(str2);
485 		else if (!strcmp(str1, "IFS_offsetY"))
486 			params->fractal.IFS.doubles.offset.y = atof2(str2);
487 		else if (!strcmp(str1, "IFS_offsetZ"))
488 			params->fractal.IFS.doubles.offset.z = atof2(str2);
489 		else if (!strcmp(str1, "IFS_edgeX"))
490 			params->fractal.IFS.doubles.edge.x = atof2(str2);
491 		else if (!strcmp(str1, "IFS_edgeY"))
492 			params->fractal.IFS.doubles.edge.y = atof2(str2);
493 		else if (!strcmp(str1, "IFS_edgeZ"))
494 			params->fractal.IFS.doubles.edge.z = atof2(str2);
495 		else if (!strcmp(str1, "IFS_absX"))
496 			params->fractal.IFS.absX = atof(str2);
497 		else if (!strcmp(str1, "IFS_absY"))
498 			params->fractal.IFS.absY = atof(str2);
499 		else if (!strcmp(str1, "IFS_absZ"))
500 			params->fractal.IFS.absZ = atof(str2);
501 		else if (!strcmp(str1, "IFS_menger_sponge_mode"))
502 			params->fractal.IFS.mengerSpongeMode = atof(str2);
503 		else if (!strcmp(str1, "IFS_folding_mode"))
504 			params->fractal.IFS.foldingMode = atoi(str2);
505 		else
506 		{
507 			for (int i = 0; i < IFS_VECTOR_COUNT; i++)
508 			{
509 				sprintf(str3, "IFS_%d_x", i);
510 				if (!strcmp(str1, str3))
511 				{
512 					params->fractal.IFS.doubles.direction[i].x = atof2(str2);
513 					break;
514 				}
515 				sprintf(str3, "IFS_%d_y", i);
516 				if (!strcmp(str1, str3))
517 				{
518 					params->fractal.IFS.doubles.direction[i].y = atof2(str2);
519 					break;
520 				}
521 				sprintf(str3, "IFS_%d_z", i);
522 				if (!strcmp(str1, str3))
523 				{
524 					params->fractal.IFS.doubles.direction[i].z = atof2(str2);
525 					break;
526 				}
527 				sprintf(str3, "IFS_%d_alfa", i);
528 				if (!strcmp(str1, str3))
529 				{
530 					params->fractal.IFS.doubles.alfa[i] = atof2(str2);
531 					break;
532 				}
533 				sprintf(str3, "IFS_%d_beta", i);
534 				if (!strcmp(str1, str3))
535 				{
536 					params->fractal.IFS.doubles.beta[i] = atof2(str2);
537 					break;
538 				}
539 				sprintf(str3, "IFS_%d_gamma", i);
540 				if (!strcmp(str1, str3))
541 				{
542 					params->fractal.IFS.doubles.gamma[i] = atof2(str2);
543 					break;
544 				}
545 				sprintf(str3, "IFS_%d_distance", i);
546 				if (!strcmp(str1, str3))
547 				{
548 					params->fractal.IFS.doubles.distance[i] = atof2(str2);
549 					break;
550 				}
551 				sprintf(str3, "IFS_%d_intensity", i);
552 				if (!strcmp(str1, str3))
553 				{
554 					params->fractal.IFS.doubles.intensity[i] = atof2(str2);
555 					break;
556 				}
557 				sprintf(str3, "IFS_%d_enabled", i);
558 				if (!strcmp(str1, str3))
559 				{
560 					params->fractal.IFS.enabled[i] = atoi(str2);
561 					break;
562 				}
563 			}
564 		}
565 	}
566 	else if (!strcmp(str1, "start_frame"))
567 		params->startFrame = atoi(str2);
568 	else if (!strcmp(str1, "end_frame"))
569 		params->endFrame = atoi(str2);
570 	else if (!strcmp(str1, "frames_per_keyframe"))
571 		params->framesPerKeyframe = atoi(str2);
572 	else if (!strcmp(str1, "hybrid_cyclic"))
573 		params->fractal.hybridCyclic = atoi(str2);
574 	else if (!strcmp(str1, "fish_eye"))
575 		params->perspectiveType = enumPerspectiveType(atoi(str2));
576 	else if (!strcmp(str1, "fish_eye_180cut"))
577 		params->fishEyeCut = atoi(str2);
578 	else if (!strcmp(str1, "stereo_enabled"))
579 		params->stereoEnabled = atoi(str2);
580 	else if (!strcmp(str1, "stereo_eye_distance"))
581 		params->doubles.stereoEyeDistance = atof2(str2);
582 	else if (QString(str1).startsWith("mandelbox_"))
583 	{
584 		if (!strcmp(str1, "mandelbox_scale"))
585 			params->fractal.mandelbox.doubles.scale = atof2(str2);
586 		else if (!strcmp(str1, "mandelbox_folding_limit"))
587 			params->fractal.mandelbox.doubles.foldingLimit = atof2(str2);
588 		else if (!strcmp(str1, "mandelbox_folding_value"))
589 			params->fractal.mandelbox.doubles.foldingValue = atof2(str2);
590 		else if (!strcmp(str1, "mandelbox_folding_min_radius"))
591 			params->fractal.mandelbox.doubles.foldingSphericalMin = atof2(str2);
592 		else if (!strcmp(str1, "mandelbox_folding_fixed_radius"))
593 			params->fractal.mandelbox.doubles.foldingSphericalFixed = atof2(str2);
594 		else if (!strcmp(str1, "mandelbox_sharpness"))
595 			params->fractal.mandelbox.doubles.sharpness = atof2(str2);
596 		else if (!strcmp(str1, "mandelbox_offset_X"))
597 			params->fractal.mandelbox.doubles.offset.x = atof2(str2);
598 		else if (!strcmp(str1, "mandelbox_offset_Y"))
599 			params->fractal.mandelbox.doubles.offset.y = atof2(str2);
600 		else if (!strcmp(str1, "mandelbox_offset_Z"))
601 			params->fractal.mandelbox.doubles.offset.z = atof2(str2);
602 		else if (!strcmp(str1, "mandelbox_color_R"))
603 			params->fractal.mandelbox.doubles.colorFactorR = atof2(str2);
604 		else if (!strcmp(str1, "mandelbox_color_X"))
605 			params->fractal.mandelbox.doubles.colorFactorX = atof2(str2);
606 		else if (!strcmp(str1, "mandelbox_color_Y"))
607 			params->fractal.mandelbox.doubles.colorFactorY = atof2(str2);
608 		else if (!strcmp(str1, "mandelbox_color_Z"))
609 			params->fractal.mandelbox.doubles.colorFactorZ = atof2(str2);
610 		else if (!strcmp(str1, "mandelbox_color_Sp1"))
611 			params->fractal.mandelbox.doubles.colorFactorSp1 = atof2(str2);
612 		else if (!strcmp(str1, "mandelbox_color_Sp2"))
613 			params->fractal.mandelbox.doubles.colorFactorSp2 = atof2(str2);
614 		else if (!strcmp(str1, "mandelbox_rotation_enabled"))
615 			params->fractal.mandelbox.rotationsEnabled = atoi(str2);
616 		else if (!strcmp(str1, "mandelbox_fold_mode"))
617 			params->fractal.genFoldBox.type = enumGeneralizedFoldBoxType(atoi(str2));
618 		else if (!strcmp(str1, "mandelbox_solid"))
619 			params->fractal.mandelbox.doubles.solid = atof2(str2);
620 		else if (!strcmp(str1, "mandelbox_melt"))
621 			params->fractal.mandelbox.doubles.melt = atof2(str2);
622 		else if (!strcmp(str1, "mandelbox_vary_scale_vary"))
623 			params->fractal.mandelbox.doubles.vary4D.scaleVary = atof2(str2);
624 		else if (!strcmp(str1, "mandelbox_vary_fold"))
625 			params->fractal.mandelbox.doubles.vary4D.fold = atof2(str2);
626 		else if (!strcmp(str1, "mandelbox_vary_minr"))
627 			params->fractal.mandelbox.doubles.vary4D.minR = atof2(str2);
628 		else if (!strcmp(str1, "mandelbox_vary_rpower"))
629 			params->fractal.mandelbox.doubles.vary4D.rPower = atof2(str2);
630 		else if (!strcmp(str1, "mandelbox_vary_wadd"))
631 			params->fractal.mandelbox.doubles.vary4D.wadd = atof2(str2);
632 		else
633 		{
634 			int matched = false;
635 			char buf[100];
636 			for (int component = 0; component < 3; ++component)
637 			{
638 				sprintf(buf, "mandelbox_rotation_main_%s", component_names[component]);
639 				if (!strcmp(str1, buf))
640 				{
641 					params->fractal.mandelbox.doubles.rotationMain[component] = atof2(str2) / 180.0 * M_PI;
642 					matched = true;
643 					break;
644 				}
645 			}
646 
647 			for (int fold = 0; fold < MANDELBOX_FOLDS; ++fold)
648 			{
649 				for (int axis = 0; axis < 3; ++axis)
650 				{
651 					for (int component = 0; component < 3; ++component)
652 					{
653 						sprintf(buf, "mandelbox_rotation_%s%d_%s", axis_names[axis], fold + 1,
654 							component_names[component]);
655 						if (!strcmp(str1, buf))
656 						{
657 							params->fractal.mandelbox.doubles.rotation[fold][axis][component] =
658 								atof2(str2) / 180.0 * M_PI;
659 							matched = true;
660 							break;
661 						}
662 					}
663 					if (matched) break;
664 				}
665 				if (matched) break;
666 			}
667 		}
668 	}
669 	else if (!strcmp(str1, "view_distance_max"))
670 		params->doubles.viewDistanceMax = atof2(str2);
671 	else if (!strcmp(str1, "view_distance_min"))
672 		params->doubles.viewDistanceMin = atof2(str2);
673 	else if (!strcmp(str1, "interior_mode"))
674 		params->fractal.interiorMode = atoi(str2);
675 	else if (!strcmp(str1, "linear_DE_mode"))
676 		params->fractal.linearDEmode = atoi(str2);
677 	else if (!strcmp(str1, "constant_DE_threshold"))
678 		params->fractal.constantDEThreshold = atoi(str2);
679 	else if (!strcmp(str1, "FoldingIntPow_folding_factor"))
680 		params->fractal.doubles.FoldingIntPowFoldFactor = atof2(str2);
681 	else if (!strcmp(str1, "FoldingIntPow_z_factor"))
682 		params->fractal.doubles.FoldingIntPowZfactor = atof2(str2);
683 	else if (!strcmp(str1, "penetrating_lights"))
684 		params->penetratingLights = atoi(str2);
685 	else if (!strcmp(str1, "raytraced_reflections"))
686 		params->imageSwitches.raytracedReflections = atoi(str2);
687 	else if (!strcmp(str1, "reflections_max"))
688 		params->reflectionsMax = atoi(str2);
689 	else if (!strcmp(str1, "c_add"))
690 		params->fractal.doubles.cadd = atof2(str2);
691 	else if (!strcmp(str1, "volumetric_fog_density"))
692 		params->doubles.fogDensity = atof2(str2);
693 	else if (!strcmp(str1, "volumetric_fog_colour_1_distance"))
694 		params->doubles.fogColour1Distance = atof2(str2);
695 	else if (!strcmp(str1, "volumetric_fog_colour_2_distance"))
696 		params->doubles.fogColour2Distance = atof2(str2);
697 	else if (!strcmp(str1, "volumetric_fog_distance_factor"))
698 		params->doubles.fogDistanceFactor = atof2(str2);
699 	else if (!strcmp(str1, "iteration_fog_enable"))
700 		params->imageSwitches.iterFogEnabled = atoi(str2);
701 	else if (!strcmp(str1, "iteration_fog_opacity"))
702 		params->doubles.iterFogOpacity = atof2(str2);
703 	else if (!strcmp(str1, "iteration_fog_opacity_trim"))
704 		params->doubles.iterFogOpacityTrim = atof2(str2);
705 	else if (!strcmp(str1, "primitive_only_plane"))
706 		params->fractal.primitives.onlyPlane = atoi(str2);
707 	else if (QString(str1).startsWith("primitive_plane_"))
708 	{
709 		if (!strcmp(str1, "primitive_plane_enabled"))
710 			params->fractal.primitives.planeEnable = atoi(str2);
711 		else if (!strcmp(str1, "primitive_plane_centre_X"))
712 			params->fractal.doubles.primitives.planeCentre.x = atof2(str2);
713 		else if (!strcmp(str1, "primitive_plane_centre_Y"))
714 			params->fractal.doubles.primitives.planeCentre.y = atof2(str2);
715 		else if (!strcmp(str1, "primitive_plane_centre_Z"))
716 			params->fractal.doubles.primitives.planeCentre.z = atof2(str2);
717 		else if (!strcmp(str1, "primitive_plane_normal_X"))
718 			params->fractal.doubles.primitives.planeNormal.x = atof2(str2);
719 		else if (!strcmp(str1, "primitive_plane_normal_Y"))
720 			params->fractal.doubles.primitives.planeNormal.y = atof2(str2);
721 		else if (!strcmp(str1, "primitive_plane_normal_Z"))
722 			params->fractal.doubles.primitives.planeNormal.z = atof2(str2);
723 		else if (!strcmp(str1, "primitive_plane_colour_R"))
724 			params->primitivePlaneColour.R = atoi(str2);
725 		else if (!strcmp(str1, "primitive_plane_colour_G"))
726 			params->primitivePlaneColour.G = atoi(str2);
727 		else if (!strcmp(str1, "primitive_plane_colour_B"))
728 			params->primitivePlaneColour.B = atoi(str2);
729 		else if (!strcmp(str1, "primitive_plane_reflect"))
730 			params->doubles.primitivePlaneReflect = atof2(str2);
731 	}
732 	else if (QString(str1).startsWith("primitive_box_"))
733 	{
734 		if (!strcmp(str1, "primitive_box_enabled"))
735 			params->fractal.primitives.boxEnable = atoi(str2);
736 		else if (!strcmp(str1, "primitive_box_centre_X"))
737 			params->fractal.doubles.primitives.boxCentre.x = atof2(str2);
738 		else if (!strcmp(str1, "primitive_box_centre_Y"))
739 			params->fractal.doubles.primitives.boxCentre.y = atof2(str2);
740 		else if (!strcmp(str1, "primitive_box_centre_Z"))
741 			params->fractal.doubles.primitives.boxCentre.z = atof2(str2);
742 		else if (!strcmp(str1, "primitive_box_size_X"))
743 			params->fractal.doubles.primitives.boxSize.x = atof2(str2);
744 		else if (!strcmp(str1, "primitive_box_size_Y"))
745 			params->fractal.doubles.primitives.boxSize.y = atof2(str2);
746 		else if (!strcmp(str1, "primitive_box_size_Z"))
747 			params->fractal.doubles.primitives.boxSize.z = atof2(str2);
748 		else if (!strcmp(str1, "primitive_box_colour_R"))
749 			params->primitiveBoxColour.R = atoi(str2);
750 		else if (!strcmp(str1, "primitive_box_colour_G"))
751 			params->primitiveBoxColour.G = atoi(str2);
752 		else if (!strcmp(str1, "primitive_box_colour_B"))
753 			params->primitiveBoxColour.B = atoi(str2);
754 		else if (!strcmp(str1, "primitive_box_reflect"))
755 			params->doubles.primitiveBoxReflect = atof2(str2);
756 	}
757 	else if (QString(str1).startsWith("primitive_invertedBox_"))
758 	{
759 		if (!strcmp(str1, "primitive_invertedBox_enabled"))
760 			params->fractal.primitives.invertedBoxEnable = atoi(str2);
761 		else if (!strcmp(str1, "primitive_invertedBox_centre_X"))
762 			params->fractal.doubles.primitives.invertedBoxCentre.x = atof2(str2);
763 		else if (!strcmp(str1, "primitive_invertedBox_centre_Y"))
764 			params->fractal.doubles.primitives.invertedBoxCentre.y = atof2(str2);
765 		else if (!strcmp(str1, "primitive_invertedBox_centre_Z"))
766 			params->fractal.doubles.primitives.invertedBoxCentre.z = atof2(str2);
767 		else if (!strcmp(str1, "primitive_invertedBox_size_X"))
768 			params->fractal.doubles.primitives.invertedBoxSize.x = atof2(str2);
769 		else if (!strcmp(str1, "primitive_invertedBox_size_Y"))
770 			params->fractal.doubles.primitives.invertedBoxSize.y = atof2(str2);
771 		else if (!strcmp(str1, "primitive_invertedBox_size_Z"))
772 			params->fractal.doubles.primitives.invertedBoxSize.z = atof2(str2);
773 		else if (!strcmp(str1, "primitive_invertedBox_colour_R"))
774 			params->primitiveInvertedBoxColour.R = atoi(str2);
775 		else if (!strcmp(str1, "primitive_invertedBox_colour_G"))
776 			params->primitiveInvertedBoxColour.G = atoi(str2);
777 		else if (!strcmp(str1, "primitive_invertedBox_colour_B"))
778 			params->primitiveInvertedBoxColour.B = atoi(str2);
779 		else if (!strcmp(str1, "primitive_invertedBox_reflect"))
780 			params->doubles.primitiveInvertedBoxReflect = atof2(str2);
781 	}
782 	else if (QString(str1).startsWith("primitive_sphere_"))
783 	{
784 		if (!strcmp(str1, "primitive_sphere_enabled"))
785 			params->fractal.primitives.sphereEnable = atoi(str2);
786 		else if (!strcmp(str1, "primitive_sphere_centre_X"))
787 			params->fractal.doubles.primitives.sphereCentre.x = atof2(str2);
788 		else if (!strcmp(str1, "primitive_sphere_centre_Y"))
789 			params->fractal.doubles.primitives.sphereCentre.y = atof2(str2);
790 		else if (!strcmp(str1, "primitive_sphere_centre_Z"))
791 			params->fractal.doubles.primitives.sphereCentre.z = atof2(str2);
792 		else if (!strcmp(str1, "primitive_sphere_radius"))
793 			params->fractal.doubles.primitives.sphereRadius = atof2(str2);
794 		else if (!strcmp(str1, "primitive_sphere_colour_R"))
795 			params->primitiveSphereColour.R = atoi(str2);
796 		else if (!strcmp(str1, "primitive_sphere_colour_G"))
797 			params->primitiveSphereColour.G = atoi(str2);
798 		else if (!strcmp(str1, "primitive_sphere_colour_B"))
799 			params->primitiveSphereColour.B = atoi(str2);
800 		else if (!strcmp(str1, "primitive_sphere_reflect"))
801 			params->doubles.primitiveSphereReflect = atof2(str2);
802 	}
803 	else if (QString(str1).startsWith("primitive_invertedSphere_"))
804 	{
805 		if (!strcmp(str1, "primitive_invertedSphere_enabled"))
806 			params->fractal.primitives.invertedSphereEnable = atoi(str2);
807 		else if (!strcmp(str1, "primitive_invertedSphere_centre_X"))
808 			params->fractal.doubles.primitives.invertedSphereCentre.x = atof2(str2);
809 		else if (!strcmp(str1, "primitive_invertedSphere_centre_Y"))
810 			params->fractal.doubles.primitives.invertedSphereCentre.y = atof2(str2);
811 		else if (!strcmp(str1, "primitive_invertedSphere_centre_Z"))
812 			params->fractal.doubles.primitives.invertedSphereCentre.z = atof2(str2);
813 		else if (!strcmp(str1, "primitive_invertedSphere_radius"))
814 			params->fractal.doubles.primitives.invertedSphereRadius = atof2(str2);
815 		else if (!strcmp(str1, "primitive_invertedSphere_colour_R"))
816 			params->primitiveInvertedSphereColour.R = atoi(str2);
817 		else if (!strcmp(str1, "primitive_invertedSphere_colour_G"))
818 			params->primitiveInvertedSphereColour.G = atoi(str2);
819 		else if (!strcmp(str1, "primitive_invertedSphere_colour_B"))
820 			params->primitiveInvertedSphereColour.B = atoi(str2);
821 		else if (!strcmp(str1, "primitive_invertedSphere_reflect"))
822 			params->doubles.primitiveInvertedSphereReflect = atof2(str2);
823 	}
824 	else if (QString(str1).startsWith("primitive_water_"))
825 	{
826 		if (!strcmp(str1, "primitive_water_enabled"))
827 			params->fractal.primitives.waterEnable = atoi(str2);
828 		else if (!strcmp(str1, "primitive_water_level"))
829 			params->fractal.doubles.primitives.waterHeight = atof2(str2);
830 		else if (!strcmp(str1, "primitive_water_amplitude"))
831 			params->fractal.doubles.primitives.waterAmplitude = atof2(str2);
832 		else if (!strcmp(str1, "primitive_water_length"))
833 			params->fractal.doubles.primitives.waterLength = atof2(str2);
834 		else if (!strcmp(str1, "primitive_water_iterations"))
835 			params->fractal.primitives.waterIterations = atoi(str2);
836 		else if (!strcmp(str1, "primitive_water_rotation"))
837 			params->fractal.doubles.primitives.waterRotation = atof2(str2);
838 		else if (!strcmp(str1, "primitive_water_anim_speed"))
839 			params->fractal.doubles.primitives.waterAnimSpeed = atof2(str2);
840 		else if (!strcmp(str1, "primitive_water_colour_R"))
841 			params->primitiveWaterColour.R = atoi(str2);
842 		else if (!strcmp(str1, "primitive_water_colour_G"))
843 			params->primitiveWaterColour.G = atoi(str2);
844 		else if (!strcmp(str1, "primitive_water_colour_B"))
845 			params->primitiveWaterColour.B = atoi(str2);
846 		else if (!strcmp(str1, "primitive_water_reflect"))
847 			params->doubles.primitiveWaterReflect = atof2(str2);
848 	}
849 	else if (QString(str1).startsWith("fake_lights_"))
850 	{
851 		if (!strcmp(str1, "fake_lights_enabled"))
852 			params->fakeLightsEnabled = atoi(str2);
853 		else if (!strcmp(str1, "fake_lights_min_iter"))
854 			params->fractal.fakeLightsMinIter = atoi(str2);
855 		else if (!strcmp(str1, "fake_lights_max_iter"))
856 			params->fractal.fakeLightsMaxIter = atoi(str2);
857 		else if (!strcmp(str1, "fake_lights_visibility"))
858 			params->doubles.fakeLightsVisibility = atof2(str2);
859 		else if (!strcmp(str1, "fake_lights_visibility_size"))
860 			params->doubles.fakeLightsVisibilitySize = atof2(str2);
861 		else if (!strcmp(str1, "fake_lights_intensity"))
862 			params->doubles.fakeLightsIntensity = atof2(str2);
863 		else if (!strcmp(str1, "fake_lights_orbit_trap_X"))
864 			params->fractal.doubles.fakeLightsOrbitTrap.x = atof2(str2);
865 		else if (!strcmp(str1, "fake_lights_orbit_trap_Y"))
866 			params->fractal.doubles.fakeLightsOrbitTrap.y = atof2(str2);
867 		else if (!strcmp(str1, "fake_lights_orbit_trap_Z"))
868 			params->fractal.doubles.fakeLightsOrbitTrap.z = atof2(str2);
869 	}
870 	else if (!strcmp(str1, "frame_no"))
871 		params->fractal.frameNo = atoi(str2);
872 	else if (!strcmp(str1, "tile_no"))
873 		params->tileCount = atoi(str2);
874 	else if (!strcmp(str1, "file_destination"))
875 		strcpy(params->file_destination, str2);
876 	else if (!strcmp(str1, "file_background"))
877 		strcpy(params->file_background, str2);
878 	else if (!strcmp(str1, "file_envmap"))
879 		strcpy(params->file_envmap, str2);
880 	else if (!strcmp(str1, "file_lightmap"))
881 		strcpy(params->file_lightmap, str2);
882 	else if (!strcmp(str1, "file_animation_path"))
883 		strcpy(params->file_path, str2);
884 	else if (!strcmp(str1, "file_keyframes"))
885 		strcpy(params->file_keyframes, str2);
886 	else if (!strcmp(str1, "palette"))
887 		GetPaletteFromString(params->palette, str2);
888 	else
889 	{
890 		int matched = false;
891 		char buf[100];
892 		for (int i = 0; i < 5; ++i)
893 		{
894 			sprintf(buf, "volumetric_light_enabled_%d", i);
895 			if (!strcmp(str1, buf))
896 			{
897 				params->volumetricLightEnabled[i] = atoi(str2);
898 				matched = true;
899 				break;
900 			}
901 			sprintf(buf, "volumetric_light_intensity_%d", i);
902 			if (!strcmp(str1, buf))
903 			{
904 				params->doubles.volumetricLightIntensity[i] = atof2(str2);
905 				matched = true;
906 				break;
907 			}
908 		}
909 
910 		for (int i = 1; i <= HYBRID_COUNT; ++i)
911 		{
912 			sprintf(buf, "hybrid_formula_%d", i);
913 			if (!strcmp(str1, buf))
914 			{
915 				params->fractal.hybridFormula[i - 1] = enumOldFractalFormula(atoi(str2));
916 				matched = true;
917 				break;
918 			}
919 			sprintf(buf, "hybrid_iterations_%d", i);
920 			if (!strcmp(str1, buf))
921 			{
922 				params->fractal.hybridIters[i - 1] = atoi(str2);
923 				matched = true;
924 				break;
925 			}
926 			sprintf(buf, "hybrid_power_%d", i);
927 			if (!strcmp(str1, buf))
928 			{
929 				params->fractal.doubles.hybridPower[i - 1] = atof2(str2);
930 				matched = true;
931 				break;
932 			}
933 		}
934 
935 		if (!matched)
936 		{
937 			printf("Warning! Unknown parameter: %s %s\n", str1, str2);
938 			WriteLog("Warning! Unknown parameter:", 1);
939 			WriteLog(str1, 1);
940 			return false;
941 		}
942 	}
943 	return true;
944 }
945 
ConvertToNewContainer(std::shared_ptr<cParameterContainer> par,std::shared_ptr<cFractalContainer> fractal) const946 void cOldSettings::ConvertToNewContainer(
947 	std::shared_ptr<cParameterContainer> par, std::shared_ptr<cFractalContainer> fractal) const
948 {
949 	// general parameters
950 	par->ResetAllToDefault();
951 	for (int i = 0; i < NUMBER_OF_FRACTALS; i++)
952 		fractal->at(i)->ResetAllToDefault();
953 	DeleteAllPrimitiveParams(par);
954 	DeleteAllMaterialParams(par);
955 	InitMaterialParams(1, par);
956 	par->Set("mat1_is_defined", true);
957 
958 	par->Set("legacy_coordinate_system", true);
959 
960 	par->Set("image_width", oldData->image_width);
961 	par->Set("image_height", oldData->image_height);
962 
963 	// conversion of camera
964 	CVector3 vp = oldData->doubles.vp;
965 	CVector3 cameraRotation(oldData->doubles.alpha, oldData->doubles.beta, oldData->doubles.gamma);
966 	CVector3 forwardVector(0.0, 1.0, 0.0);
967 	forwardVector =
968 		forwardVector.RotateAroundVectorByAngle(CVector3(0.0, 1.0, 0.0), cameraRotation.z);
969 	forwardVector =
970 		forwardVector.RotateAroundVectorByAngle(CVector3(1.0, 0.0, 0.0), cameraRotation.y);
971 	forwardVector =
972 		forwardVector.RotateAroundVectorByAngle(CVector3(0.0, 0.0, 1.0), cameraRotation.x);
973 
974 	CVector3 camera, target;
975 	if (oldData->doubles.zoom <= 1e-13) oldData->doubles.zoom = 1e-13;
976 	if (oldData->perspectiveType == threePoint)
977 	{
978 		camera = vp - forwardVector * (1.0 / oldData->doubles.persp * oldData->doubles.zoom);
979 		target = vp;
980 	}
981 	else
982 	{
983 		camera = vp;
984 		target = vp + forwardVector * (1.0 / oldData->doubles.persp * oldData->doubles.zoom);
985 	}
986 	cCameraTarget cameraTarget(camera, target, CVector3(1.0, 0.0, 0.0));
987 	cameraTarget.SetCameraTargetRotation(camera, target, cameraRotation.z);
988 
989 	par->Set("camera", camera);
990 	par->Set("target", target);
991 	par->Set("camera_top", cameraTarget.GetTopVector());
992 	par->Set("camera_rotation", cameraTarget.GetRotation() * 180.0 / M_PI);
993 	par->Set("camera_distance_to_target", cameraTarget.GetDistance());
994 	par->Set("fov", oldData->doubles.persp);
995 	par->Set("perspective_type", int(oldData->perspectiveType));
996 	par->Set("stereo_eye_distance", oldData->doubles.stereoEyeDistance);
997 	par->Set("stereo_enabled", oldData->stereoEnabled);
998 
999 	par->Set("formula", 1, int(oldData->fractal.formula));
1000 
1001 	par->Set("julia_mode", oldData->fractal.juliaMode);
1002 	par->Set("julia_c", oldData->fractal.doubles.julia);
1003 	par->Set("N", oldData->fractal.doubles.N);
1004 	par->Set("minN", oldData->fractal.minN);
1005 	par->Set("fractal_constant_factor",
1006 		CVector3(oldData->fractal.doubles.constantFactor, oldData->fractal.doubles.constantFactor,
1007 			oldData->fractal.doubles.constantFactor));
1008 	par->Set("detail_level", oldData->doubles.quality);
1009 	par->Set("DE_thresh", oldData->doubles.quality);
1010 	par->Set("smoothness", oldData->doubles.smoothness);
1011 	par->Set("iteration_threshold_mode", oldData->fractal.iterThresh);
1012 	par->Set("DE_factor", oldData->doubles.DE_factor);
1013 	par->Set("slow_shading", oldData->slowShading);
1014 	par->Set("view_distance_max", oldData->doubles.viewDistanceMax);
1015 	par->Set("view_distance_min", oldData->doubles.viewDistanceMin);
1016 	par->Set("limit_min", CVector3(oldData->fractal.doubles.amin, oldData->fractal.doubles.bmin,
1017 													oldData->fractal.doubles.cmin));
1018 	par->Set("limit_max", CVector3(oldData->fractal.doubles.amax, oldData->fractal.doubles.bmax,
1019 													oldData->fractal.doubles.cmax));
1020 	par->Set("limits_enabled", oldData->fractal.limits_enabled);
1021 	par->Set("interior_mode", oldData->fractal.interiorMode);
1022 	if (oldData->fractal.linearDEmode)
1023 		par->Set("delta_DE_function", int(fractal::linearDEFunction));
1024 	else
1025 		par->Set("delta_DE_function", int(fractal::logarithmicDEFunction));
1026 
1027 	par->Set("constant_DE_threshold", oldData->fractal.constantDEThreshold);
1028 	par->Set("hybrid_fractal_enable", false);
1029 
1030 	par->Set("brightness", oldData->doubles.imageAdjustments.brightness);
1031 	par->Set("contrast", oldData->doubles.imageAdjustments.contrast);
1032 	par->Set("gamma", oldData->doubles.imageAdjustments.imageGamma);
1033 	par->Set("hdr", oldData->imageSwitches.hdrEnabled);
1034 	par->Set("mat1_reflectance", oldData->doubles.imageAdjustments.reflect);
1035 	par->Set("ambient_occlusion", oldData->doubles.imageAdjustments.globalIlum);
1036 	par->Set("ambient_occlusion_quality", oldData->globalIlumQuality);
1037 	par->Set("ambient_occlusion_fast_tune", oldData->doubles.fastAoTune);
1038 	par->Set("ambient_occlusion_enabled", oldData->global_ilumination || oldData->SSAOEnabled);
1039 
1040 	params::enumAOMode AOMode = params::AOModeMultipleRays;
1041 	if (oldData->SSAOEnabled) AOMode = params::AOModeScreenSpace;
1042 	if (oldData->fastGlobalIllumination && !oldData->SSAOEnabled) AOMode = params::AOModeFast;
1043 	par->Set("ambient_occlusion_mode", int(AOMode));
1044 	if (AOMode == params::AOModeScreenSpace)
1045 		par->Set("ambient_occlusion_quality", sqrt(oldData->SSAOQuality));
1046 
1047 	par->Set("mat1_shading", oldData->doubles.imageAdjustments.shading);
1048 	par->Set("mat1_specular", oldData->doubles.imageAdjustments.specular);
1049 	par->Set("glow_enabled", (oldData->doubles.imageAdjustments.glow_intensity > 0.0) ? true : false);
1050 	par->Set("glow_intensity", oldData->doubles.imageAdjustments.glow_intensity);
1051 	par->Set("textured_background", oldData->texturedBackground);
1052 	par->Set("textured_background_map_type", oldData->background_as_fulldome);
1053 	par->Set("shadows_enabled", oldData->shadow);
1054 	par->Set("penetrating_lights", oldData->penetratingLights);
1055 	par->Set("raytraced_reflections", oldData->imageSwitches.raytracedReflections);
1056 	par->Set("reflections_max", oldData->reflectionsMax);
1057 	par->Set("env_mapping_enable", (oldData->doubles.imageAdjustments.reflect > 0.0
1058 																	 && !oldData->imageSwitches.raytracedReflections)
1059 																	 ? true
1060 																	 : false);
1061 
1062 	par->Set("glow_color", 1, oldData->effectColours.glow_color1);
1063 	par->Set("glow_color", 2, oldData->effectColours.glow_color2);
1064 	par->Set("background_color", 1, oldData->background_color1);
1065 	par->Set("background_color", 2, oldData->background_color2);
1066 	par->Set("background_color", 3, oldData->background_color3);
1067 	par->Set("fog_color", 1, oldData->fogColour1);
1068 	par->Set("fog_color", 2, oldData->fogColour2);
1069 	par->Set("fog_color", 3, oldData->fogColour3);
1070 
1071 	par->Set("volumetric_fog_enabled", (oldData->doubles.fogDensity > 0.0) ? true : false);
1072 	par->Set("volumetric_fog_density", oldData->doubles.fogDensity);
1073 	par->Set("volumetric_fog_colour_1_distance", oldData->doubles.fogColour1Distance);
1074 	par->Set("volumetric_fog_colour_2_distance", oldData->doubles.fogColour2Distance);
1075 	par->Set("volumetric_fog_distance_factor", oldData->doubles.fogDistanceFactor);
1076 
1077 	par->Set("iteration_fog_enable", oldData->imageSwitches.iterFogEnabled);
1078 	par->Set("iteration_fog_opacity", oldData->doubles.iterFogOpacity);
1079 	par->Set("iteration_fog_opacity_trim", oldData->doubles.iterFogOpacityTrim);
1080 	par->Set("iteration_fog_color_1_maxiter", int(oldData->fractal.doubles.N * 0.33));
1081 	par->Set("iteration_fog_color_2_maxiter", int(oldData->fractal.doubles.N * 0.66));
1082 	par->Set("iteration_fog_color", 1, oldData->fogColour1);
1083 	par->Set("iteration_fog_color", 2, oldData->fogColour2);
1084 	par->Set("iteration_fog_color", 3, oldData->fogColour3);
1085 
1086 	par->Set("mat1_use_colors_from_palette", oldData->imageSwitches.coloringEnabled);
1087 	par->Set("mat1_coloring_random_seed", oldData->coloring_seed);
1088 	par->Set("mat1_coloring_saturation", oldData->doubles.colourSaturation);
1089 	par->Set("mat1_coloring_speed", oldData->doubles.imageAdjustments.coloring_speed);
1090 	par->Set("mat1_coloring_palette_size", 256);
1091 	par->Set("mat1_coloring_palette_offset", oldData->doubles.imageAdjustments.paletteOffset);
1092 	par->Set("basic_fog_enabled", oldData->imageSwitches.fogEnabled);
1093 	par->Set("basic_fog_color", oldData->effectColours.fogColor);
1094 	par->Set(
1095 		"basic_fog_visibility", pow(10.0, oldData->doubles.imageAdjustments.fogVisibility / 10 - 16.0));
1096 	par->Set("DOF_enabled", oldData->DOFEnabled);
1097 	par->Set("DOF_focus", pow(10, oldData->doubles.DOFFocus / 10.0 - 16.0));
1098 	par->Set("DOF_radius", oldData->doubles.DOFRadius);
1099 
1100 	par->Set("main_light_intensity", oldData->doubles.imageAdjustments.directLight
1101 																		 * oldData->doubles.imageAdjustments.mainLightIntensity);
1102 	par->Set("main_light_alpha", oldData->doubles.mainLightAlpha * 180.0 / M_PI);
1103 	par->Set("main_light_beta", -oldData->doubles.mainLightBeta * 180.0 / M_PI);
1104 	par->Set("main_light_colour", oldData->effectColours.mainLightColour);
1105 	par->Set("shadows_cone_angle", oldData->doubles.shadowConeAngle);
1106 	par->Set("main_light_enable",
1107 		(oldData->doubles.imageAdjustments.mainLightIntensity > 0.0) ? true : false);
1108 	par->Set("main_light_volumetric_intensity", oldData->doubles.volumetricLightIntensity[0]);
1109 	par->Set("main_light_volumetric_enabled", oldData->volumetricLightEnabled[0]);
1110 
1111 	par->Set("aux_light_intensity", oldData->doubles.auxLightIntensity);
1112 	par->Set("aux_light_visibility", oldData->doubles.auxLightVisibility);
1113 
1114 	for (int i = 0; i < 4; i++)
1115 	{
1116 		par->Set("aux_light_position", i + 1, oldData->doubles.auxLightPre[i]);
1117 		par->Set("aux_light_intensity", i + 1, oldData->doubles.auxLightPreIntensity[i]);
1118 		par->Set("aux_light_enabled", i + 1, oldData->auxLightPreEnabled[i]);
1119 		par->Set("aux_light_colour", i + 1, oldData->auxLightPreColour[i]);
1120 		par->Set(
1121 			"aux_light_volumetric_intensity", i + 1, oldData->doubles.volumetricLightIntensity[i + 1]);
1122 		par->Set("aux_light_volumetric_enabled", i + 1, oldData->volumetricLightEnabled[i + 1]);
1123 	}
1124 
1125 	par->Set("random_lights_random_seed", oldData->auxLightRandomSeed);
1126 	par->Set("random_lights_max_distance_from_fractal", oldData->doubles.auxLightMaxDist);
1127 	par->Set("random_lights_intensity", oldData->doubles.auxLightIntensity);
1128 	par->Set("random_lights_distribution_radius", oldData->doubles.auxLightDistributionRadius);
1129 	par->Set("random_lights_distribution_center", oldData->doubles.auxLightRandomCenter);
1130 	par->Set("random_lights_number", oldData->auxLightNumber > 4 ? (oldData->auxLightNumber - 4) : 0);
1131 	par->Set("random_lights_group", oldData->auxLightNumber > 4);
1132 
1133 	par->Set("fake_lights_enabled", oldData->fakeLightsEnabled);
1134 	par->Set("fake_lights_intensity", oldData->doubles.fakeLightsIntensity);
1135 	par->Set("fake_lights_visibility", oldData->doubles.fakeLightsVisibility);
1136 	par->Set("fake_lights_visibility_size", oldData->doubles.fakeLightsVisibilitySize);
1137 	par->Set("fake_lights_orbit_trap", oldData->fractal.doubles.fakeLightsOrbitTrap);
1138 	par->Set("fake_lights_min_iter", oldData->fractal.fakeLightsMinIter);
1139 	par->Set("fake_lights_max_iter", oldData->fractal.fakeLightsMaxIter);
1140 
1141 	int numberOfColors = sizeof(oldData->palette) / sizeof(oldData->palette[0]);
1142 	double step = 1.0 / numberOfColors;
1143 
1144 	cColorGradient newGradient;
1145 	newGradient.DeleteAll();
1146 	for (int i = 0; i < numberOfColors; i++)
1147 	{
1148 		double pos = double(i) * step;
1149 		newGradient.AddColor(oldData->palette[i], pos);
1150 		if (i == 0) newGradient.AddColor(oldData->palette[i], 1.0);
1151 	}
1152 	QString newPalette = newGradient.GetColorsAsString();
1153 	par->Set("mat1_surface_color_gradient", newPalette);
1154 
1155 	if (oldData->fractal.primitives.boxEnable)
1156 	{
1157 		InitPrimitiveParams(fractal::objBox, "primitive_box_1", par);
1158 		par->Set("primitive_box_1_position", oldData->fractal.doubles.primitives.boxCentre);
1159 		par->Set("primitive_box_1_color", oldData->primitiveBoxColour);
1160 		par->Set("primitive_box_1_reflection", oldData->doubles.primitiveBoxReflect);
1161 		par->Set("primitive_box_1_enabled", oldData->fractal.primitives.boxEnable);
1162 		par->Set("primitive_box_1_size", oldData->fractal.doubles.primitives.boxSize);
1163 	}
1164 
1165 	if (oldData->fractal.primitives.invertedBoxEnable)
1166 	{
1167 		InitPrimitiveParams(fractal::objBox, "primitive_box_2", par);
1168 		par->Set("primitive_box_2_position", oldData->fractal.doubles.primitives.invertedBoxCentre);
1169 		par->Set("primitive_box_2_color", oldData->primitiveInvertedBoxColour);
1170 		par->Set("primitive_box_2_reflection", oldData->doubles.primitiveInvertedBoxReflect);
1171 		par->Set("primitive_box_2_enabled", oldData->fractal.primitives.invertedBoxEnable);
1172 		par->Set("primitive_box_2_size", oldData->fractal.doubles.primitives.invertedBoxSize);
1173 		par->Set("primitive_box_2_empty", true);
1174 	}
1175 
1176 	if (oldData->fractal.primitives.sphereEnable)
1177 	{
1178 		InitPrimitiveParams(fractal::objSphere, "primitive_sphere_1", par);
1179 		par->Set("primitive_sphere_1_position", oldData->fractal.doubles.primitives.sphereCentre);
1180 		par->Set("primitive_sphere_1_color", oldData->primitiveSphereColour);
1181 		par->Set("primitive_sphere_1_reflection", oldData->doubles.primitiveSphereReflect);
1182 		par->Set("primitive_sphere_1_enabled", oldData->fractal.primitives.sphereEnable);
1183 		par->Set("primitive_sphere_1_radius", oldData->fractal.doubles.primitives.sphereRadius);
1184 	}
1185 
1186 	if (oldData->fractal.primitives.invertedSphereEnable)
1187 	{
1188 		InitPrimitiveParams(fractal::objSphere, "primitive_sphere_2", par);
1189 		par->Set(
1190 			"primitive_sphere_2_position", oldData->fractal.doubles.primitives.invertedSphereCentre);
1191 		par->Set("primitive_sphere_2_color", oldData->primitiveInvertedSphereColour);
1192 		par->Set("primitive_sphere_2_reflection", oldData->doubles.primitiveInvertedSphereReflect);
1193 		par->Set("primitive_sphere_2_enabled", oldData->fractal.primitives.invertedSphereEnable);
1194 		par->Set("primitive_sphere_2_radius", oldData->fractal.doubles.primitives.invertedSphereRadius);
1195 		par->Set("primitive_sphere_2_empty", true);
1196 	}
1197 
1198 	if (oldData->fractal.primitives.planeEnable)
1199 	{
1200 		InitPrimitiveParams(fractal::objPlane, "primitive_plane_1", par);
1201 		par->Set("primitive_plane_1_position", oldData->fractal.doubles.primitives.planeCentre);
1202 		par->Set("primitive_plane_1_color", oldData->primitivePlaneColour);
1203 		par->Set("primitive_plane_1_reflection", oldData->doubles.primitivePlaneReflect);
1204 		par->Set("primitive_plane_1_enabled", oldData->fractal.primitives.planeEnable);
1205 		CVector3 rotation;
1206 		CVector3 normal = oldData->fractal.doubles.primitives.planeNormal;
1207 		rotation.x = atan2(normal.y, normal.z) * 180.0 / M_PI;
1208 		rotation.y = -atan2(normal.x, sqrt(normal.y * normal.y + normal.z * normal.z)) * 180.0 / M_PI;
1209 		rotation.z = 0;
1210 		par->Set("primitive_plane_1_rotation", rotation);
1211 	}
1212 
1213 	if (oldData->fractal.primitives.waterEnable)
1214 	{
1215 		InitPrimitiveParams(fractal::objWater, "primitive_water_1", par);
1216 		par->Set("primitive_water_1_position",
1217 			CVector3(0, 0, oldData->fractal.doubles.primitives.waterHeight));
1218 		par->Set("primitive_water_1_color", oldData->primitiveWaterColour);
1219 		par->Set("primitive_water_1_reflection", oldData->doubles.primitiveWaterReflect);
1220 		par->Set("primitive_water_1_enabled", oldData->fractal.primitives.waterEnable);
1221 		par->Set(
1222 			"primitive_water_1_relative_amplitude", oldData->fractal.doubles.primitives.waterAmplitude
1223 																								/ oldData->fractal.doubles.primitives.waterLength);
1224 		par->Set("primitive_water_1_length", oldData->fractal.doubles.primitives.waterLength);
1225 		par->Set("primitive_water_1_iterations", oldData->fractal.primitives.waterIterations);
1226 		par->Set("primitive_water_1_rotation",
1227 			CVector3(180.0, 0, -oldData->fractal.doubles.primitives.waterRotation));
1228 	}
1229 
1230 	// foldings
1231 	par->Set("box_folding", oldData->fractal.tgladFoldingMode);
1232 	par->Set("box_folding_limit", oldData->fractal.doubles.foldingLimit);
1233 	par->Set("box_folding_value", oldData->fractal.doubles.foldingValue);
1234 	par->Set("spherical_folding", oldData->fractal.sphericalFoldingMode);
1235 	par->Set("spherical_folding_outer", oldData->fractal.doubles.foldingSphericalFixed);
1236 	par->Set("spherical_folding_inner", oldData->fractal.doubles.foldingSphericalMin);
1237 
1238 	// fractal parameters
1239 
1240 	if (oldData->fractal.formula == trig_DE)
1241 	{
1242 		par->Set("formula", 1, int(fractal::mandelbulb));
1243 		fractal->at(0)->Set("alpha_angle_offset", 180.0 / oldData->fractal.doubles.power);
1244 		fractal->at(0)->Set("beta_angle_offset", 180.0 / oldData->fractal.doubles.power);
1245 	}
1246 
1247 	fractal->at(0)->Set("power", oldData->fractal.doubles.power);
1248 	fractal->at(0)->Set("cadd", oldData->fractal.doubles.cadd);
1249 	fractal->at(0)->Set("IFS_scale", oldData->fractal.IFS.doubles.scale);
1250 	fractal->at(0)->Set("IFS_rotation",
1251 		CVector3(oldData->fractal.IFS.doubles.rotationAlfa, oldData->fractal.IFS.doubles.rotationBeta,
1252 			oldData->fractal.IFS.doubles.rotationGamma)
1253 			* 180.0 / M_PI);
1254 	fractal->at(0)->Set("IFS_offset", oldData->fractal.IFS.doubles.offset);
1255 	fractal->at(0)->Set("IFS_edge", oldData->fractal.IFS.doubles.edge);
1256 	fractal->at(0)->Set(
1257 		"IFS_edge_enabled", (oldData->fractal.IFS.doubles.edge.Length() > 0) ? true : false);
1258 	fractal->at(0)->Set("IFS_abs_x", oldData->fractal.IFS.absX);
1259 	fractal->at(0)->Set("IFS_abs_y", oldData->fractal.IFS.absY);
1260 	fractal->at(0)->Set("IFS_abs_z", oldData->fractal.IFS.absZ);
1261 	fractal->at(0)->Set("IFS_menger_sponge_mode", oldData->fractal.IFS.mengerSpongeMode);
1262 
1263 	for (int i = 0; i < IFS_VECTOR_COUNT; i++)
1264 	{
1265 		fractal->at(0)->Set("IFS_direction", i, oldData->fractal.IFS.doubles.direction[i]);
1266 		fractal->at(0)->Set("IFS_rotations", i,
1267 			CVector3(oldData->fractal.IFS.doubles.alfa[i], oldData->fractal.IFS.doubles.beta[i],
1268 				oldData->fractal.IFS.doubles.gamma[i])
1269 				* 180.0 / M_PI);
1270 		fractal->at(0)->Set("IFS_distance", i, oldData->fractal.IFS.doubles.distance[i]);
1271 		fractal->at(0)->Set("IFS_intensity", i, oldData->fractal.IFS.doubles.intensity[i]);
1272 		fractal->at(0)->Set("IFS_enabled", i, oldData->fractal.IFS.enabled[i]);
1273 	}
1274 
1275 	fractal->at(0)->Set("mandelbox_scale", oldData->fractal.mandelbox.doubles.scale);
1276 	fractal->at(0)->Set("mandelbox_folding_limit", oldData->fractal.mandelbox.doubles.foldingLimit);
1277 	fractal->at(0)->Set("mandelbox_folding_value", oldData->fractal.mandelbox.doubles.foldingValue);
1278 	fractal->at(0)->Set(
1279 		"mandelbox_folding_min_radius", oldData->fractal.mandelbox.doubles.foldingSphericalMin);
1280 	fractal->at(0)->Set(
1281 		"mandelbox_folding_fixed_radius", oldData->fractal.mandelbox.doubles.foldingSphericalFixed);
1282 	fractal->at(0)->Set("mandelbox_sharpness", oldData->fractal.mandelbox.doubles.sharpness);
1283 	fractal->at(0)->Set("mandelbox_offset", oldData->fractal.mandelbox.doubles.offset);
1284 	fractal->at(0)->Set("mandelbox_rotation_main",
1285 		CVector3(oldData->fractal.mandelbox.doubles.rotationMain) * 180.0 / M_PI);
1286 
1287 	for (int i = 0; i < 3; i++)
1288 	{
1289 		fractal->at(0)->Set("mandelbox_rotation_neg", i + 1,
1290 			CVector3(oldData->fractal.mandelbox.doubles.rotation[0][i]) * 180.0 / M_PI);
1291 		fractal->at(0)->Set("mandelbox_rotation_pos", i + 1,
1292 			CVector3(oldData->fractal.mandelbox.doubles.rotation[1][i]) * 180.0 / M_PI);
1293 	}
1294 
1295 	fractal->at(0)->Set("mandelbox_color", CVector3(oldData->fractal.mandelbox.doubles.colorFactorX,
1296 																					 oldData->fractal.mandelbox.doubles.colorFactorY,
1297 																					 oldData->fractal.mandelbox.doubles.colorFactorZ));
1298 	fractal->at(0)->Set("mandelbox_color_R", oldData->fractal.mandelbox.doubles.colorFactorR);
1299 	fractal->at(0)->Set("mandelbox_color_Sp1", oldData->fractal.mandelbox.doubles.colorFactorSp1);
1300 	fractal->at(0)->Set("mandelbox_color_Sp2", oldData->fractal.mandelbox.doubles.colorFactorSp2);
1301 	fractal->at(0)->Set("mandelbox_rotations_enabled", oldData->fractal.mandelbox.rotationsEnabled);
1302 	fractal->at(0)->Set("mandelbox_main_rotation_enabled",
1303 		(CVector3(oldData->fractal.mandelbox.doubles.rotationMain).Length() > 0) ? true : false);
1304 	fractal->at(0)->Set("mandelbox_solid", oldData->fractal.mandelbox.doubles.solid);
1305 	fractal->at(0)->Set("mandelbox_melt", oldData->fractal.mandelbox.doubles.melt);
1306 
1307 	fractal->at(0)->Set(
1308 		"mandelbox_vary_scale_vary", oldData->fractal.mandelbox.doubles.vary4D.scaleVary);
1309 	fractal->at(0)->Set("mandelbox_vary_fold", oldData->fractal.mandelbox.doubles.vary4D.fold);
1310 	fractal->at(0)->Set("mandelbox_vary_minr", oldData->fractal.mandelbox.doubles.vary4D.minR);
1311 	fractal->at(0)->Set("mandelbox_vary_rpower", oldData->fractal.mandelbox.doubles.vary4D.rPower);
1312 	fractal->at(0)->Set("mandelbox_vary_wadd", oldData->fractal.mandelbox.doubles.vary4D.wadd);
1313 
1314 	fractal->at(0)->Set("mandelbox_generalized_fold_type", int(oldData->fractal.genFoldBox.type));
1315 
1316 	fractal->at(0)->Set(
1317 		"boxfold_bulbpow2_folding_factor", oldData->fractal.doubles.FoldingIntPowFoldFactor);
1318 	fractal->at(0)->Set("boxfold_bulbpow2_z_factor", oldData->fractal.doubles.FoldingIntPowZfactor);
1319 
1320 	for (int i = 0; i < 4; i++)
1321 	{
1322 		fractal->at(i)->Set("IFS_rotation_enabled", true);
1323 	}
1324 
1325 	fractal->at(1) = fractal->at(2) = fractal->at(3) = fractal->at(0);
1326 
1327 	// converting hybrid fractals
1328 
1329 	if (oldData->fractal.formula == hybrid)
1330 	{
1331 		QList<int> fractalsListTemp;
1332 		for (int i = 0; i < HYBRID_COUNT; i++)
1333 		{
1334 			if (oldData->fractal.hybridFormula[i] != oldSettings::none)
1335 			{
1336 				fractalsListTemp.append(i);
1337 			}
1338 		}
1339 		bool result = true;
1340 		if (fractalsListTemp.size() <= NUMBER_OF_FRACTALS)
1341 		{
1342 			for (int i = 0; i < fractalsListTemp.size(); i++)
1343 			{
1344 				oldSettings::enumOldFractalFormula formula =
1345 					oldData->fractal.hybridFormula[fractalsListTemp.at(i)];
1346 				bool found = false;
1347 				for (const auto &fractalDescription : newFractalList)
1348 				{
1349 					if (formula == oldSettings::enumOldFractalFormula(fractalDescription->getInternalId()))
1350 					{
1351 						found = true;
1352 						break;
1353 					}
1354 				}
1355 				if (found)
1356 				{
1357 					par->Set("formula", i + 1, int(oldData->fractal.hybridFormula[fractalsListTemp.at(i)]));
1358 					if (formula == trig_DE)
1359 					{
1360 						par->Set("formula", 1, int(fractal::mandelbulb));
1361 						fractal->at(i)->Set("alpha_angle_offset", 180.0 / oldData->fractal.doubles.power);
1362 						fractal->at(i)->Set("beta_angle_offset", 180.0 / oldData->fractal.doubles.power);
1363 					}
1364 					par->Set(
1365 						"formula_iterations", i + 1, oldData->fractal.hybridIters[fractalsListTemp.at(i)]);
1366 					switch (formula)
1367 					{
1368 						case trig_DE:
1369 						case trig_optim:
1370 						case xenodreambuie:
1371 						case mandelbulb2:
1372 						case mandelbulb3:
1373 						case mandelbulb4:
1374 						case benesi:
1375 						case bristorbrot:
1376 						{
1377 							fractal->at(i)->Set(
1378 								"power", oldData->fractal.doubles.hybridPower[fractalsListTemp.at(i)]);
1379 							break;
1380 						}
1381 
1382 						case smoothMandelbox:
1383 						case mandelboxVaryScale4D:
1384 						case tglad:
1385 						{
1386 							fractal->at(i)->Set(
1387 								"mandelbox_scale", oldData->fractal.doubles.hybridPower[fractalsListTemp.at(i)]);
1388 							break;
1389 						}
1390 
1391 						default: break;
1392 					}
1393 
1394 					if (!oldData->fractal.hybridCyclic && i == fractalsListTemp.size() - 1)
1395 					{
1396 						par->Set("formula_iterations", i + 1, int(oldData->fractal.doubles.N));
1397 					}
1398 				}
1399 				else
1400 				{
1401 					result = false;
1402 					break;
1403 				}
1404 			}
1405 		}
1406 		else
1407 		{
1408 			result = false;
1409 		}
1410 
1411 		if (!result)
1412 		{
1413 			cErrorMessage::showMessage(
1414 				QObject::tr("Hybrid fractal can't be converted"), cErrorMessage::errorMessage);
1415 		}
1416 		else
1417 		{
1418 			par->Set("hybrid_fractal_enable", true);
1419 		}
1420 	}
1421 
1422 	if (oldData->fractal.IFS.foldingMode)
1423 	{
1424 		par->Set("hybrid_fractal_enable", true);
1425 		par->Set("formula", 2, int(fractal::kaleidoscopicIfs));
1426 	}
1427 
1428 	if (oldData->fractal.juliaMode)
1429 	{
1430 		par->Set("fractal_constant_factor", CVector3(0.0, 0.0, 0.0));
1431 		for (int i = 1; i <= NUMBER_OF_FRACTALS; i++)
1432 		{
1433 			par->Set("fractal_constant_factor", CVector3(1.0, 1.0, 1.0));
1434 		}
1435 	}
1436 }
1437 
1438 } /* namespace oldSettings */
1439