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 * Box Tiling 4d 10 11 * This file has been autogenerated by tools/populateUiInformation.php 12 * from the file "fractal_transf_box_tiling4d.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 TransfBoxTiling4dIteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux) 17{ 18 REAL4 size = fractal->transformCommon.offset2222; 19 REAL4 oldZ = z; 20 21 if (!fractal->transformCommon.functionEnabledFalse) 22 { 23 if (fractal->transformCommon.functionEnabledx && size.x != 0.0f) 24 { 25 z.x -= round(z.x / size.x) * size.x; 26 } 27 if (fractal->transformCommon.functionEnabledyFalse && size.y != 0.0f) 28 { 29 z.y -= round(z.y / size.y) * size.y; 30 } 31 if (fractal->transformCommon.functionEnabledzFalse && size.z != 0.0f) 32 { 33 z.z -= round(z.z / size.z) * size.z; 34 } 35 if (fractal->transformCommon.functionEnabledwFalse && size.w != 0.0f) 36 { 37 z.w -= round(z.w / size.w) * size.w; 38 } 39 } 40 else 41 { 42 REAL4 repeatPos = fractal->transformCommon.offsetA1111; 43 REAL4 repeatNeg = fractal->transformCommon.offsetB1111; 44 45 if (fractal->transformCommon.functionEnabledx && z.x < (repeatPos.x + 0.5f) * size.x 46 && z.x > (repeatNeg.x + 0.5f) * -size.x && size.x != 0.0f) 47 { 48 z.x -= round(z.x / size.x) * size.x; 49 } 50 if (fractal->transformCommon.functionEnabledyFalse && z.y < (repeatPos.y + 0.5f) * size.y 51 && z.y > (repeatNeg.y + 0.5f) * -size.y && size.y != 0.0f) 52 { 53 z.y -= round(z.y / size.y) * size.y; 54 } 55 if (fractal->transformCommon.functionEnabledzFalse && z.z < (repeatPos.z + 0.5f) * size.z 56 && z.z > (repeatNeg.z + 0.5f) * -size.z && size.z != 0.0f) 57 { 58 z.z -= round(z.z / size.z) * size.z; 59 } 60 if (fractal->transformCommon.functionEnabledwFalse && z.w < (repeatPos.w + 0.5f) * size.w 61 && z.w > (repeatNeg.w + 0.5f) * -size.w && size.w != 0.0f) 62 { 63 z.w -= round(z.w / size.w) * size.w; 64 } 65 } 66 67 if (fractal->transformCommon.functionEnabledBxFalse) 68 { 69 z.x = z.x * fractal->transformCommon.scale1 / (fabs(oldZ.x) + 1.0f); 70 z.y = z.y * fractal->transformCommon.scale1 / (fabs(oldZ.y) + 1.0f); 71 z.z = z.z * fractal->transformCommon.scale1 / (fabs(oldZ.z) + 1.0f); 72 z.w = z.w * fractal->transformCommon.scale1 / (fabs(oldZ.w) + 1.0f); 73 } 74 75 if (fractal->analyticDE.enabled) 76 { 77 if (!fractal->analyticDE.enabledFalse) 78 aux->DE = aux->DE * fractal->analyticDE.scale1 + fractal->analyticDE.offset0; 79 else 80 { 81 aux->DE = aux->DE * length(z) * fractal->analyticDE.scale1 + fractal->analyticDE.offset0; 82 } 83 } 84 return z; 85}