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 * Linear Combine transform from Mandelbulb3D.
10 * Can create multiple combination for the addition of Cpixel
11 * @reference
12 * http://www.fractalforums.com/mandelbulb-3d/custom-formulas-and-transforms-release-t17106/
13
14 * This file has been autogenerated by tools/populateUiInformation.php
15 * from the file "fractal_transf_lin_combine_cxyz.cpp" in the folder formula/definition
16 * D O    N O T    E D I T    T H I S    F I L E !
17 */
18
19REAL4 TransfLinCombineCXYZIteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux)
20{
21	REAL4 c = aux->const_c;
22
23	REAL4 temp = c;
24	REAL4 mulX = fractal->transformCommon.constantMultiplier100;
25	REAL4 mulY = fractal->transformCommon.constantMultiplier010;
26	REAL4 mulZ = fractal->transformCommon.constantMultiplier001;
27	c.x = mulX.x * temp.x + mulX.y * temp.y + mulX.z * temp.z;
28	c.y = mulY.x * temp.x + mulY.y * temp.y + mulY.z * temp.z;
29	c.z = mulZ.x * temp.x + mulZ.y * temp.y + mulZ.z * temp.z;
30
31	if (fractal->transformCommon.addCpixelEnabledFalse)
32	{
33		REAL4 tempC = c;
34		if (fractal->transformCommon.alternateEnabledFalse) // alternate
35		{
36			tempC = aux->c;
37			switch (fractal->mandelbulbMulti.orderOfXYZC)
38			{
39				case multi_OrderOfXYZCl_xyz:
40				default: tempC = (REAL4){tempC.x, tempC.y, tempC.z, tempC.w}; break;
41				case multi_OrderOfXYZCl_xzy: tempC = (REAL4){tempC.x, tempC.z, tempC.y, tempC.w}; break;
42				case multi_OrderOfXYZCl_yxz: tempC = (REAL4){tempC.y, tempC.x, tempC.z, tempC.w}; break;
43				case multi_OrderOfXYZCl_yzx: tempC = (REAL4){tempC.y, tempC.z, tempC.x, tempC.w}; break;
44				case multi_OrderOfXYZCl_zxy: tempC = (REAL4){tempC.z, tempC.x, tempC.y, tempC.w}; break;
45				case multi_OrderOfXYZCl_zyx: tempC = (REAL4){tempC.z, tempC.y, tempC.x, tempC.w}; break;
46			}
47			aux->c = tempC;
48		}
49		else
50		{
51			switch (fractal->mandelbulbMulti.orderOfXYZC)
52			{
53				case multi_OrderOfXYZCl_xyz:
54				default: tempC = (REAL4){c.x, c.y, c.z, c.w}; break;
55				case multi_OrderOfXYZCl_xzy: tempC = (REAL4){c.x, c.z, c.y, c.w}; break;
56				case multi_OrderOfXYZCl_yxz: tempC = (REAL4){c.y, c.x, c.z, c.w}; break;
57				case multi_OrderOfXYZCl_yzx: tempC = (REAL4){c.y, c.z, c.x, c.w}; break;
58				case multi_OrderOfXYZCl_zxy: tempC = (REAL4){c.z, c.x, c.y, c.w}; break;
59				case multi_OrderOfXYZCl_zyx: tempC = (REAL4){c.z, c.y, c.x, c.w}; break;
60			}
61		}
62		z += tempC * fractal->transformCommon.constantMultiplier111;
63	}
64	return z;
65}