1/** 2 * Mandelbulber v2, a 3D fractal generator _%}}i*<. ____ _______ 3 * Copyright (C) 2021 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 * http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm 10 11 * This file has been autogenerated by tools/populateUiInformation.php 12 * from the file "fractal_transf_difs_torus.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 TransfDIFSTorusIteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux) 17{ 18 REAL4 zc = z; 19 REAL torD; 20 // swap axis 21 if (fractal->transformCommon.functionEnabledSwFalse) 22 { 23 REAL temp = zc.x; 24 zc.x = zc.z; 25 zc.z = temp; 26 } 27 if (fractal->transformCommon.functionEnabledSFalse) 28 { 29 REAL temp = zc.y; 30 zc.y = zc.z; 31 zc.z = temp; 32 } 33 34 REAL T1 = native_sqrt(zc.y * zc.y + zc.x * zc.x) - fractal->transformCommon.offsetT1; 35 36 if (!fractal->transformCommon.functionEnabledJFalse) 37 torD = native_sqrt(T1 * T1 + zc.z * zc.z) - fractal->transformCommon.offset05; 38 else 39 torD = max(fabs(T1), fabs(zc.z)) - fractal->transformCommon.offset05; 40 41 aux->dist = min(aux->dist, torD / (aux->DE + 1.0f)); 42 return z; 43}