1 /** 2 * Mandelbulber v2, a 3D fractal generator ,=#MKNmMMKmmßMNWy, 3 * ,B" ]L,,p%%%,,,§;, "K 4 * Copyright (C) 2014-20 Mandelbulber Team §R-==%w["'~5]m%=L.=~5N 5 * ,=mm=§M ]=4 yJKA"/-Nsaj "Bw,==,, 6 * This file is part of Mandelbulber. §R.r= jw",M Km .mM FW ",§=ß., ,TN 7 * ,4R =%["w[N=7]J '"5=],""]]M,w,-; T=]M 8 * Mandelbulber is free software: §R.ß~-Q/M=,=5"v"]=Qf,'§"M= =,M.§ Rz]M"Kw 9 * you can redistribute it and/or §w "xDY.J ' -"m=====WeC=\ ""%""y=%"]"" § 10 * modify it under the terms of the "§M=M =D=4"N #"%==A%p M§ M6 R' #"=~.4M 11 * GNU General Public License as §W =, ][T"]C § § '§ e===~ U !§[Z ]N 12 * published by the 4M",,Jm=,"=e~ § § j]]""N BmM"py=ßM 13 * Free Software Foundation, ]§ T,M=& 'YmMMpM9MMM%=w=,,=MT]M m§;'§, 14 * either version 3 of the License, TWw [.j"5=~N[=§%=%W,T ]R,"=="Y[LFT ]N 15 * or (at your option) TW=,-#"%=;[ =Q:["V"" ],,M.m == ]N 16 * any later version. J§"mr"] ,=,," =="""J]= M"M"]==ß" 17 * §= "=C=4 §"eM "=B:m|4"]#F,§~ 18 * Mandelbulber is distributed in "9w=,,]w em%wJ '"~" ,=,,ß" 19 * the hope that it will be useful, . "K= ,=RMMMßM""" 20 * but WITHOUT ANY WARRANTY; .''' 21 * without even the implied warranty 22 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 23 * 24 * See the GNU General Public License for more details. 25 * You should have received a copy of the GNU General Public License 26 * along with Mandelbulber. If not, see <http://www.gnu.org/licenses/>. 27 * 28 * ########################################################################### 29 * 30 * Authors: Krzysztof Marczak (buddhi1980@gmail.com), Rayan Hitchman 31 * 32 * cOldSettings class - importing settings from old Mandelbulber (v1.21) 33 */ 34 35 #ifndef MANDELBULBER2_SRC_OLD_SETTINGS_HPP_ 36 #define MANDELBULBER2_SRC_OLD_SETTINGS_HPP_ 37 38 #include <memory> 39 #include <vector> 40 41 #include "algebra.hpp" 42 #include "color_structures.hpp" 43 44 // forward declarations 45 class cFractalContainer; 46 class cParameterContainer; 47 48 namespace oldSettings 49 { 50 51 const int IFS_VECTOR_COUNT = 9; 52 const int HYBRID_COUNT = 5; 53 const int MANDELBOX_FOLDS = 2; 54 55 enum enumPerspectiveType 56 { 57 threePoint = 0, 58 fishEye = 1, 59 equirectangular = 2, 60 fishEyeCut = 3 61 }; 62 63 enum enumOldFractalFormula 64 { 65 none = 0, 66 trig_DE = 1, 67 trig_optim = 2, 68 fast_trig = 3, 69 hypercomplex = 4, 70 quaternion = 5, 71 minus_fast_trig = 6, 72 menger_sponge = 7, 73 tglad = 8, 74 kaleidoscopic = 10, 75 xenodreambuie = 11, 76 hybrid = 12, 77 mandelbulb2 = 13, 78 mandelbulb3 = 14, 79 mandelbulb4 = 15, 80 foldingIntPow2 = 16, 81 smoothMandelbox = 17, 82 mandelboxVaryScale4D = 18, 83 aexion = 19, 84 benesi = 20, 85 bristorbrot = 21, 86 invertX = 22, 87 invertY = 23, 88 invertZ = 24, 89 invertR = 25, 90 sphericalFold = 26, 91 powXYZ = 27, 92 scaleX = 28, 93 scaleY = 29, 94 scaleZ = 30, 95 offsetX = 31, 96 offsetY = 32, 97 offsetZ = 33, 98 angleMultiplyX = 34, 99 angleMultiplyY = 35, 100 angleMultiplyZ = 36, 101 generalizedFoldBox = 37, 102 ocl_custom = 38 103 }; 104 105 enum enumCalculationMode 106 { 107 normal = 0, 108 colouring = 1, 109 fake_AO = 2, 110 deltaDE1 = 3, 111 deltaDE2 = 4, 112 orbitTrap = 5 113 }; 114 115 enum enumGeneralizedFoldBoxType 116 { 117 foldTet = 0, 118 foldCube = 1, 119 foldOct = 2, 120 foldDodeca = 3, 121 foldOctCube = 4, 122 foldIcosa = 5, 123 foldBox6 = 6, 124 foldBox5 = 7 125 }; 126 127 enum enumObjectType 128 { 129 objFractal = 0, 130 objPlane = 1, 131 objWater = 2, 132 objSphere = 3, 133 objSphereInv = 4, 134 objBox = 5, 135 objBoxInv = 6 136 }; 137 138 enum enumOCLDEMode 139 { 140 calculated = 0, 141 deltaDE = 1, 142 noDE = 2 143 }; 144 145 struct sFractalIFSD 146 { 147 double rotationGamma; 148 double rotationAlfa; 149 double rotationBeta; 150 double scale; 151 double distance[IFS_VECTOR_COUNT]; 152 double alfa[IFS_VECTOR_COUNT]; 153 double beta[IFS_VECTOR_COUNT]; 154 double gamma[IFS_VECTOR_COUNT]; 155 double intensity[IFS_VECTOR_COUNT]; 156 CVector3 offset; 157 CVector3 direction[IFS_VECTOR_COUNT]; 158 CVector3 edge; 159 }; 160 161 struct sFractalGeneralizedFoldBox 162 { 163 enum enumGeneralizedFoldBoxType type; 164 CVector3 Nv_tet[4]; 165 CVector3 Nv_cube[6]; 166 CVector3 Nv_oct[8]; 167 CVector3 Nv_oct_cube[14]; 168 CVector3 Nv_dodeca[12]; 169 CVector3 Nv_icosa[20]; 170 CVector3 Nv_box6[8]; 171 CVector3 Nv_box5[7]; 172 int sides_tet; 173 int sides_cube; 174 int sides_oct; 175 int sides_oct_cube; 176 int sides_dodeca; 177 int sides_icosa; 178 int sides_box6; 179 int sides_box5; 180 }; 181 182 struct sFractalIFS 183 { 184 sFractalIFSD doubles; 185 bool absX, absY, absZ; 186 bool foldingMode; // Kaleidoscopic IFS folding mode 187 bool enabled[IFS_VECTOR_COUNT]; 188 bool mengerSpongeMode; 189 int foldingCount; 190 CRotationMatrix mainRot; 191 CRotationMatrix rot[IFS_VECTOR_COUNT]; 192 }; 193 194 struct sFractalMandelboxVary4D 195 { 196 double fold; 197 double minR; 198 double scaleVary; 199 double wadd; 200 double rPower; 201 }; 202 203 struct sFractalMandelboxD 204 { 205 double rotationMain[3]; 206 double rotation[MANDELBOX_FOLDS][3][3]; 207 double colorFactorX; 208 double colorFactorY; 209 double colorFactorZ; 210 double colorFactorR; 211 double colorFactorSp1; 212 double colorFactorSp2; 213 double scale; 214 double foldingLimit; 215 double foldingValue; 216 double foldingSphericalMin; 217 double foldingSphericalFixed; 218 double sharpness; 219 double solid; 220 double melt; 221 CVector3 offset; 222 sFractalMandelboxVary4D vary4D; 223 }; 224 225 struct sFractalMandelbox 226 { 227 sFractalMandelboxD doubles; 228 bool rotationsEnabled; 229 CRotationMatrix mainRot; 230 CRotationMatrix rot[MANDELBOX_FOLDS][3]; 231 CRotationMatrix rotinv[MANDELBOX_FOLDS][3]; 232 }; 233 234 struct sFractalPrimitivesD 235 { 236 CVector3 planeCentre; 237 CVector3 planeNormal; 238 CVector3 boxCentre; 239 CVector3 boxSize; 240 CVector3 invertedBoxCentre; 241 CVector3 invertedBoxSize; 242 CVector3 sphereCentre; 243 double sphereRadius; 244 CVector3 invertedSphereCentre; 245 double invertedSphereRadius; 246 double waterHeight; 247 double waterAmplitude; 248 double waterLength; 249 double waterRotation; 250 double waterAnimSpeed; 251 }; 252 253 struct sFractalPrimitives 254 { 255 bool planeEnable; 256 bool boxEnable; 257 bool invertedBoxEnable; 258 bool sphereEnable; 259 bool invertedSphereEnable; 260 bool waterEnable; 261 bool onlyPlane; 262 int waterIterations; 263 }; 264 265 struct sFractalD 266 { 267 double N; 268 double amin; // fractal limits 269 double amax; 270 double bmin; 271 double bmax; 272 double cmin; 273 double cmax; 274 double constantFactor; 275 double FoldingIntPowZfactor; 276 double FoldingIntPowFoldFactor; 277 double foldingLimit; // parameters of TGlad's folding 278 double foldingValue; 279 double foldingSphericalMin; 280 double foldingSphericalFixed; 281 double detailSize; 282 double power; // power of fractal formula 283 double cadd; 284 double hybridPower[HYBRID_COUNT]; 285 CVector3 julia; // Julia constant 286 CVector3 fakeLightsOrbitTrap; 287 sFractalPrimitivesD primitives; 288 }; 289 290 struct sFractal 291 { 292 sFractalD doubles; 293 294 // maximum number of iterations 295 int minN; // minimum number of iterations 296 297 bool limits_enabled; // enable limits (intersections) 298 bool iterThresh; // maxiter threshold mode 299 bool analyticDE; // analytic DE mode 300 bool juliaMode; // Julia mode 301 bool tgladFoldingMode; // Tglad's folding mode 302 bool sphericalFoldingMode; // spherical folding mode 303 bool interiorMode; 304 bool hybridCyclic; 305 bool linearDEmode; 306 bool constantDEThreshold; 307 bool useCustomOCLFormula; 308 bool normalCalculationMode; 309 310 enumOldFractalFormula formula; 311 312 int hybridIters[HYBRID_COUNT]; 313 enumOldFractalFormula hybridFormula[HYBRID_COUNT]; 314 315 std::vector<enumOldFractalFormula> formulaSequence; 316 std::vector<double> hybridPowerSequence; 317 char customOCLFormulaName[100]; 318 enumOCLDEMode customOCLFormulaDEMode; 319 320 sFractalIFS IFS; 321 sFractalMandelbox mandelbox; 322 sFractalGeneralizedFoldBox genFoldBox; 323 sFractalPrimitives primitives; 324 325 int frameNo; 326 327 int itersOut; 328 enumObjectType objectOut; 329 330 int fakeLightsMinIter; 331 int fakeLightsMaxIter; 332 }; 333 334 struct sImageAdjustments 335 { 336 double shading; 337 double directLight; 338 double ambient; 339 double specular; 340 double reflect; 341 double globalIlum; 342 double brightness; 343 double glow_intensity; 344 double fogVisibility; 345 double coloring_speed; 346 double imageGamma; 347 double paletteOffset; 348 double mainLightIntensity; 349 double contrast; 350 }; 351 352 struct sParamRenderD 353 { 354 double zoom; // zoom 355 double DE_factor; // factor for distance estimation steps 356 double resolution; // resolution of image in fractal coordinates 357 double persp; // perspective factor 358 double quality; // DE threshold factor 359 double smoothness; 360 double alpha; // rotation of fractal 361 double beta; // 362 double gamma; 363 double DOFFocus; 364 double DOFRadius; 365 double mainLightAlpha; 366 double mainLightBeta; 367 double auxLightIntensity; 368 double auxLightMaxDist; 369 double auxLightDistributionRadius; 370 double auxLightVisibility; 371 double auxLightPreIntensity[4]; 372 double stereoEyeDistance; 373 double viewDistanceMin; 374 double viewDistanceMax; 375 double volumetricLightIntensity[5]; 376 double fogDensity; 377 double fogColour1Distance; 378 double fogColour2Distance; 379 double fogDistanceFactor; 380 double colourSaturation; 381 double fastAoTune; 382 double iterFogOpacity; 383 double iterFogOpacityTrim; 384 double fakeLightsIntensity; 385 double fakeLightsVisibility; 386 double fakeLightsVisibilitySize; 387 double shadowConeAngle; 388 double primitivePlaneReflect; 389 double primitiveBoxReflect; 390 double primitiveInvertedBoxReflect; 391 double primitiveSphereReflect; 392 double primitiveInvertedSphereReflect; 393 double primitiveWaterReflect; 394 395 oldSettings::sImageAdjustments imageAdjustments; 396 397 CVector3 vp; // view point 398 CVector3 auxLightPre[4]; 399 CVector3 auxLightRandomCenter; 400 }; 401 402 struct sImageSwitches 403 { 404 bool coloringEnabled; 405 bool fogEnabled; 406 bool raytracedReflections; 407 bool volumetricLightEnabled; 408 bool iterFogEnabled; 409 bool hdrEnabled; 410 }; 411 412 struct sEffectColours 413 { 414 sRGB glow_color1; 415 sRGB glow_color2; 416 sRGB fogColor; 417 sRGB mainLightColour; 418 }; 419 420 struct sParamRender 421 { 422 sParamRenderD doubles; 423 424 sFractal fractal; 425 int image_width; // image width 426 int image_height; // image height 427 int globalIlumQuality; // ambient occlusion quality 428 int reflectionsMax; 429 int coloring_seed; // colouring random seed 430 int auxLightRandomSeed; 431 int auxLightNumber; 432 int SSAOQuality; 433 int startFrame; 434 int endFrame; 435 int framesPerKeyframe; 436 int imageFormat; 437 int noOfTiles; 438 int tileCount; 439 440 int OpenCLEngine; 441 int OpenCLPixelsPerJob; 442 int OpenCLDOFMethod; 443 444 enumPerspectiveType perspectiveType; 445 446 bool shadow; // enable shadows 447 bool global_ilumination; // enable global illumination 448 bool fastGlobalIllumination; // enable fake global illumination 449 bool slowShading; // enable fake gradient calculation for shading 450 bool texturedBackground; // enable textured background 451 bool background_as_fulldome; 452 bool recordMode; // path recording mode 453 bool continueRecord; // continue recording mode 454 bool playMode; // play mode 455 bool animMode; // animation mode 456 bool SSAOEnabled; 457 bool DOFEnabled; 458 bool auxLightPreEnabled[4]; 459 bool volumetricLightEnabled[5]; 460 bool penetratingLights; 461 bool stereoEnabled; 462 bool quiet; 463 bool fishEyeCut; 464 bool fakeLightsEnabled; 465 sImageSwitches imageSwitches; 466 467 sRGB background_color1; // background colour 468 sRGB background_color2; 469 sRGB background_color3; 470 sRGB auxLightPreColour[4]; 471 sRGB fogColour1; 472 sRGB fogColour2; 473 sRGB fogColour3; 474 sRGB primitivePlaneColour; 475 sRGB primitiveBoxColour; 476 sRGB primitiveInvertedBoxColour; 477 sRGB primitiveSphereColour; 478 sRGB primitiveInvertedSphereColour; 479 sRGB primitiveWaterColour; 480 sEffectColours effectColours; 481 482 sRGB palette[256]; 483 484 char file_destination[1000]; 485 char file_envmap[1000]; 486 char file_background[1000]; 487 char file_lightmap[1000]; 488 char file_path[1000]; 489 char file_keyframes[1000]; 490 491 std::vector<enumOldFractalFormula> formulaSequence; 492 std::vector<double> hybridPowerSequence; 493 494 double settingsVersion; 495 }; 496 497 class cOldSettings 498 { 499 public: 500 cOldSettings(); 501 ~cOldSettings(); 502 bool LoadSettings(const QString &filename); 503 void ConvertToNewContainer( 504 std::shared_ptr<cParameterContainer> params, std::shared_ptr<cFractalContainer> fractal) const; 505 506 private: 507 bool LoadSettings2(const QString &filename); 508 bool LoadOneSetting(const char *str1, const char *str2, sParamRender *params); 509 static double atof2(const char *str); 510 void GetPaletteFromString(sRGB *palette, const char *paletteString); 511 sParamRender *oldData; 512 bool paletteLoadedFromSettingsFile; 513 }; 514 515 } /* namespace oldSettings */ 516 517 #endif /* MANDELBULBER2_SRC_OLD_SETTINGS_HPP_ */ 518