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 * mandelbulb vary scaleV1 10 11 * This file has been autogenerated by tools/populateUiInformation.php 12 * from the file "fractal_mandelbulb_vary_power_v1.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 MandelbulbVaryPowerV1Iteration(REAL4 z, __constant sFractalCl *fractal, sExtendedAuxCl *aux) 17{ 18 REAL tempVC = fractal->bulb.power; // constant to be varied 19 20 if (aux->i >= fractal->transformCommon.startIterations250 21 && aux->i < fractal->transformCommon.stopIterations 22 && (fractal->transformCommon.stopIterations - fractal->transformCommon.startIterations250 23 != 0)) 24 { 25 int iterationRange = 26 fractal->transformCommon.stopIterations - fractal->transformCommon.startIterations250; 27 int currentIteration = (aux->i - fractal->transformCommon.startIterations250); 28 tempVC += fractal->transformCommon.offset0 * (1.0f * currentIteration) / iterationRange; 29 } 30 if (aux->i >= fractal->transformCommon.stopIterations) 31 { 32 tempVC = (tempVC + fractal->transformCommon.offset0); 33 } 34 35 // if (aux->r < 1e-21f) 36 // aux->r = 1e-21f; 37 REAL th0 = asin(z.z / aux->r) + fractal->bulb.betaAngleOffset; 38 REAL ph0 = atan2(z.y, z.x) + fractal->bulb.alphaAngleOffset; 39 REAL rp = native_powr(aux->r, tempVC - 1.0f); 40 REAL th = th0 * tempVC; 41 REAL ph = ph0 * tempVC; 42 REAL cth = native_cos(th); 43 aux->DE = rp * aux->DE * tempVC + 1.0f; 44 rp *= aux->r; 45 z = (REAL4){cth * native_cos(ph), cth * native_sin(ph), native_sin(th), 0.0f} * rp; 46 return z; 47}