Place Mandelbulber fractal generator to tree
This commit is contained in:
parent
f75714c26f
commit
5af011586b
@ -1,3 +1,7 @@
|
||||
#
|
||||
# NOT USED
|
||||
#
|
||||
|
||||
#
|
||||
# make new patch:
|
||||
# diff -EbBw --normal -u ../mandelbulber-read-only/src src/mandelbulber | grep -v "Only in" > util/mandelbulber.patch
|
||||
|
@ -316,9 +316,9 @@ if(ENABLE_LEVELDB)
|
||||
endif(ENABLE_LEVELDB)
|
||||
|
||||
|
||||
option(ENABLE_MANDELBULBER "Use Mandelbulber source to generate more fractals in math mapgen" OFF)
|
||||
set(USE_MANDELBULBER 0)
|
||||
find_package(Mandelbulber)
|
||||
#option(ENABLE_MANDELBULBER "Use Mandelbulber source to generate more fractals in math mapgen" OFF)
|
||||
set(USE_MANDELBULBER 1)
|
||||
#find_package(Mandelbulber)
|
||||
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
|
||||
|
218
src/mandelbulber/algebra.cpp
Normal file
218
src/mandelbulber/algebra.cpp
Normal file
@ -0,0 +1,218 @@
|
||||
/*********************************************************
|
||||
/ MANDELBULBER
|
||||
/ Vector and matrix algebra
|
||||
/ Functions for CMatrix33 and CRotationMatrix classes
|
||||
/
|
||||
/ author: Krzysztof Marczak
|
||||
/ contact: buddhi1980@gmail.com
|
||||
/ licence: GNU GPL v3.0
|
||||
/
|
||||
********************************************************/
|
||||
|
||||
#include "algebra.hpp"
|
||||
|
||||
/***************** class CMatrix33 ***********************/
|
||||
CMatrix33::CMatrix33()
|
||||
{
|
||||
m11 = 0;
|
||||
m12 = 0;
|
||||
m13 = 0;
|
||||
m21 = 0;
|
||||
m22 = 0;
|
||||
m23 = 0;
|
||||
m31 = 0;
|
||||
m32 = 0;
|
||||
m33 = 0;
|
||||
}
|
||||
|
||||
CMatrix33::CMatrix33(const CMatrix33 &matrix)
|
||||
{
|
||||
m11 = matrix.m11;
|
||||
m12 = matrix.m12;
|
||||
m13 = matrix.m13;
|
||||
m21 = matrix.m21;
|
||||
m22 = matrix.m22;
|
||||
m23 = matrix.m23;
|
||||
m31 = matrix.m31;
|
||||
m32 = matrix.m32;
|
||||
m33 = matrix.m33;
|
||||
}
|
||||
|
||||
CMatrix33& CMatrix33::operator=(const CMatrix33 &matrix)
|
||||
{
|
||||
m11 = matrix.m11;
|
||||
m12 = matrix.m12;
|
||||
m13 = matrix.m13;
|
||||
m21 = matrix.m21;
|
||||
m22 = matrix.m22;
|
||||
m23 = matrix.m23;
|
||||
m31 = matrix.m31;
|
||||
m32 = matrix.m32;
|
||||
m33 = matrix.m33;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CMatrix33 CMatrix33::operator*(const CMatrix33 &matrix) const
|
||||
{
|
||||
CMatrix33 result;
|
||||
result.m11 = m11 * matrix.m11 + m12 * matrix.m21 + m13 * matrix.m31;
|
||||
result.m12 = m11 * matrix.m12 + m12 * matrix.m22 + m13 * matrix.m32;
|
||||
result.m13 = m11 * matrix.m13 + m12 * matrix.m23 + m13 * matrix.m33;
|
||||
result.m21 = m21 * matrix.m11 + m22 * matrix.m21 + m23 * matrix.m31;
|
||||
result.m22 = m21 * matrix.m12 + m22 * matrix.m22 + m23 * matrix.m32;
|
||||
result.m23 = m21 * matrix.m13 + m22 * matrix.m23 + m23 * matrix.m33;
|
||||
result.m31 = m31 * matrix.m11 + m32 * matrix.m21 + m33 * matrix.m31;
|
||||
result.m32 = m31 * matrix.m12 + m32 * matrix.m22 + m33 * matrix.m32;
|
||||
result.m33 = m31 * matrix.m13 + m32 * matrix.m23 + m33 * matrix.m33;
|
||||
return result;
|
||||
}
|
||||
|
||||
CVector3 CMatrix33::operator*(const CVector3 &vector) const
|
||||
{
|
||||
CVector3 result;
|
||||
result.x = m11 * vector.x + m12 * vector.y + m13 * vector.z;
|
||||
result.y = m21 * vector.x + m22 * vector.y + m23 * vector.z;
|
||||
result.z = m31 * vector.x + m32 * vector.y + m33 * vector.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**************** class RotarionMatrix **********************/
|
||||
CRotationMatrix::CRotationMatrix()
|
||||
{
|
||||
matrix.m11 = 1.0;
|
||||
matrix.m12 = 0.0;
|
||||
matrix.m13 = 0.0;
|
||||
matrix.m21 = 0.0;
|
||||
matrix.m22 = 1.0;
|
||||
matrix.m23 = 0.0;
|
||||
matrix.m31 = 0.0;
|
||||
matrix.m32 = 0.0;
|
||||
matrix.m33 = 1.0;
|
||||
zero = true;
|
||||
}
|
||||
|
||||
void CRotationMatrix::RotateX(double angle)
|
||||
{
|
||||
if (angle != 0.0)
|
||||
{
|
||||
CMatrix33 rot;
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
rot.m11 = 1.0;
|
||||
rot.m22 = c;
|
||||
rot.m33 = c;
|
||||
rot.m23 = -s;
|
||||
rot.m32 = s;
|
||||
matrix = matrix * rot;
|
||||
zero = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CRotationMatrix::RotateY(double angle)
|
||||
{
|
||||
if (angle != 0.0)
|
||||
{
|
||||
CMatrix33 rot;
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
rot.m22 = 1.0;
|
||||
rot.m33 = c;
|
||||
rot.m11 = c;
|
||||
rot.m31 = -s;
|
||||
rot.m13 = s;
|
||||
matrix = matrix * rot;
|
||||
zero = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CRotationMatrix::RotateZ(double angle)
|
||||
{
|
||||
if (angle != 0.0)
|
||||
{
|
||||
CMatrix33 rot;
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
rot.m33 = 1.0;
|
||||
rot.m11 = c;
|
||||
rot.m22 = c;
|
||||
rot.m12 = -s;
|
||||
rot.m21 = s;
|
||||
matrix = matrix * rot;
|
||||
zero = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CRotationMatrix::SetRotation(double angles[3])
|
||||
{
|
||||
Null();
|
||||
RotateZ(angles[2]);
|
||||
RotateY(angles[1]);
|
||||
RotateX(angles[0]);
|
||||
}
|
||||
|
||||
void CRotationMatrix::SetRotation(double alfa, double beta, double gamma)
|
||||
{
|
||||
Null();
|
||||
RotateZ(alfa);
|
||||
RotateY(beta);
|
||||
RotateX(gamma);
|
||||
}
|
||||
|
||||
CVector3 CRotationMatrix::RotateVector(const CVector3& vector) const
|
||||
{
|
||||
if (!zero)
|
||||
{
|
||||
CVector3 vector2 = matrix * vector;
|
||||
return vector2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return vector;
|
||||
}
|
||||
}
|
||||
|
||||
void CRotationMatrix::Null()
|
||||
{
|
||||
//CRotationMatrix();
|
||||
matrix.m11 = 1.0;
|
||||
matrix.m12 = 0.0;
|
||||
matrix.m13 = 0.0;
|
||||
matrix.m21 = 0.0;
|
||||
matrix.m22 = 1.0;
|
||||
matrix.m23 = 0.0;
|
||||
matrix.m31 = 0.0;
|
||||
matrix.m32 = 0.0;
|
||||
matrix.m33 = 1.0;
|
||||
zero = true;
|
||||
}
|
||||
|
||||
double CRotationMatrix::GetAlfa() const
|
||||
{
|
||||
return atan2(matrix.m12,matrix.m22);
|
||||
}
|
||||
|
||||
double CRotationMatrix::GetBeta() const
|
||||
{
|
||||
return asin(-matrix.m32);
|
||||
}
|
||||
|
||||
double CRotationMatrix::GetGamma() const
|
||||
{
|
||||
return atan2(matrix.m31,matrix.m33);
|
||||
}
|
||||
|
||||
CRotationMatrix CRotationMatrix::Transpose() const
|
||||
{
|
||||
CRotationMatrix m;
|
||||
m.matrix.m11 = matrix.m11;
|
||||
m.matrix.m12 = matrix.m21;
|
||||
m.matrix.m13 = matrix.m31;
|
||||
m.matrix.m21 = matrix.m12;
|
||||
m.matrix.m22 = matrix.m22;
|
||||
m.matrix.m23 = matrix.m32;
|
||||
m.matrix.m31 = matrix.m13;
|
||||
m.matrix.m32 = matrix.m23;
|
||||
m.matrix.m33 = matrix.m33;
|
||||
m.zero = false;
|
||||
return m;
|
||||
}
|
164
src/mandelbulber/algebra.hpp
Normal file
164
src/mandelbulber/algebra.hpp
Normal file
@ -0,0 +1,164 @@
|
||||
/*********************************************************
|
||||
/ MANDELBULBER
|
||||
/ Vector and matrix algebra
|
||||
/ Defenitions of vector and matrix classes
|
||||
/
|
||||
/ author: Krzysztof Marczak
|
||||
/ contact: buddhi1980@gmail.com
|
||||
/ licence: GNU GPL v3.0
|
||||
/
|
||||
********************************************************/
|
||||
|
||||
#ifndef ALGEBRA_H_
|
||||
#define ALGEBRA_H_
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/************************* vector 3D **********************/
|
||||
class CVector3
|
||||
{
|
||||
public:
|
||||
inline CVector3()
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
}
|
||||
inline CVector3(double x_init, double y_init, double z_init)
|
||||
{
|
||||
x = x_init;
|
||||
y = y_init;
|
||||
z = z_init;
|
||||
}
|
||||
inline CVector3(double alfa, double beta)
|
||||
{
|
||||
x = cos(beta) * cos(alfa);
|
||||
y = cos(beta) * sin(alfa);
|
||||
z = sin(beta);
|
||||
}
|
||||
inline CVector3(const CVector3 &vector)
|
||||
{
|
||||
x = vector.x;
|
||||
y = vector.y;
|
||||
z = vector.z;
|
||||
}
|
||||
inline CVector3 operator+(const CVector3 &vector) const
|
||||
{
|
||||
return CVector3(x + vector.x, y + vector.y, z + vector.z);
|
||||
}
|
||||
inline CVector3 operator-(const CVector3 &vector) const
|
||||
{
|
||||
return CVector3(x - vector.x, y - vector.y, z - vector.z);
|
||||
}
|
||||
inline CVector3 operator*(const double &scalar) const
|
||||
{
|
||||
return CVector3(x * scalar, y * scalar, z * scalar);
|
||||
}
|
||||
inline CVector3& operator=(const CVector3 &vector)
|
||||
{
|
||||
x = vector.x;
|
||||
y = vector.y;
|
||||
z = vector.z;
|
||||
return *this;
|
||||
}
|
||||
inline CVector3& operator+=(const CVector3 &vector)
|
||||
{
|
||||
x += vector.x;
|
||||
y += vector.y;
|
||||
z += vector.z;
|
||||
return *this;
|
||||
}
|
||||
inline CVector3& operator-=(const CVector3 &vector)
|
||||
{
|
||||
x -= vector.x;
|
||||
y -= vector.y;
|
||||
z -= vector.z;
|
||||
return *this;
|
||||
}
|
||||
inline CVector3& operator*=(const double &scalar)
|
||||
{
|
||||
x *= scalar;
|
||||
y *= scalar;
|
||||
z *= scalar;
|
||||
return *this;
|
||||
}
|
||||
inline double Length() const
|
||||
{
|
||||
return sqrt(x * x + y * y + z * z);
|
||||
}
|
||||
inline double Dot(const CVector3& vector) const
|
||||
{
|
||||
return x * vector.x + y * vector.y + z * vector.z;
|
||||
}
|
||||
inline CVector3 Cross(const CVector3& v)
|
||||
{
|
||||
CVector3 c;
|
||||
c.x = y*v.z - z*v.y;
|
||||
c.y = -x*v.z + z*v.x;
|
||||
c.z = x*v.y - y*v.x;
|
||||
return c;
|
||||
}
|
||||
inline double Normalize() //returns normalization factor
|
||||
{
|
||||
double norm = 1.0 / Length();
|
||||
x = x * norm;
|
||||
y = y * norm;
|
||||
z = z * norm;
|
||||
return norm;
|
||||
}
|
||||
inline double GetAlfa() const
|
||||
{
|
||||
return atan2(y, x);
|
||||
}
|
||||
inline double GetBeta() const
|
||||
{
|
||||
return atan2(z, sqrt(x * x + y * y));
|
||||
}
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
};
|
||||
|
||||
/************************* matrix 3x3 (fast) *****************/
|
||||
class CMatrix33
|
||||
{
|
||||
public:
|
||||
CMatrix33();
|
||||
CMatrix33(const CMatrix33 &matrix);
|
||||
CMatrix33 operator*(const CMatrix33 &matrix) const;
|
||||
CVector3 operator*(const CVector3 &vector) const;
|
||||
CMatrix33& operator=(const CMatrix33&);
|
||||
double m11;
|
||||
double m12;
|
||||
double m13;
|
||||
double m21;
|
||||
double m22;
|
||||
double m23;
|
||||
double m31;
|
||||
double m32;
|
||||
double m33;
|
||||
};
|
||||
|
||||
/************************* rotation matrix *******************/
|
||||
class CRotationMatrix
|
||||
{
|
||||
public:
|
||||
CRotationMatrix();
|
||||
void RotateX(double angle);
|
||||
void RotateY(double angle);
|
||||
void RotateZ(double angle);
|
||||
void Null();
|
||||
CVector3 RotateVector(const CVector3& vector) const;
|
||||
double GetAlfa() const;
|
||||
double GetBeta() const;
|
||||
double GetGamma() const;
|
||||
void SetRotation(double angles[3]);
|
||||
void SetRotation(double alfa, double beta, double gamma);
|
||||
CRotationMatrix Transpose(void) const;
|
||||
CMatrix33 GetMatrix() {return matrix;}
|
||||
private:
|
||||
CMatrix33 matrix;
|
||||
bool zero;
|
||||
};
|
||||
|
||||
#endif /* ALGEBRA_H_ */
|
91
src/mandelbulber/common_math.h
Normal file
91
src/mandelbulber/common_math.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*********************************************************
|
||||
/ MANDELBULBER
|
||||
/ some functions for different calculations
|
||||
/
|
||||
/
|
||||
/ author: Krzysztof Marczak
|
||||
/ contact: buddhi1980@gmail.com
|
||||
/ licence: GNU GPL v3.0
|
||||
/
|
||||
********************************************************/
|
||||
|
||||
#ifndef COMMON_MATH_H_
|
||||
#define COMMON_MATH_H_
|
||||
|
||||
#include "algebra.hpp"
|
||||
|
||||
struct sVectorsAround
|
||||
{
|
||||
double alpha;
|
||||
double beta;
|
||||
CVector3 v;
|
||||
int R;
|
||||
int G;
|
||||
int B;
|
||||
bool notBlack;
|
||||
};
|
||||
|
||||
struct sVector
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
};
|
||||
|
||||
template <class TYPE>
|
||||
struct sSortZ
|
||||
{
|
||||
TYPE z;
|
||||
int i;
|
||||
};
|
||||
|
||||
enum enumPerspectiveType
|
||||
{
|
||||
threePoint = 0, fishEye = 1, equirectangular = 2, fishEyeCut = 3
|
||||
};
|
||||
|
||||
//int abs(int v);
|
||||
int Random(int max);
|
||||
double dMax(double a, double b, double c);
|
||||
double dMin(double a, double b, double c);
|
||||
//void QuickSortZBuffer(sSortZ<float> *dane, int l, int p);
|
||||
|
||||
template <class T>
|
||||
void QuickSortZBuffer(sSortZ<T> *dane, int l, int p)
|
||||
{
|
||||
int i,j; //robocze indeksy
|
||||
sSortZ<T> x,y; //robocze zmienne typu sortowany obiekt
|
||||
|
||||
i=l; //{ i : = minimalny klucz }
|
||||
j=p; //{ j : = maksymalny klucz }
|
||||
x=dane[(l+p)/2]; //{ x - wyraz srodkowy sortowanej tablicy }
|
||||
do
|
||||
{ //{ cala historie bedziemy powtarzac tak dlugo jak . . . }
|
||||
while(dane[i].z < x.z) //{ dopoki jestesmy na lewo od srodkowego }
|
||||
{
|
||||
i++; //{ ...powiekszamy indeks i }
|
||||
}
|
||||
while(x.z < dane[j].z) //{ dopoki na prawo od srodkowego }
|
||||
{
|
||||
j--; //{ ...zmniejszamy indeks j }
|
||||
}
|
||||
if(i<=j) //{ jezeli i <= j wtedy : }
|
||||
{ //{ zamieniamy miejscami wyrazy i, j }
|
||||
y=dane[i]; //{ podstawienie do zmiennej roboczej }
|
||||
dane[i]=dane[j]; //{ pierwszy etap zamiany }
|
||||
dane[j]=y; //{ drugi etap zamiany }
|
||||
i++; //{ zwiekszenie indeksu i }
|
||||
j--; //{ zmniejszenie indeksu j }
|
||||
}
|
||||
}
|
||||
while(i<=j); //{ nie zostanie spelniony warunek i>j }
|
||||
if(l<j) QuickSortZBuffer(dane, l, j);
|
||||
if(i<p) QuickSortZBuffer(dane, i, p);
|
||||
}
|
||||
|
||||
CVector3 Projection3D(CVector3 point, CVector3 vp, CRotationMatrix mRot, enumPerspectiveType perspectiveType, double fov, double zoom);
|
||||
inline double SmoothConditionAGreaterB(double a, double b, double sharpness) {return 1.0 / (1.0 + exp(sharpness * (b - a)));}
|
||||
inline double SmoothConditionALessB(double a, double b, double sharpness) {return 1.0 / (1.0 + exp(sharpness * (a - b)));}
|
||||
CVector3 InvProjection3D(CVector3 point, CVector3 vp, CRotationMatrix mRotInv, enumPerspectiveType perspectiveType, double fov, double zoom, double imgWidth, double imgHeight);
|
||||
|
||||
#endif /* COMMON_MATH_H_ */
|
1462
src/mandelbulber/fractal.cpp
Normal file
1462
src/mandelbulber/fractal.cpp
Normal file
File diff suppressed because it is too large
Load Diff
300
src/mandelbulber/fractal.h
Normal file
300
src/mandelbulber/fractal.h
Normal file
@ -0,0 +1,300 @@
|
||||
/*********************************************************
|
||||
/ MANDELBULBER
|
||||
/ definition of structures for fractal parameters
|
||||
/
|
||||
/
|
||||
/ author: Krzysztof Marczak
|
||||
/ contact: buddhi1980@gmail.com
|
||||
/ licence: GNU GPL v3.0
|
||||
/
|
||||
********************************************************/
|
||||
|
||||
#ifndef FRACTAL_H_
|
||||
#define FRACTAL_H_
|
||||
|
||||
#include <vector>
|
||||
#include "common_math.h"
|
||||
#ifndef MANDELBULBER_EMBEDDED
|
||||
#include "fractparams.h"
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include <string>
|
||||
|
||||
const int IFS_VECTOR_COUNT = 9;
|
||||
const int HYBRID_COUNT = 5;
|
||||
const int MANDELBOX_FOLDS = 2;
|
||||
|
||||
enum enumFractalFormula
|
||||
{
|
||||
none = 0,
|
||||
trig_DE = 1,
|
||||
trig_optim = 2,
|
||||
fast_trig = 3,
|
||||
hypercomplex = 4,
|
||||
quaternion = 5,
|
||||
minus_fast_trig = 6,
|
||||
menger_sponge = 7,
|
||||
tglad = 8,
|
||||
kaleidoscopic = 10,
|
||||
xenodreambuie = 11,
|
||||
hybrid = 12,
|
||||
mandelbulb2 = 13,
|
||||
mandelbulb3 = 14,
|
||||
mandelbulb4 = 15,
|
||||
foldingIntPow2 = 16,
|
||||
smoothMandelbox = 17,
|
||||
mandelboxVaryScale4D = 18,
|
||||
aexion = 19,
|
||||
benesi = 20,
|
||||
bristorbrot = 21,
|
||||
invertX = 22,
|
||||
invertY = 23,
|
||||
invertZ = 24,
|
||||
invertR = 25,
|
||||
sphericalFold = 26,
|
||||
powXYZ = 27,
|
||||
scaleX = 28,
|
||||
scaleY = 29,
|
||||
scaleZ = 30,
|
||||
offsetX = 31,
|
||||
offsetY = 32,
|
||||
offsetZ = 33,
|
||||
angleMultiplyX = 34,
|
||||
angleMultiplyY = 35,
|
||||
angleMultiplyZ = 36,
|
||||
generalizedFoldBox = 37,
|
||||
ocl_custom = 38
|
||||
};
|
||||
|
||||
enum enumCalculationMode
|
||||
{
|
||||
normal = 0, colouring = 1, fake_AO = 2, deltaDE1 = 3, deltaDE2 = 4, orbitTrap = 5
|
||||
};
|
||||
|
||||
enum enumGeneralizedFoldBoxType
|
||||
{
|
||||
foldTet = 0,
|
||||
foldCube = 1,
|
||||
foldOct = 2,
|
||||
foldDodeca = 3,
|
||||
foldOctCube = 4,
|
||||
foldIcosa = 5,
|
||||
foldBox6 = 6,
|
||||
foldBox5 = 7
|
||||
};
|
||||
|
||||
enum enumObjectType
|
||||
{
|
||||
objFractal = 0,
|
||||
objPlane = 1,
|
||||
objWater = 2,
|
||||
objSphere = 3,
|
||||
objSphereInv = 4,
|
||||
objBox = 5,
|
||||
objBoxInv = 6
|
||||
};
|
||||
|
||||
enum enumOCLDEMode
|
||||
{
|
||||
calculated = 0,
|
||||
deltaDE = 1,
|
||||
noDE = 2
|
||||
};
|
||||
|
||||
struct sFractalIFSD
|
||||
{
|
||||
double rotationGamma;
|
||||
double rotationAlfa;
|
||||
double rotationBeta;
|
||||
double scale;
|
||||
double distance[IFS_VECTOR_COUNT];
|
||||
double alfa[IFS_VECTOR_COUNT];
|
||||
double beta[IFS_VECTOR_COUNT];
|
||||
double gamma[IFS_VECTOR_COUNT];
|
||||
double intensity[IFS_VECTOR_COUNT];
|
||||
CVector3 offset;
|
||||
CVector3 direction[IFS_VECTOR_COUNT];
|
||||
CVector3 edge;
|
||||
};
|
||||
|
||||
struct sFractalGeneralizedFoldBox
|
||||
{
|
||||
enum enumGeneralizedFoldBoxType type;
|
||||
CVector3 Nv_tet[4];
|
||||
CVector3 Nv_cube[6];
|
||||
CVector3 Nv_oct[8];
|
||||
CVector3 Nv_oct_cube[14];
|
||||
CVector3 Nv_dodeca[12];
|
||||
CVector3 Nv_icosa[20];
|
||||
CVector3 Nv_box6[8];
|
||||
CVector3 Nv_box5[7];
|
||||
int sides_tet;
|
||||
int sides_cube;
|
||||
int sides_oct;
|
||||
int sides_oct_cube;
|
||||
int sides_dodeca;
|
||||
int sides_icosa;
|
||||
int sides_box6;
|
||||
int sides_box5;
|
||||
};
|
||||
|
||||
struct sFractalIFS
|
||||
{
|
||||
sFractalIFSD doubles;
|
||||
bool absX, absY, absZ;
|
||||
bool foldingMode; // Kaleidoscopic IFS folding mode
|
||||
bool enabled[IFS_VECTOR_COUNT];
|
||||
bool mengerSpongeMode;
|
||||
int foldingCount;
|
||||
CRotationMatrix mainRot;
|
||||
CRotationMatrix rot[IFS_VECTOR_COUNT];
|
||||
};
|
||||
|
||||
struct sFractalMandelboxVary4D
|
||||
{
|
||||
double fold;
|
||||
double minR;
|
||||
double scaleVary;
|
||||
double wadd;
|
||||
double rPower;
|
||||
};
|
||||
|
||||
struct sFractalMandelboxD
|
||||
{
|
||||
double rotationMain[3];
|
||||
double rotation[MANDELBOX_FOLDS][3][3];
|
||||
double colorFactorX;
|
||||
double colorFactorY;
|
||||
double colorFactorZ;
|
||||
double colorFactorR;
|
||||
double colorFactorSp1;
|
||||
double colorFactorSp2;
|
||||
double scale;
|
||||
double foldingLimit;
|
||||
double foldingValue;
|
||||
double foldingSphericalMin;
|
||||
double foldingSphericalFixed;
|
||||
double sharpness;
|
||||
double solid;
|
||||
double melt;
|
||||
CVector3 offset;
|
||||
sFractalMandelboxVary4D vary4D;
|
||||
};
|
||||
|
||||
struct sFractalMandelbox
|
||||
{
|
||||
sFractalMandelboxD doubles;
|
||||
bool rotationsEnabled;
|
||||
CRotationMatrix mainRot;
|
||||
CRotationMatrix rot[MANDELBOX_FOLDS][3];
|
||||
CRotationMatrix rotinv[MANDELBOX_FOLDS][3];
|
||||
};
|
||||
|
||||
struct sFractalPrimitivesD
|
||||
{
|
||||
CVector3 planeCentre;
|
||||
CVector3 planeNormal;
|
||||
CVector3 boxCentre;
|
||||
CVector3 boxSize;
|
||||
CVector3 invertedBoxCentre;
|
||||
CVector3 invertedBoxSize;
|
||||
CVector3 sphereCentre;
|
||||
double sphereRadius;
|
||||
CVector3 invertedSphereCentre;
|
||||
double invertedSphereRadius;
|
||||
double waterHeight;
|
||||
double waterAmplitude;
|
||||
double waterLength;
|
||||
double waterRotation;
|
||||
double waterAnimSpeed;
|
||||
};
|
||||
|
||||
struct sFractalPrimitives
|
||||
{
|
||||
bool planeEnable;
|
||||
bool boxEnable;
|
||||
bool invertedBoxEnable;
|
||||
bool sphereEnable;
|
||||
bool invertedSphereEnable;
|
||||
bool waterEnable;
|
||||
bool onlyPlane;
|
||||
int waterIterations;
|
||||
};
|
||||
|
||||
struct sFractalD
|
||||
{
|
||||
double N;
|
||||
double amin; //fractal limits
|
||||
double amax;
|
||||
double bmin;
|
||||
double bmax;
|
||||
double cmin;
|
||||
double cmax;
|
||||
double constantFactor;
|
||||
double FoldingIntPowZfactor;
|
||||
double FoldingIntPowFoldFactor;
|
||||
double foldingLimit; //paramters of TGlad's folding
|
||||
double foldingValue;
|
||||
double foldingSphericalMin;
|
||||
double foldingSphericalFixed;
|
||||
double detailSize;
|
||||
double power; //power of fractal formula
|
||||
double cadd;
|
||||
double hybridPower[HYBRID_COUNT];
|
||||
#ifdef CLSUPPORT
|
||||
double customParameters[15];
|
||||
double deltaDEStep;
|
||||
#endif
|
||||
CVector3 julia; // Julia constant
|
||||
CVector3 fakeLightsOrbitTrap;
|
||||
sFractalPrimitivesD primitives;
|
||||
};
|
||||
|
||||
struct sFractal
|
||||
{
|
||||
sFractalD doubles;
|
||||
|
||||
// maximum number of iterations
|
||||
int minN; // minimum number of iterations
|
||||
|
||||
bool limits_enabled; // enable limits (intersections)
|
||||
bool iterThresh; //maxiter threshold mode
|
||||
bool analitycDE; //analytic DE mode
|
||||
bool juliaMode; // Julia mode
|
||||
bool tgladFoldingMode; // Tglad's folding mode
|
||||
bool sphericalFoldingMode; // spherical folding mode
|
||||
bool interiorMode;
|
||||
bool hybridCyclic;
|
||||
bool linearDEmode;
|
||||
bool constantDEThreshold;
|
||||
bool useCustomOCLFormula;
|
||||
bool normalCalculationMode;
|
||||
|
||||
enumFractalFormula formula;
|
||||
|
||||
int hybridIters[HYBRID_COUNT];
|
||||
enumFractalFormula hybridFormula[HYBRID_COUNT];
|
||||
|
||||
std::vector<enumFractalFormula> formulaSequence;
|
||||
std::vector<double> hybridPowerSequence;
|
||||
char customOCLFormulaName[100];
|
||||
enumOCLDEMode customOCLFormulaDEMode;
|
||||
|
||||
sFractalIFS IFS;
|
||||
sFractalMandelbox mandelbox;
|
||||
sFractalGeneralizedFoldBox genFoldBox;
|
||||
sFractalPrimitives primitives;
|
||||
|
||||
int frameNo;
|
||||
|
||||
int itersOut;
|
||||
enumObjectType objectOut;
|
||||
|
||||
int fakeLightsMinIter;
|
||||
int fakeLightsMaxIter;
|
||||
};
|
||||
|
||||
template <int Mode> double Compute(CVector3 z, const sFractal &par, int *iter_count = NULL);
|
||||
double CalculateDistance(CVector3 point, sFractal &par, bool *max_iter = NULL);
|
||||
|
||||
#endif /* FRACTAL_H_ */
|
154
src/mandelbulber/fractparams.h
Normal file
154
src/mandelbulber/fractparams.h
Normal file
@ -0,0 +1,154 @@
|
||||
/*********************************************************
|
||||
/ MANDELBULBER
|
||||
/ definition of structures for image and effect
|
||||
/ parameters
|
||||
/
|
||||
/ author: Krzysztof Marczak
|
||||
/ contact: buddhi1980@gmail.com
|
||||
/ licence: GNU GPL v3.0
|
||||
/
|
||||
********************************************************/
|
||||
|
||||
#ifndef FRACTPARAMS_H_
|
||||
#define FRACTPARAMS_H_
|
||||
|
||||
#include "fractal.h"
|
||||
#ifndef MANDELBULBER_EMBEDDED
|
||||
#include "texture.hpp"
|
||||
#endif
|
||||
|
||||
struct sParamRenderD
|
||||
{
|
||||
double zoom; //zoom
|
||||
double DE_factor; //factor for distance estimation steps
|
||||
double resolution; //resolution of image in fractal coordinates
|
||||
double persp; //perspective factor
|
||||
double quality; //DE threshold factor
|
||||
double smoothness;
|
||||
double alpha; //rotation of fractal
|
||||
double beta; //
|
||||
double gamma;
|
||||
double DOFFocus;
|
||||
double DOFRadius;
|
||||
double mainLightAlpha;
|
||||
double mainLightBeta;
|
||||
double auxLightIntensity;
|
||||
double auxLightMaxDist;
|
||||
double auxLightDistributionRadius;
|
||||
double auxLightVisibility;
|
||||
double auxLightPreIntensity[4];
|
||||
double stereoEyeDistance;
|
||||
double viewDistanceMin;
|
||||
double viewDistanceMax;
|
||||
double volumetricLightIntensity[5];
|
||||
double fogDensity;
|
||||
double fogColour1Distance;
|
||||
double fogColour2Distance;
|
||||
double fogDistanceFactor;
|
||||
double colourSaturation;
|
||||
double fastAoTune;
|
||||
double iterFogOpacity;
|
||||
double iterFogOpacityTrim;
|
||||
double fakeLightsIntensity;
|
||||
double fakeLightsVisibility;
|
||||
double fakeLightsVisibilitySize;
|
||||
double shadowConeAngle;
|
||||
double primitivePlaneReflect;
|
||||
double primitiveBoxReflect;
|
||||
double primitiveInvertedBoxReflect;
|
||||
double primitiveSphereReflect;
|
||||
double primitiveInvertedSphereReflect;
|
||||
double primitiveWaterReflect;
|
||||
|
||||
#ifndef MANDELBULBER_EMBEDDED
|
||||
sImageAdjustments imageAdjustments;
|
||||
#endif
|
||||
|
||||
CVector3 vp; //view point
|
||||
CVector3 auxLightPre[4];
|
||||
CVector3 auxLightRandomCenter;
|
||||
};
|
||||
|
||||
struct sParamRender
|
||||
{
|
||||
sParamRenderD doubles;
|
||||
|
||||
sFractal fractal;
|
||||
int image_width; //image width
|
||||
int image_height; //image height
|
||||
int globalIlumQuality; //ambient occlusion quality
|
||||
int reflectionsMax;
|
||||
int coloring_seed; //colouring random seed
|
||||
int auxLightRandomSeed;
|
||||
int auxLightNumber;
|
||||
int SSAOQuality;
|
||||
int startFrame;
|
||||
int endFrame;
|
||||
int framesPerKeyframe;
|
||||
int imageFormat;
|
||||
int noOfTiles;
|
||||
int tileCount;
|
||||
|
||||
int OpenCLEngine;
|
||||
int OpenCLPixelsPerJob;
|
||||
int OpenCLDOFMethod;
|
||||
|
||||
enumPerspectiveType perspectiveType;
|
||||
|
||||
bool shadow; //enable shadows
|
||||
bool global_ilumination; //enable global ilumination
|
||||
bool fastGlobalIllumination; //enable fake global ilumination
|
||||
bool slowShading; //enable fake gradient calculation for shading
|
||||
bool texturedBackground; //enable testured background
|
||||
bool background_as_fulldome;
|
||||
bool recordMode; //path recording mode
|
||||
bool continueRecord; //continue recording mode
|
||||
bool playMode; //play mode
|
||||
bool animMode; //animation mode
|
||||
bool SSAOEnabled;
|
||||
bool DOFEnabled;
|
||||
bool auxLightPreEnabled[4];
|
||||
bool volumetricLightEnabled[5];
|
||||
bool penetratingLights;
|
||||
bool stereoEnabled;
|
||||
bool quiet;
|
||||
bool fishEyeCut;
|
||||
bool fakeLightsEnabled;
|
||||
#ifndef MANDELBULBER_EMBEDDED
|
||||
sImageSwitches imageSwitches;
|
||||
|
||||
sRGB background_color1; //background colour
|
||||
sRGB background_color2;
|
||||
sRGB background_color3;
|
||||
sRGB auxLightPreColour[4];
|
||||
sRGB fogColour1;
|
||||
sRGB fogColour2;
|
||||
sRGB fogColour3;
|
||||
sRGB primitivePlaneColour;
|
||||
sRGB primitiveBoxColour;
|
||||
sRGB primitiveInvertedBoxColour;
|
||||
sRGB primitiveSphereColour;
|
||||
sRGB primitiveInvertedSphereColour;
|
||||
sRGB primitiveWaterColour;
|
||||
sEffectColours effectColours;
|
||||
|
||||
sRGB palette[256];
|
||||
|
||||
char file_destination[1000];
|
||||
char file_envmap[1000];
|
||||
char file_background[1000];
|
||||
char file_lightmap[1000];
|
||||
char file_path[1000];
|
||||
char file_keyframes[1000];
|
||||
|
||||
cTexture *backgroundTexture;
|
||||
cTexture *envmapTexture;
|
||||
cTexture *lightmapTexture;
|
||||
#endif
|
||||
std::vector<enumFractalFormula> formulaSequence;
|
||||
std::vector<double> hybridPowerSequence;
|
||||
|
||||
double settingsVersion;
|
||||
};
|
||||
|
||||
#endif /* FRACTPARAMS_H_ */
|
Loading…
x
Reference in New Issue
Block a user