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 * Sierpinski3D. made from DarkBeam's Sierpinski code from M3D 10 * @reference 11 * http://www.fractalforums.com/mandelbulb-3d/custom-formulas-and-transforms-release-t17106/ 12 13 * This file has been autogenerated by tools/populateUiInformation.php 14 * from the file "fractal_sierpinski3d_v3.cpp" in the folder formula/definition 15 * D O N O T E D I T T H I S F I L E ! 16 */ 17 18REAL4 Sierpinski3dV3Iteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux) 19{ 20 if (fractal->transformCommon.functionEnabledTFalse 21 && aux->i >= fractal->transformCommon.startIterationsT 22 && aux->i < fractal->transformCommon.stopIterationsT1) 23 { 24 z += fractal->transformCommon.offset000; 25 z = Matrix33MulFloat4(fractal->transformCommon.rotationMatrix2, z); 26 } 27 28 if (z.x - z.y < 0.0f) 29 { 30 REAL temp = z.y; 31 z.y = z.x; 32 z.x = temp; 33 } 34 if (z.x - z.z < 0.0f) 35 { 36 REAL temp = z.z; 37 z.z = z.x; 38 z.x = temp; 39 } 40 if (z.y - z.z < 0.0f) 41 { 42 REAL temp = z.z; 43 z.z = z.y; 44 z.y = temp; 45 } 46 47 z *= fractal->transformCommon.scaleA2; 48 z -= fractal->transformCommon.offset100; // neg offset 49 50 if (fractal->transformCommon.functionEnabledRFalse 51 && aux->i >= fractal->transformCommon.startIterationsR 52 && aux->i < fractal->transformCommon.stopIterationsR) 53 { 54 z = Matrix33MulFloat4(fractal->transformCommon.rotationMatrix, z); 55 } 56 57 // Reversed full tetra-fold; 58 if (fractal->transformCommon.functionEnabledFalse 59 && aux->i >= fractal->transformCommon.startIterationsC 60 && aux->i < fractal->transformCommon.stopIterationsC) 61 { 62 REAL4 temp = z; 63 if (z.x + z.y < 0.0f) 64 { 65 temp.x = -z.y; 66 z.y = -z.x; 67 z.x = temp.x; 68 } 69 if (z.x + z.z < 0.0f) 70 { 71 temp.x = -z.z; 72 z.z = -z.x; 73 z.x = temp.x; 74 } 75 if (z.y + z.z < 0.0f) 76 { 77 temp.y = -z.z; 78 z.z = -z.y; 79 z.y = temp.y; 80 } 81 } 82 83 if (!fractal->analyticDE.enabledFalse) 84 aux->DE *= fabs(fractal->transformCommon.scaleA2); 85 else 86 aux->DE = aux->DE * fabs(fractal->transformCommon.scaleA2) * fractal->analyticDE.scale1 87 + fractal->analyticDE.offset0; 88 return z; 89}