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 * Create and add Cpixel 4D constant to z vector
10
11 * This file has been autogenerated by tools/populateUiInformation.php
12 * from the file "fractal_transf_add_cpixel4d.cpp" in the folder formula/definition
13 * D O    N O T    E D I T    T H I S    F I L E !
14 */
15
16REAL4 TransfAddCpixel4dIteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux)
17{
18	if (aux->i >= fractal->transformCommon.startIterationsD
19			&& aux->i < fractal->transformCommon.stopIterationsD1)
20	{
21		REAL4 t = aux->const_c;
22
23		if (fractal->transformCommon.functionEnabledAFalse)
24		{ // c.w = rad
25			t = (REAL4){t.x, t.y, t.z, 0.0f};
26			t = (REAL4){t.x, t.y, t.z, length(t)};
27		}
28
29		if (fractal->transformCommon.functionEnabledBFalse)
30		{ // quadray
31			t = (REAL4){t.x + t.y + t.z, -t.x - t.y + t.z, -t.x + t.y - t.z, t.x - t.y - t.z};
32		}
33
34		if (fractal->transformCommon.functionEnabledFFalse) t = fabs(t);
35		t = t - fractal->transformCommon.offsetA0000;
36		if (fractal->transformCommon.functionEnabledCFalse) t = fabs(t);
37
38		aux->const_c = t * fractal->transformCommon.scale1111;
39		aux->c = aux->const_c;
40	}
41
42	if (fractal->transformCommon.functionEnabledDFalse)
43	{
44		aux->c.x *= sign(z.x);
45		aux->c.y *= sign(z.y);
46		aux->c.z *= sign(z.z);
47		aux->c.w *= sign(z.w);
48	}
49
50	if (fractal->transformCommon.addCpixelEnabledFalse) z += aux->c;
51
52	aux->DE = aux->DE * fractal->analyticDE.scale1 + fractal->analyticDE.offset0;
53	return z;
54}