External mandelbulber
This commit is contained in:
parent
75e5895afa
commit
b580ea1576
27
cmake/Modules/FindMandelbulber.cmake
Normal file
27
cmake/Modules/FindMandelbulber.cmake
Normal file
@ -0,0 +1,27 @@
|
||||
#
|
||||
# make new patch:
|
||||
# diff -EbBw --normal -u src/mandelbulber/ ../freeminer_release/src/mandelbulber/| grep -v "Only in" > util/mandelbulber.patch
|
||||
#
|
||||
|
||||
FIND_PATH(MANDELBULBER_PATH NAMES fractal.h PATHS ${PROJECT_SOURCE_DIR}/mandelbulber NO_DEFAULT_PATH)
|
||||
|
||||
IF(MANDELBULBER_PATH)
|
||||
SET(MANDELBULBER_FOUND 1)
|
||||
ELSE(MANDELBULBER_PATH)
|
||||
IF(ENABLE_MANDELBULBER)
|
||||
MESSAGE(STATUS "Checkout mandelbulber to ${PROJECT_SOURCE_DIR}/mandelbulber")
|
||||
EXECUTE_PROCESS(COMMAND "svn" "checkout" "-q" "http://mandelbulber.googlecode.com/svn/trunk/src" "${PROJECT_SOURCE_DIR}/mandelbulber")
|
||||
MESSAGE(STATUS "Patching mandelbulber")
|
||||
EXECUTE_PROCESS(COMMAND "patch" "--directory=${PROJECT_SOURCE_DIR}/mandelbulber/" "-i${CMAKE_SOURCE_DIR}/util/mandelbulber.patch")
|
||||
ENDIF(ENABLE_MANDELBULBER)
|
||||
ENDIF(MANDELBULBER_PATH)
|
||||
|
||||
FIND_PATH(MANDELBULBER_PATH NAMES fractal.h PATHS ${PROJECT_SOURCE_DIR}/mandelbulber NO_DEFAULT_PATH)
|
||||
IF(MANDELBULBER_PATH)
|
||||
SET(MANDELBULBER_FOUND 1)
|
||||
ENDIF(MANDELBULBER_PATH)
|
||||
|
||||
IF(MANDELBULBER_FOUND)
|
||||
SET(USE_MANDELBULBER 1)
|
||||
MESSAGE(STATUS "Found mandelbulber source in ${MANDELBULBER_PATH}")
|
||||
ENDIF(MANDELBULBER_FOUND)
|
@ -225,6 +225,10 @@ if(ENABLE_LEVELDB)
|
||||
endif(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
|
||||
endif(ENABLE_LEVELDB)
|
||||
|
||||
|
||||
set(USE_MANDELBULBER 0)
|
||||
find_package(Mandelbulber)
|
||||
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
|
||||
"${PROJECT_BINARY_DIR}/cmake_config.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define CMAKE_STATIC_SHAREDIR "@SHAREDIR@"
|
||||
#define CMAKE_USE_LEVELDB @USE_LEVELDB@
|
||||
#define CMAKE_USE_LUAJIT @USE_LUAJIT@
|
||||
#define CMAKE_USE_MANDELBULBER @USE_MANDELBULBER@
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define CMAKE_BUILD_TYPE "Release"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define STATIC_SHAREDIR ""
|
||||
#define USE_LEVELDB 0
|
||||
#define USE_LUAJIT 0
|
||||
#define USE_MANDELBULBER 0
|
||||
|
||||
#ifdef USE_CMAKE_CONFIG_H
|
||||
#include "cmake_config.h"
|
||||
@ -36,6 +37,8 @@
|
||||
#define USE_LEVELDB CMAKE_USE_LEVELDB
|
||||
#undef USE_LUAJIT
|
||||
#define USE_LUAJIT CMAKE_USE_LUAJIT
|
||||
#undef USE_MANDELBULBER
|
||||
#define USE_MANDELBULBER CMAKE_USE_MANDELBULBER
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,218 +0,0 @@
|
||||
/*********************************************************
|
||||
/ 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;
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/*********************************************************
|
||||
/ 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_ */
|
@ -1,57 +0,0 @@
|
||||
/*********************************************************
|
||||
/ 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 "../util/mathconstants.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;
|
||||
};
|
||||
|
||||
struct sSortZ
|
||||
{
|
||||
float 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 *dane, int l, int 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_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,296 +0,0 @@
|
||||
/*********************************************************
|
||||
/ 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"
|
||||
//#include "fractparams.h"
|
||||
#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;
|
||||
};
|
||||
|
||||
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];
|
||||
#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_ */
|
@ -1,149 +0,0 @@
|
||||
/*********************************************************
|
||||
/ 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"
|
||||
//#include "texture.hpp"
|
||||
|
||||
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;
|
||||
|
||||
// sImageAdjustments imageAdjustments;
|
||||
|
||||
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;
|
||||
|
||||
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 textured_background; //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;
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
std::vector<enumFractalFormula> formulaSequence;
|
||||
std::vector<double> hybridPowerSequence;
|
||||
|
||||
double settingsVersion;
|
||||
};
|
||||
|
||||
#endif /* FRACTPARAMS_H_ */
|
@ -32,8 +32,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "biome.h"
|
||||
|
||||
// can use ported lib from http://mandelbulber.googlecode.com/svn/trunk/src
|
||||
//#include "mandelbulber/fractal.h"
|
||||
#ifdef FRACTAL_H_
|
||||
#ifdef USE_MANDELBULBER
|
||||
#include "mandelbulber/algebra.cpp"
|
||||
#include "mandelbulber/fractal.cpp"
|
||||
#endif
|
||||
|
||||
@ -187,7 +187,7 @@ MapgenMath::MapgenMath(int mapgenid, MapgenMathParams *params_, EmergeManager *e
|
||||
}
|
||||
|
||||
|
||||
#ifdef FRACTAL_H_
|
||||
#ifdef USE_MANDELBULBER
|
||||
sFractal & par = mg_params->par;
|
||||
//par.minN = params.get("minN", 1).asInt();
|
||||
|
||||
@ -426,7 +426,7 @@ int MapgenMath::generateTerrain() {
|
||||
//errorstream << Json::StyledWriter().write( mg_params->params ).c_str()<< std::endl;
|
||||
//errorstream << " iterations="<<iterations<< " scale="<<scale <<" invert="<<invert<< std::endl;
|
||||
|
||||
#ifdef FRACTAL_H_
|
||||
#ifdef USE_MANDELBULBER
|
||||
v3f vec0(node_min.X, node_min.Y, node_min.Z);
|
||||
vec0 = (vec0 - center) * scale;
|
||||
/*
|
||||
@ -447,7 +447,7 @@ int MapgenMath::generateTerrain() {
|
||||
for (s16 y = node_min.Y; y <= node_max.Y; y++) {
|
||||
v3f vec = (v3f(x, y, z) - center) * scale ;
|
||||
|
||||
#ifdef FRACTAL_H_
|
||||
#ifdef USE_MANDELBULBER
|
||||
if (!internal)
|
||||
d = Compute<normal>(CVector3(vec.X, vec.Y, vec.Z), mg_params->par);
|
||||
#endif
|
||||
|
@ -20,10 +20,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#ifndef MAPGEN_MATH_HEADER
|
||||
#define MAPGEN_MATH_HEADER
|
||||
|
||||
#include "config.h"
|
||||
#include "mapgen.h"
|
||||
#include "mapgen_v7.h"
|
||||
#include "json/json.h"
|
||||
|
||||
#ifdef USE_MANDELBULBER
|
||||
#include "util/mathconstants.h"
|
||||
//#include "mandelbulber/algebra.cpp"
|
||||
#include "mandelbulber/fractal.h"
|
||||
#endif
|
||||
|
||||
struct MapgenMathParams : public MapgenV7Params {
|
||||
|
||||
@ -31,7 +37,7 @@ struct MapgenMathParams : public MapgenV7Params {
|
||||
|
||||
Json::Value params;
|
||||
|
||||
#ifdef FRACTAL_H_
|
||||
#ifdef USE_MANDELBULBER
|
||||
sFractal par;
|
||||
enumCalculationMode mode;
|
||||
#endif
|
||||
|
99
util/mandelbulber.patch
Normal file
99
util/mandelbulber.patch
Normal file
@ -0,0 +1,99 @@
|
||||
diff -EbBw --normal -u src/mandelbulber/fractal.cpp ../freeminer_release/src/mandelbulber/fractal.cpp
|
||||
--- src/mandelbulber/fractal.cpp 2013-12-29 04:41:45.000000000 +0400
|
||||
+++ ../freeminer_release/src/mandelbulber/fractal.cpp 2013-12-29 03:16:40.000000000 +0400
|
||||
@@ -9,9 +9,11 @@
|
||||
/
|
||||
********************************************************/
|
||||
|
||||
+/*
|
||||
#include "Render3D.h"
|
||||
#include "interface.h"
|
||||
#include "primitives.h"
|
||||
+*/
|
||||
#include <stdlib.h>
|
||||
|
||||
unsigned int MixNumbers(double a, double b, double c)
|
||||
@@ -1191,6 +1193,7 @@
|
||||
}
|
||||
|
||||
//************ return values *****************
|
||||
+/*
|
||||
N_counter += L + 1;
|
||||
Loop_counter++;
|
||||
|
||||
@@ -1198,6 +1201,7 @@
|
||||
histogram[L]++;
|
||||
else
|
||||
histogram[63]++;
|
||||
+*/
|
||||
|
||||
if (iter_count != NULL)
|
||||
*iter_count = L;
|
||||
@@ -1240,6 +1244,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#if 0
|
||||
//******************* Calculate distance *******************8
|
||||
|
||||
double CalculateDistance(CVector3 point, sFractal ¶ms, bool *max_iter)
|
||||
@@ -1446,6 +1451,7 @@
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
+#endif
|
||||
|
||||
// force template instantiation
|
||||
template double Compute<normal>(CVector3, const sFractal&, int*);
|
||||
diff -EbBw --normal -u src/mandelbulber/fractal.h ../freeminer_release/src/mandelbulber/fractal.h
|
||||
--- src/mandelbulber/fractal.h 2013-12-29 04:41:45.000000000 +0400
|
||||
+++ ../freeminer_release/src/mandelbulber/fractal.h 2013-12-29 03:14:11.000000000 +0400
|
||||
@@ -14,7 +14,9 @@
|
||||
|
||||
#include <vector>
|
||||
#include "common_math.h"
|
||||
+/*
|
||||
#include "fractparams.h"
|
||||
+*/
|
||||
#include <stddef.h>
|
||||
#include <string>
|
||||
|
||||
diff -EbBw --normal -u src/mandelbulber/fractparams.h ../freeminer_release/src/mandelbulber/fractparams.h
|
||||
--- src/mandelbulber/fractparams.h 2013-12-29 04:41:45.000000000 +0400
|
||||
+++ ../freeminer_release/src/mandelbulber/fractparams.h 2013-12-29 03:13:34.000000000 +0400
|
||||
@@ -13,7 +13,9 @@
|
||||
#define FRACTPARAMS_H_
|
||||
|
||||
#include "fractal.h"
|
||||
+/*
|
||||
#include "texture.hpp"
|
||||
+*/
|
||||
|
||||
struct sParamRenderD
|
||||
{
|
||||
@@ -58,7 +60,9 @@
|
||||
double primitiveInvertedSphereReflect;
|
||||
double primitiveWaterReflect;
|
||||
|
||||
+/*
|
||||
sImageAdjustments imageAdjustments;
|
||||
+*/
|
||||
|
||||
CVector3 vp; //view point
|
||||
CVector3 auxLightPre[4];
|
||||
@@ -109,6 +113,7 @@
|
||||
bool quiet;
|
||||
bool fishEyeCut;
|
||||
bool fakeLightsEnabled;
|
||||
+/*
|
||||
sImageSwitches imageSwitches;
|
||||
|
||||
sRGB background_color1; //background colour
|
||||
@@ -138,6 +143,7 @@
|
||||
cTexture *backgroundTexture;
|
||||
cTexture *envmapTexture;
|
||||
cTexture *lightmapTexture;
|
||||
+*/
|
||||
std::vector<enumFractalFormula> formulaSequence;
|
||||
std::vector<double> hybridPowerSequence;
|
||||
|
Loading…
x
Reference in New Issue
Block a user