1/**
2 * Mandelbulber v2, a 3D fractal generator  _%}}i*<.        ____                _______
3 * Copyright (C) 2020 Mandelbulber Team   _>]|=||i=i<,     / __ \___  ___ ___  / ___/ /
4 *                                        \><||i|=>>%)    / /_/ / _ \/ -_) _ \/ /__/ /__
5 * This file is part of Mandelbulber.     )<=i=]=|=i<>    \____/ .__/\__/_//_/\___/____/
6 * The project is licensed under GPLv3,   -<>>=|><|||`        /_/
7 * see also COPYING file in this folder.    ~+{i%+++
8 *
9 * initial 4D
10 * This formula contains aux.actualScaleA
11
12 * This file has been autogenerated by tools/populateUiInformation.php
13 * from the file "fractal_transf_initial4d.cpp" in the folder formula/definition
14 * D O    N O T    E D I T    T H I S    F I L E !
15 */
16
17REAL4 TransfInitial4dIteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux)
18{
19	if (aux->i >= fractal->transformCommon.startIterationsD
20			&& aux->i < fractal->transformCommon.stopIterationsD1)
21	{
22		if (!fractal->transformCommon.functionEnabledFalse)
23		{
24			z = (REAL4){z.x + z.y + z.z, -z.x - z.y + z.z, -z.x + z.y - z.z, z.x - z.y - z.z};
25			z = fabs(z);
26			z = fabs(z - fractal->transformCommon.offsetA0000);
27		}
28		else
29		{
30			z = (REAL4){z.x, z.y, z.z, length(z)};
31		}
32		if (fractal->transformCommon.addCpixelEnabledFalse)
33			aux->const_c = z * fractal->transformCommon.scale1111;
34
35		if (fractal->transformCommon.functionEnabledAFalse) z = (REAL4){0.0f, 0.0f, 0.0f, 0.0f};
36	}
37	// DE tweak
38	if (!fractal->analyticDE.enabledFalse) aux->DE = aux->DE * length(z) / aux->r;
39
40	aux->DE = aux->DE * fractal->analyticDE.scale1 + fractal->analyticDE.offset1;
41	return z;
42}