├── .gitignore ├── Fragmentarium-Source ├── Bugs.txt ├── Build - Linux │ ├── build.sh │ └── installDependencies.sh ├── Build - Mac OS X │ └── BuildProcedureOSX.txt ├── Build - Qt Creator │ └── Fragmentarium-QtCreator.pro ├── Build - Windows │ ├── BuildProcedure.txt │ ├── EULA.txt │ ├── Fragmentarium.ico │ ├── Fragmentarium.rc │ ├── Fragmentarium.sln │ ├── Fragmentarium.vcproj │ ├── FragmentariumDoc.ico │ ├── License.txt │ ├── Microsoft.VC80.CRT.manifest │ ├── Microsoft.VC80.CRT │ │ ├── Microsoft.VC80.CRT.manifest │ │ ├── msvcm80.dll │ │ ├── msvcp80.dll │ │ └── msvcr80.dll │ ├── Microsoft.VC90.CRT │ │ ├── Microsoft.VC90.CRT.manifest │ │ ├── msvcm90.dll │ │ ├── msvcp90.dll │ │ └── msvcr90.dll │ ├── ReadMe.txt │ ├── createDeploy.Bat │ └── resource.h ├── Changelog.txt ├── Examples │ ├── 2D Systems │ │ ├── BurningShip.frag │ │ ├── DomainDistortion2.frag │ │ ├── Droste.frag │ │ ├── DrosteGrid.frag │ │ ├── Ducks.frag │ │ ├── Game of Life.frag │ │ ├── GraphPlotter.frag │ │ ├── Kali.frag │ │ ├── Mandelbrot-AverageColoring.frag │ │ ├── Mandelbrot-DE.frag │ │ ├── Mandelbrot.frag │ │ ├── MandelbrotCheckers.frag │ │ ├── MandelbrotOrbitTrap.frag │ │ ├── PenroseTiles.frag │ │ ├── Reaction-Diffusion.frag │ │ └── Thorn.frag │ ├── Experimental │ │ ├── IFS.frag │ │ ├── Knot.frag │ │ ├── LiftedDomainColoring.frag │ │ ├── LiftedDomainColoring3D.frag │ │ ├── Mandelbrot-Progressive.frag │ │ ├── Mixed.frag │ │ ├── Mobius.frag │ │ ├── Noise.frag │ │ ├── OctahedronOT.frag │ │ ├── PseudoKleinian-Progressive-DOF.frag │ │ ├── QuaternionMandelbrot4D.frag │ │ ├── Raytracingtestfrag.frag │ │ ├── SphereSponge.frag │ │ ├── Spudsville2.frag │ │ ├── Stereographic4DJulia.frag │ │ ├── StereographicQuaternionJulia.frag │ │ ├── Terrain.frag │ │ ├── Tetrahedron-Alternative.frag │ │ ├── TextureTest.frag │ │ ├── TriPlanarTexturing.frag │ │ └── iqPath4fragmentarium.frag │ ├── Historical 3D Fractals │ │ ├── Mandelbox.frag │ │ ├── Mandelbulb.frag │ │ └── QuaternionJulia.frag │ ├── Include │ │ ├── 2D-HP.frag │ │ ├── 2D.frag │ │ ├── 2DJulia.frag │ │ ├── 3D.frag │ │ ├── Ashima-Noise.frag │ │ ├── Brute-Raytracer.frag │ │ ├── Brute3D.frag │ │ ├── BufferShader.frag │ │ ├── BufferShaderIFS.frag │ │ ├── BufferShaderRD.frag │ │ ├── BufferShaderX.frag │ │ ├── Classic-Noise.frag │ │ ├── Complex.frag │ │ ├── DE-Raytracer-Slicer.frag │ │ ├── DE-Raytracer-v0.9.1.frag │ │ ├── DE-Raytracer-v0.9.10.frag │ │ ├── DE-Raytracer.frag │ │ ├── DE-RaytracerX.frag │ │ ├── DepthBufferShader.frag │ │ ├── Ditch-River-License.txt │ │ ├── Ditch-River.ibl │ │ ├── Ditch-River_2k.hdr │ │ ├── Ditch-River_Env.hdr │ │ ├── EmulatedDouble.frag │ │ ├── Fast-Raytracer.frag │ │ ├── IBL-Pathtracer.frag │ │ ├── IBL-Raytracer.frag │ │ ├── MathUtils.frag │ │ ├── Path-Raytracer.frag │ │ ├── Progressive2D.frag │ │ ├── Progressive2DJulia.frag │ │ ├── QuilezLib.frag │ │ ├── Shadertoy.frag │ │ ├── Sky-Pathtracer.frag │ │ ├── Soft-Raytracer.frag │ │ ├── Subblue-Raytracer.frag │ │ ├── Sunsky.frag │ │ ├── ZBuffer3D.frag │ │ ├── ZBufferShader.frag │ │ ├── texture.jpg │ │ ├── texture2.jpg │ │ └── vigga.jpg │ ├── Kaleidoscopic IFS │ │ ├── Dodecahedron.frag │ │ ├── Icosahedron.frag │ │ ├── Menger.frag │ │ ├── NewMenger.frag │ │ ├── Octahedron.frag │ │ └── Tetrahedron.frag │ ├── Kali's Creations │ │ ├── Kalibox.frag │ │ ├── LivingKIFS.frag │ │ ├── LivingKIFS.txt │ │ ├── RotJulia.frag │ │ ├── Treebroccoli.frag │ │ └── Xray_skifs.frag │ ├── Knighty Collection │ │ ├── Doyle-Spirals.frag │ │ ├── Fold and Cut Polyhedra - Original.frag │ │ ├── Fold_and_cut_polyhedra_examples │ │ │ ├── Icosahedral_polyhedra02.frag │ │ │ ├── Icosahedral_polyhedra_iterated_10.frag │ │ │ ├── Icosahedral_polyhedra_iterated_11.frag │ │ │ ├── Icosahedral_polyhedra_iterated_20.frag │ │ │ ├── menger_iterated_20.frag │ │ │ └── octahedral_polyhedra02.frag │ │ ├── Hyperbolic-tesselations-named │ │ │ ├── hyperbolic-tesselation-3-5-3-colored-named-00.frag │ │ │ ├── hyperbolic-tesselation-5-3-n-colored-named-00.frag │ │ │ ├── hyperbolic-tesselation-bifurcating-5-3-3-colored-named-00.frag │ │ │ ├── hyperbolic-tesselation-cyclic-m-3-n-3-colored-named-00.frag │ │ │ └── reference.txt │ │ ├── Icosahedral_polyhedra_iterated_11.frag │ │ ├── Icosahedral_polyhedra_iterated_20.frag │ │ ├── Knot.frag │ │ ├── Koch01.frag │ │ ├── Mandalabeth-generic-with-jacobian │ │ │ ├── Mandalabeth-M3-jacobian.frag │ │ │ ├── Mandalabeth-M4-jacobian.frag │ │ │ └── Mandalabeth-M5-jacobian.frag │ │ ├── MandelbrotHeightfield.frag │ │ ├── Menger_iterated_20.frag │ │ ├── NewtonHeightfield.frag │ │ ├── PseudoKleinian.frag │ │ ├── PseudoKleinianMenger.frag │ │ ├── Quadray │ │ │ ├── quadray01-07.frag │ │ │ ├── quadray01-jacobian-02.frag │ │ │ └── quadray04-03forV0.8.frag │ │ ├── algebraic07.frag │ │ ├── hyperbolic-tesselation-2Din3D-colored-02.frag │ │ ├── mdifs.frag │ │ ├── my_2D.frag │ │ ├── poincare-disc30-circle_limit_6.frag │ │ ├── polychora-special.frag │ │ ├── polychora-special02.frag │ │ ├── polychora03.frag │ │ ├── polychora06.frag │ │ └── triangle-tess-ess-01.frag │ ├── Theory │ │ ├── Convolution.frag │ │ ├── Mandelbox - Dual Numbers DE - Slicer.frag │ │ ├── Mandelbox - Dual Numbers DE.frag │ │ ├── Mandelbrot - Emulated Doubles.frag │ │ └── Mandelbulb-Slicer.frag │ └── Tutorials │ │ ├── 00 - Simple 2D system.frag │ │ ├── 01 - Simple 2D Escape Time Fractal.frag │ │ ├── 02 - User Variables and Presets.frag │ │ ├── 03 - Dynamic Systems.frag │ │ ├── 04 - Textures.frag │ │ ├── 10 - Simple Distance Estimated 3D system.frag │ │ ├── 11 - Simple Distance Estimated 3D fractal.frag │ │ ├── 12 - Faster raytracing of 3D fractals.frag │ │ ├── 20 - Progressive 2D.frag │ │ ├── 21 - Progressive 2D Escape Time Fractal.frag │ │ ├── 22 - Progressive 3D Rendering.frag │ │ ├── 23 - Working with the back buffer.frag │ │ ├── 24 - Pure 3D.frag │ │ ├── 25 - Image Based Lighting.frag │ │ └── 26 - 3D fractals without a DE.frag ├── Fragmentarium.qrc ├── Fragmentarium │ ├── GUI │ │ ├── CameraControl.cpp │ │ ├── CameraControl.h │ │ ├── DisplayWidget.cpp │ │ ├── DisplayWidget.h │ │ ├── FileManager.cpp │ │ ├── FileManager.h │ │ ├── MainWindow.cpp │ │ ├── MainWindow.h │ │ ├── OutputDialog.cpp │ │ ├── OutputDialog.h │ │ ├── VariableEditor.cpp │ │ ├── VariableEditor.h │ │ ├── VariableWidget.cpp │ │ └── VariableWidget.h │ ├── Main.cpp │ └── Parser │ │ ├── Preprocessor.cpp │ │ └── Preprocessor.h ├── Icons │ ├── agt_internet.png │ ├── copy.png │ ├── cut.png │ ├── documentinfo.png │ ├── exit.png │ ├── fileclose.png │ ├── fileicons │ │ ├── Fragmentarium-16.png │ │ ├── Fragmentarium-256.png │ │ ├── Fragmentarium.icns │ │ ├── Fragmentarium.ico │ │ ├── FragmentariumDoc-256.png │ │ ├── FragmentariumDoc.icns │ │ ├── FragmentariumDoc.ico │ │ ├── icon.pdn │ │ └── icon2.pdn │ ├── filesaveas.png │ ├── folder.png │ ├── fragmentarium.png │ ├── mail_new.png │ ├── new.png │ ├── open.png │ ├── padlocka.png │ ├── padlockb.png │ ├── paste.png │ ├── player_eject.png │ ├── player_pause.png │ ├── player_play.png │ ├── player_rew.png │ ├── player_stop.png │ ├── render.png │ ├── save.png │ └── saveas.png ├── LICENSE.GPL3 ├── LICENSE.LGPL ├── LICENSE.README ├── Misc │ ├── about.html │ ├── control.html │ ├── icon.jpg │ └── splash.png ├── Notes.txt ├── Roadmap.txt ├── SyntopiaCore │ ├── Exceptions │ │ └── Exception.h │ ├── Logging │ │ ├── ListWidgetLogger.cpp │ │ ├── ListWidgetLogger.h │ │ ├── Logging.cpp │ │ └── Logging.h │ ├── Math │ │ ├── Matrix4.cpp │ │ ├── Matrix4.h │ │ ├── Random.cpp │ │ ├── Random.h │ │ ├── Vector3.cpp │ │ ├── Vector3.h │ │ └── Vector4.h │ └── Misc │ │ ├── ColorUtils.cpp │ │ ├── ColorUtils.h │ │ ├── MiniParser.cpp │ │ ├── MiniParser.h │ │ ├── Misc.cpp │ │ ├── Misc.h │ │ ├── Persistence.cpp │ │ ├── Persistence.h │ │ ├── Version.cpp │ │ └── Version.h └── ThirdPartyCode │ ├── MersenneTwister │ └── MersenneTwister.h │ ├── glextensions.cpp │ ├── glextensions.h │ ├── hdrloader.cpp │ └── hdrloader.h ├── README.md └── fragmentarium-splash.pdn /.gitignore: -------------------------------------------------------------------------------- 1 | Fragmentarium-Source/build 2 | Fragmentarium-Source/Fragmentarium.app 3 | Fragmentarium-Source/Fragmentarium.pro 4 | Fragmentarium-Source/Fragmentarium.xcodeproj 5 | Fragmentarium-Source/Info.plist 6 | 7 | /Fragmentarium-Source/Build - Windows/tmp 8 | /Fragmentarium-Source/Build - Windows/Fragmentarium 9 | /Fragmentarium-Source/Build - Windows/release 10 | /build-Fragmentarium-QtCreator-Desktop_Qt_5_3_MSVC2013_32bit-Debug 11 | /build-Fragmentarium-QtCreator-64_Opengl-Release 12 | /build-Fragmentarium-QtCreator-64_Opengl-Debug 13 | /Fragmentarium-Source/build-Fragmentarium-QtCreator-64_Opengl-Release 14 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Bugs.txt: -------------------------------------------------------------------------------- 1 | Bug List: 2 | --------- 3 | Priority 0-5, 5 is worst: 4 | 5 | [3] Cannot lock variables in BufferShader 6 | [1] Bug: padlock icon vsize grows! 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Linux/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd .. 4 | qmake-qt4 -project -after "CONFIG+=opengl" -after "QT+=xml opengl script" 5 | qmake-qt4 6 | make 7 | 8 | cd "Build - Linux" 9 | 10 | rm -rf Fragmentarium 11 | mkdir "Fragmentarium" 12 | mkdir "Fragmentarium/Examples" 13 | cp -r ../Examples/* "Fragmentarium/Examples" 14 | mkdir "Fragmentarium/Misc" 15 | cp -r ../Misc/* "Fragmentarium/Misc" 16 | cp ../Fragmentarium-Source "Fragmentarium/Fragmentarium" 17 | 18 | cd "Fragmentarium" 19 | rm -rf `find . -type d -name .svn` 20 | cd .. 21 | 22 | 23 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Linux/installDependencies.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install build-essential libx11-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libxext-dev libqt4-opengl-dev -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Mac OS X/BuildProcedureOSX.txt: -------------------------------------------------------------------------------- 1 | Prerequisites 2 | ============= 3 | 4 | First install Qt Open Source for Mac: 5 | http://qt-project.org/downloads 6 | 7 | Download 8 | ======== 9 | 10 | Now check out the source: 11 | 12 | git clone https://github.com/Syntopia/Fragmentarium.git 13 | 14 | and type the following: 15 | 16 | cd Fragmentarium/Fragmentarium-Source/ 17 | qmake -project -after "QT += widgets opengl" 18 | qmake -spec macx-xcode Fragmentarium-Source.pro 19 | 20 | Now an XCode project file has been created. Open this file in XCode. 21 | It should now be possible to compile and run Fragmentarium from XCode. 22 | 23 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Qt Creator/Fragmentarium-QtCreator.pro: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Automatically generated by qmake (2.01a) ti 17. maj 23:39:14 2011 3 | ###################################################################### 4 | 5 | TEMPLATE = app 6 | TARGET = fragmentarium 7 | DEPENDPATH += .. \ 8 | ../Fragmentarium \ 9 | ../ThirdPartyCode \ 10 | ../Fragmentarium/GUI \ 11 | ../Fragmentarium/Parser \ 12 | ../SyntopiaCore/Exceptions \ 13 | ../SyntopiaCore/Logging \ 14 | ../SyntopiaCore/Math \ 15 | ../SyntopiaCore/Misc \ 16 | ../ThirdPartyCode/MersenneTwister 17 | INCLUDEPATH += .. 18 | 19 | # Input 20 | HEADERS += ../ThirdPartyCode/glextensions.h \ 21 | ../Fragmentarium/GUI/CameraControl.h \ 22 | ../Fragmentarium/GUI/DisplayWidget.h \ 23 | ../Fragmentarium/GUI/MainWindow.h \ 24 | ../Fragmentarium/GUI/VariableEditor.h \ 25 | ../Fragmentarium/GUI/VariableWidget.h \ 26 | ../Fragmentarium/Parser/Preprocessor.h \ 27 | ../SyntopiaCore/Exceptions/Exception.h \ 28 | ../SyntopiaCore/Logging/ListWidgetLogger.h \ 29 | ../SyntopiaCore/Logging/Logging.h \ 30 | ../SyntopiaCore/Math/Matrix4.h \ 31 | ../SyntopiaCore/Math/Random.h \ 32 | ../SyntopiaCore/Math/Vector3.h \ 33 | ../SyntopiaCore/Misc/ColorUtils.h \ 34 | ../SyntopiaCore/Misc/MiniParser.h \ 35 | ../SyntopiaCore/Misc/Misc.h \ 36 | ../SyntopiaCore/Misc/Persistence.h \ 37 | ../SyntopiaCore/Misc/Version.h \ 38 | ../ThirdPartyCode/MersenneTwister/MersenneTwister.h \ 39 | ../SyntopiaCore/Math/Vector4.h \ 40 | ../Fragmentarium/GUI/OutputDialog.h \ 41 | ../Fragmentarium/GUI/FileManager.h \ 42 | ../ThirdPartyCode/hdrloader.h 43 | SOURCES += ../Fragmentarium/Main.cpp \ 44 | ../ThirdPartyCode/glextensions.cpp \ 45 | ../Fragmentarium/GUI/CameraControl.cpp \ 46 | ../Fragmentarium/GUI/DisplayWidget.cpp \ 47 | ../Fragmentarium/GUI/MainWindow.cpp \ 48 | ../Fragmentarium/GUI/VariableEditor.cpp \ 49 | ../Fragmentarium/GUI/VariableWidget.cpp \ 50 | ../Fragmentarium/Parser/Preprocessor.cpp \ 51 | ../SyntopiaCore/Logging/ListWidgetLogger.cpp \ 52 | ../SyntopiaCore/Logging/Logging.cpp \ 53 | ../SyntopiaCore/Math/Matrix4.cpp \ 54 | ../SyntopiaCore/Math/Random.cpp \ 55 | ../SyntopiaCore/Math/Vector3.cpp \ 56 | ../SyntopiaCore/Misc/ColorUtils.cpp \ 57 | ../SyntopiaCore/Misc/MiniParser.cpp \ 58 | ../SyntopiaCore/Misc/Misc.cpp \ 59 | ../SyntopiaCore/Misc/Persistence.cpp \ 60 | ../SyntopiaCore/Misc/Version.cpp \ 61 | ../Fragmentarium/GUI/OutputDialog.cpp \ 62 | ../Fragmentarium/GUI/FileManager.cpp \ 63 | ../ThirdPartyCode/hdrloader.cpp 64 | RESOURCES += ../Fragmentarium.qrc 65 | CONFIG+=opengl widgets 66 | QT+=xml opengl script widgets 67 | 68 | OTHER_FILES += \ 69 | ../notes.txt \ 70 | ../changelog.txt \ 71 | ../Bugs.txt \ 72 | ../roadmap.txt 73 | 74 | 75 | win32-msvc2008|win32-msvc2010 { 76 | # Enable Level 4 compiler warnings 77 | QMAKE_CXXFLAGS_WARN_ON -= -W3 78 | QMAKE_CXXFLAGS_WARN_ON += -W4 79 | # Hush some known Qt warnings 80 | QMAKE_CXXFLAGS += -wd4127 -wd4512 -wd4189 81 | } 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/BuildProcedure.txt: -------------------------------------------------------------------------------- 1 | Build Procedure: 2 | 3 | - Update Version object in MainWindow.cpp 4 | - 5 | 6 | Windows: 7 | - Change to 'Release'. Build in VS 2008. 8 | - Check dependencies in Process Explorer - update Build\Windows\copyWin32Files.bat to reflect this. 9 | - Run copyWin32Files.bat 10 | - Zip the content of 'Fragmentarium' and name the files after the following template: "Fragmentarium-Windows_Binary_v0.8.0.zip" 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/EULA.txt: -------------------------------------------------------------------------------- 1 | END USER LICENSE AGREEMENT. 2 | 3 | Version 1.1. 4 | 5 | This software is provided with NO WARRANTY. 6 | 7 | That's right: not even if the software is loaded with viruses or crashes your hard-drive, can the author be held responsible. I would never intentionally include malware in the distribution, but I do not control the servers hosting the software, and will not make any guarantees. 8 | 9 | If you do not like this, do not run the software. 10 | 11 | If you are okay with this, feel free to run the software on any number of computers and use it any way you want to. 12 | 13 | If you do modify or redistribute this software make sure you respect the included GPL license (license.txt). 14 | 15 | If you found that this EULA did not exactly ease your mind and you are worried about running this software, here is a few general suggestions: 16 | (1) Run the software in a sandboxed environment. (VM-Ware Player provides excellent and free virtualization) 17 | (2) Do not run as administrator, but as a non-privileged user. 18 | (3) Compile the sources yourself. 19 | (4) Check the MD5/SHA1 checksums to see if the files have been tampered with. 20 | (5) Search Google to see if anyone has experienced problems with the software. 21 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Fragmentarium.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Build - Windows/Fragmentarium.ico -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Fragmentarium.rc: -------------------------------------------------------------------------------- 1 | #include "resource.h" 2 | 3 | IDI_ICON1 ICON "Fragmentarium.ico" 4 | IDI_ICON2 ICON "FragmentariumDoc.ico" 5 | 6 | // Version 7 | 8 | VS_VERSION_INFO VERSIONINFO 9 | FILEVERSION 0,9,5,0 10 | PRODUCTVERSION 0,9,5,0 11 | FILEFLAGSMASK 0x17L 12 | #ifdef _DEBUG 13 | FILEFLAGS 0x1L 14 | #else 15 | FILEFLAGS 0x0L 16 | #endif 17 | FILEOS 0x4L 18 | FILETYPE 0x1L 19 | FILESUBTYPE 0x0L 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "080004b0" 24 | BEGIN 25 | VALUE "CompanyName", "Syntopia" 26 | VALUE "FileDescription", "Fragmentarium Main Executable" 27 | VALUE "FileVersion", "0, 0, 0, 1" 28 | VALUE "InternalName", "Fragmentarium" 29 | VALUE "LegalCopyright", "Copyright (C) 2010-2011 Syntopia" 30 | VALUE "LegalTrademarks", "Fragmentarium" 31 | VALUE "OriginalFilename", "Fragmentarium.exe" 32 | VALUE "ProductName", "Fragmentarium" 33 | VALUE "ProductVersion", "0, 0, 0, 1" 34 | END 35 | END 36 | BLOCK "VarFileInfo" 37 | BEGIN 38 | VALUE "Translation", 0x409, 1200 39 | END 40 | END 41 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Fragmentarium.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C++ Express 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fragmentarium", "Fragmentarium.vcproj", "{E41D8CD9-8F00-3204-A980-0998ECF8427E}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {E41D8CD9-8F00-3204-A980-0998ECF8427E}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {E41D8CD9-8F00-3204-A980-0998ECF8427E}.Debug|Win32.Build.0 = Debug|Win32 14 | {E41D8CD9-8F00-3204-A980-0998ECF8427E}.Release|Win32.ActiveCfg = Release|Win32 15 | {E41D8CD9-8F00-3204-A980-0998ECF8427E}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/FragmentariumDoc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Build - Windows/FragmentariumDoc.ico -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC80.CRT.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC80.CRT/msvcm80.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Build - Windows/Microsoft.VC80.CRT/msvcm80.dll -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC80.CRT/msvcp80.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Build - Windows/Microsoft.VC80.CRT/msvcp80.dll -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC80.CRT/msvcr80.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Build - Windows/Microsoft.VC80.CRT/msvcr80.dll -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC90.CRT/msvcm90.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Build - Windows/Microsoft.VC90.CRT/msvcm90.dll -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC90.CRT/msvcp90.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Build - Windows/Microsoft.VC90.CRT/msvcp90.dll -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/Microsoft.VC90.CRT/msvcr90.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Build - Windows/Microsoft.VC90.CRT/msvcr90.dll -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/ReadMe.txt: -------------------------------------------------------------------------------- 1 | If the executable complains about missing libraries such as msvcr90.dll, msvcp90.dll or msvcm90.dll, you will need to install the 2 | Microsoft Visual C++ C Runtime Libraries: 3 | 4 | Microsoft Visual C++ 2008 Redistributable Package (x86): 5 | http://www.microsoft.com/downloads/details.aspx?FamilyID=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/createDeploy.Bat: -------------------------------------------------------------------------------- 1 | rmdir /S /Q "Fragmentarium" 2 | mkdir "Fragmentarium" 3 | cd Fragmentarium 4 | mkdir imageformats 5 | cd .. 6 | xcopy ..\Examples\*.* "Fragmentarium"\Examples\ /E 7 | rmdir /S /Q "Fragmentarium"\Examples\DontDeploy 8 | rem rmdir /S /Q "Fragmentarium"\Examples\Theory 9 | xcopy ..\Misc\*.* "Fragmentarium"\Misc\ /E 10 | xcopy Microsoft.VC90.CRT\*.* "Fragmentarium"\Microsoft.VC90.CRT\ /E 11 | copy Release\Fragmentarium.exe "Fragmentarium"\ 12 | copy %QT4DIR%\bin\QtOpenGl4.dll "Fragmentarium"\ 13 | copy %QT4DIR%\bin\QtGUI4.dll "Fragmentarium"\ 14 | copy %QT4DIR%\bin\QtCore4.dll "Fragmentarium"\ 15 | copy %QT4DIR%\bin\QtXml4.dll "Fragmentarium"\ 16 | copy %QT4DIR%\bin\QtScript4.dll "Fragmentarium"\ 17 | copy %QT4DIR%\plugins\imageformats\qjpeg4.dll "Fragmentarium\imageformats" 18 | copy %QT4DIR%\plugins\imageformats\qtiff4.dll "Fragmentarium\imageformats" 19 | 20 | rem copy *.manifest "Fragmentarium"\ 21 | copy EULA.txt "Fragmentarium"\ 22 | copy License.txt "Fragmentarium"\ 23 | copy ReadMe.txt "Fragmentarium"\ 24 | @rem copy C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700\msvcr80.dll "Fragmentarium"\ 25 | @rem copy C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700\msvcp80.dll "Fragmentarium"\ 26 | pause -------------------------------------------------------------------------------- /Fragmentarium-Source/Build - Windows/resource.h: -------------------------------------------------------------------------------- 1 | #define IDI_ICON1 1 2 | #define IDI_ICON2 2 3 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/BurningShip.frag: -------------------------------------------------------------------------------- 1 | #group Burning Ship 2 | #include "Progressive2DJulia.frag" 3 | #include "Complex.frag" 4 | 5 | // Burning Ship Fractal 6 | // (Implementation by Syntopia) 7 | 8 | vec2 formula(vec2 z, vec2 c) { 9 | z = abs(z); 10 | z = cMul(z,z); 11 | z.y = -z.y; 12 | z += c; 13 | return z; 14 | } 15 | 16 | #preset Default 17 | Center = -1.7553,0.0335209 18 | Zoom = 23.1601 19 | Iterations = 33 20 | PreIterations = 15 21 | R = 1 22 | G = 0.47059 23 | B = 0.725 24 | C = 1.64706 25 | Julia = false 26 | JuliaX = 0.23528 27 | JuliaY = 5.5384 28 | ShowMap = false 29 | MapZoom = 2.25625 30 | EscapeSize = 3.94031 31 | ColoringType = 1 32 | ColorFactor = 1 33 | #endpreset 34 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/DomainDistortion2.frag: -------------------------------------------------------------------------------- 1 | // An implementation of Quilez's warping (domain distortions): 2 | // http://iquilezles.org/www/articles/warp/warp.htm 3 | // 4 | // Not as good as his, but still interesting. 5 | // 6 | #include "2D.frag" 7 | 8 | uniform float Mul; slider[0,2,10] 9 | uniform float Decay; slider[0,0.5,2] 10 | uniform int Iterations; slider[0,1,19] 11 | 12 | float rand(vec2 co){ 13 | // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html 14 | return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); 15 | } 16 | 17 | float noise2f( in vec2 p ) 18 | { 19 | vec2 ip = vec2(floor(p)); 20 | vec2 u = fract(p); 21 | // http://www.iquilezles.org/www/articles/morenoise/morenoise.htm 22 | u = u*u*(3.0-2.0*u); 23 | //u = u*u*u*((6.0*u-15.0)*u+10.0); 24 | 25 | float res = mix( 26 | mix(rand(ip), rand(ip+vec2(1.0,0.0)),u.x), 27 | mix(rand(ip+vec2(0.0,1.0)), rand(ip+vec2(1.0,1.0)),u.x), 28 | u.y) 29 | ; 30 | return res*res; 31 | //return 2.0* (res-0.5); 32 | } 33 | 34 | 35 | float fbm(vec2 c) { 36 | float f = 0.0; 37 | float w = 1.0; 38 | for (int i = 0; i < Iterations; i++) { 39 | f+= w*noise2f(c); 40 | c*=Mul; 41 | w*=Decay; 42 | } 43 | return f; 44 | } 45 | 46 | uniform float time; 47 | 48 | vec2 cMul(vec2 a, vec2 b) { 49 | return vec2( a.x*b.x - a.y*b.y,a.x*b.y + a.y * b.x); 50 | } 51 | 52 | float pattern( vec2 p, out vec2 q, out vec2 r ) 53 | { 54 | q.x = fbm( p +0.00*time); 55 | q.y = fbm( p + vec2(1.0)); 56 | 57 | r.x = fbm( p +1.0*q + vec2(1.7,9.2)+0.15*time ); 58 | r.y = fbm( p+ 1.0*q + vec2(8.3,2.8)+0.126*time); 59 | // r = cMul(q,q); 60 | return fbm(p +1.0*r + 0.0* time); 61 | } 62 | 63 | uniform vec3 color1; color[0.0,1.0,0.0] 64 | uniform vec3 color2; color[1.0,0.0,0.0] 65 | uniform vec3 color3; color[0.0,1.0,0.0] 66 | uniform vec3 color4; color[0.0,0.0,1.0] 67 | 68 | vec3 color(vec2 c) { 69 | vec2 q; 70 | vec2 r; 71 | float f = pattern(c*0.01,q,r); 72 | vec3 col = mix(color1,color2,clamp((f*f)*4.0,0.0,1.0)); 73 | col = color2; 74 | col = mix(col,color3,clamp(length(q),0.0,1.0)); 75 | col = mix(col,color4,clamp(length(r.x),0.0,1.0)); 76 | return (f*f+0.2)*col; 77 | } 78 | 79 | #preset Default 80 | Center = -554.488,65.9944 81 | Zoom = 0.0092811 82 | AntiAliasScale = 1 83 | AntiAlias = 1 84 | Mul = 2 85 | Decay = 0.5 86 | Iterations = 13 87 | color1 = 0.101961,0.619608,0.666667 88 | color2 = 0.666667,0.666667,0.498039 89 | color3 = 0,0,0.164706 90 | color4 = 0.666667,1,1 91 | #endpreset 92 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/Droste.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | #include "Complex.frag" 3 | 4 | // A Escher/Droste transformation. 5 | // 6 | // This implementation uses GLSL code by ArKano22: 7 | // http://www.gamedev.net/topic/590070-glsl-droste/ 8 | // 9 | // The image is of my youngest daughter, Vigga. 10 | uniform float r1; slider[0,0.5,2] 11 | uniform float r2; slider[0,1,2] 12 | 13 | #define PI 3.14159265 14 | 15 | float nearestPower(in float a, in float base){ 16 | return pow(base, ceil( log(abs(a))/log(base) )-1.0 ); 17 | } 18 | 19 | float map(float value, float istart, float istop, float ostart, float ostop) { 20 | return ostart + (ostop - ostart) * ((value - istart) / (istop - istart)); 21 | } 22 | 23 | uniform sampler2D texture; file[texture2.jpg] 24 | 25 | uniform float time; 26 | uniform float Branches; slider[0,1,8] 27 | vec3 color(vec2 z) { 28 | float scale = r1/r2; 29 | 30 | // ArKano22 code below (http://www.gamedev.net/topic/590070-glsl-droste/) 31 | float branches = 1.0; 32 | float factor = pow(1.0/scale,Branches); 33 | z = cPower2(z, cDiv(vec2( log(factor) ,2.0*PI), vec2(0.0,2.0*PI) ) ); 34 | float s = fract(time); 35 | s = log(s+1.)/log(2.); // <-- I found this works better for linear animation 36 | z *= 1.0+s*(scale-1.0); 37 | float npower = max(nearestPower(z.x,scale),nearestPower(z.y,scale)); 38 | z.x = map(z.x,-npower,npower,-1.0,1.0); 39 | z.y = map(z.y,-npower,npower,-1.0,1.0); 40 | return texture2D(texture,z*0.5+vec2(0.5)).xyz;//+ grid(z); 41 | } 42 | 43 | #preset Default 44 | Center = -0.276125,0.175167 45 | Zoom = 0.639375 46 | AntiAliasScale = 1 47 | AntiAlias = 1 48 | r1 = 0.38776 49 | r2 = 0.89286 50 | Branches = 1 51 | texture = vigga.jpg NotLocked 52 | #endpreset 53 | 54 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/DrosteGrid.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | #include "Complex.frag" 3 | 4 | // A Escher/Droste transformation. 5 | // 6 | // This implementation uses GLSL code by ArKano22: 7 | // http://www.gamedev.net/topic/590070-glsl-droste/ 8 | 9 | float line(float x, float modulo, float width) { 10 | float s = abs(mod(x-modulo/2.,modulo)-modulo/2.) ; 11 | return (smoothstep(width*modulo,width*modulo*2.,clamp(s,0.0*width*modulo, width*modulo*2.))); 12 | } 13 | 14 | uniform float r1; slider[0,0.5,2] 15 | uniform float r2; slider[0,1,2] 16 | uniform vec2 Size; slider[(0,0),(1,1),(1,1)] 17 | uniform vec2 Width; slider[(0,0),(0.02,0.02),(1,1)] 18 | 19 | vec3 grid(vec2 c) { 20 | vec3 col = vec3( 1.0-line(c.x,Size.x,Width.x)) + vec3(1.0-line(c.y,Size.y,Width.y)); 21 | 22 | if (length(c)< r2 && length(c)>r1) col += vec3(0.5); 23 | if (length(c)< r1 ) col += vec3(0.,0.5,0.); 24 | 25 | if (abs(c.x)< r2 && abs(c.y)0.08) return (rand(time*z) < 0.5 ? vec3(1.0,0.0,0.0) : vec3(0.0)); 46 | vec4 v1 = texture2D( backbuffer, mod ( position , 1.0 ) ); 47 | int neighbours = 0; 48 | int alive =0; 49 | isAlive(0.0,0.0,alive); 50 | 51 | // Count neighbours 52 | isAlive(1.0,0.0, neighbours); 53 | isAlive(1.0,1.0, neighbours); 54 | isAlive(1.0,-1.0, neighbours); 55 | isAlive(0.0,1.0, neighbours); 56 | isAlive(0.0,-1.0, neighbours); 57 | isAlive(-1.0,1.0, neighbours); 58 | isAlive(-1.0,0.0, neighbours); 59 | isAlive(-1.0,-1.0, neighbours); 60 | 61 | // Rules 62 | if (alive==1) { 63 | if (neighbours<2) return vec3(0.0); //vec3(v1.x*0.99,v1.y*0.99,v1.z); 64 | else if (neighbours<4) return vec3(1.0); 65 | } else { 66 | if (neighbours==3) return vec3(1.0); 67 | } 68 | //return vec3(0.0); 69 | return vec3(v1.x*0.99,v1.y*0.997,v1.z*0.9993) ; 70 | } 71 | 72 | 73 | #preset Default 74 | Center = 0,0 75 | Zoom = 6.15279 76 | AntiAliasScale = 1 77 | AntiAlias = 1 78 | #endpreset 79 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/GraphPlotter.frag: -------------------------------------------------------------------------------- 1 | // An implementation of a Graph Plotter. 2 | // Shows how GLSL is useful to avoid anti-aliasing when drawing high-frequency plots. 3 | #include "Progressive2D.frag" 4 | #info Plotter 5 | #group Plotter2D 6 | 7 | float rand1(vec2 co){ 8 | // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html 9 | return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); 10 | } 11 | 12 | // Put your user defined function here... 13 | float function(float x) { 14 | x= 1.0*sin(1.0/tan(x)); return x; 15 | } 16 | 17 | uniform float Jitter; slider[0,0.5,2] 18 | uniform float Detail; slider[0,5,20] 19 | uniform int Samples; slider[0,3,100] 20 | uniform float AxisDetail; slider[1,1,10] 21 | vec3 color(vec2 pos) { 22 | vec2 step = Detail*vec2(aaScale.x,aaScale.y)/float(Samples); 23 | float samples = float(Samples); 24 | 25 | int count = 0; 26 | int mySamples = 0; 27 | 28 | for (float i = 0.0; i < samples; i++) { 29 | for (float j = 0.0;j < samples; j++) { 30 | if (i*i+j*j>samples*samples) continue; 31 | mySamples++; 32 | float ii = i + Jitter*rand1(vec2(pos.x+ i*step.x,pos.y+ j*step.y)); 33 | float jj = j + Jitter*rand1(vec2(pos.y + i*step.x,pos.x+ j*step.y)); 34 | float f = function(pos.x+ ii*step.x)-(pos.y+ jj*step.y); 35 | count += (f>0.) ? 1 : -1; 36 | } 37 | } 38 | vec3 color = vec3(1.0); 39 | float ss= abs(float(count))/float(mySamples); 40 | if (ss<1.0) color = vec3(ss); 41 | vec2 axisDetail = AxisDetail*aaScale; 42 | if (abs(pos.x) 200.0) break; 41 | } 42 | if (i < Iterations) { 43 | float co = float( i) + 1.0 - log2(.5*log2(dot(z,z))); 44 | co = sqrt(co/256.0); 45 | return vec3( .5+.5*cos(6.2831*co),.5+.5*cos(6.2831*co),.5+.5*cos(6.2831*co) ); 46 | } else { 47 | return vec3(0.0); 48 | } 49 | 50 | } 51 | uniform float BR; slider[0.1,1.1,200.3] 52 | uniform float Dist; slider[-20,0,0] 53 | uniform float EXP; slider[0,0,10] 54 | uniform float Dist2; slider[-20,0,0] 55 | 56 | uniform float Zoom; 57 | vec3 color(vec2 c) { 58 | if (ShowMap && Julia) { 59 | vec2 w = (aaCoord-mapCenter); 60 | w.y/=(pixelSize.y/pixelSize.x); 61 | if (length(w)100.0) break; 75 | } 76 | if ( i == Iterations) return vec3(0.0); 77 | 78 | float r = length(z); 79 | dr = length(dz); 80 | 81 | 82 | float de =(Zoom/100.0)* r*log2(r)/dr; 83 | if (de
0.5) return vec3(0.9); 85 | 86 | return vec3(1.0); 87 | } 88 | 89 | 90 | #preset Default 91 | Center = -0.0644841,-0.00353997 92 | Zoom = 1 93 | Iterations = 181 94 | R = 0 95 | G = 0.4 96 | B = 0.7 97 | Julia = true 98 | JuliaX = -0.77896 99 | JuliaY = 0.12536 100 | ShowMap = false 101 | MapZoom = 0.45925 102 | BR = 4.06396 103 | Dist = -18.7756 104 | EXP = 1.6667 105 | Dist2 = -9.7826 106 | #endpreset 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/Mandelbrot.frag: -------------------------------------------------------------------------------- 1 | #include "Progressive2D.frag" 2 | #info Mandelbrot 3 | #group Mandelbrot 4 | 5 | // Number of iterations 6 | uniform int Iterations; slider[10,200,1000] 7 | 8 | uniform float R; slider[0,0,1] 9 | uniform float G; slider[0,0.4,1] 10 | uniform float B; slider[0,0.7,1] 11 | 12 | uniform bool Julia; checkbox[false] 13 | uniform float JuliaX; slider[-2,-0.6,2] 14 | uniform float JuliaY; slider[-2,1.3,2] 15 | 16 | vec2 c2 = vec2(JuliaX,JuliaY); 17 | 18 | vec2 complexMul(vec2 a, vec2 b) { 19 | return vec2( a.x*b.x - a.y*b.y,a.x*b.y + a.y * b.x); 20 | } 21 | 22 | vec2 mapCenter = vec2(0.5,0.5); 23 | float mapRadius =0.4; 24 | uniform bool ShowMap; checkbox[true] 25 | uniform float MapZoom; slider[0.01,2.1,6] 26 | 27 | vec3 getMapColor2D(vec2 c) { 28 | vec2 p = (aaCoord-mapCenter)/(mapRadius); 29 | p*=MapZoom; p.x/=pixelSize.x/pixelSize.y; 30 | if (abs(p.x)<2.0*pixelSize.y*MapZoom) return vec3(0.0,0.0,0.0); 31 | if (abs(p.y)<2.0*pixelSize.x*MapZoom) return vec3(0.0,0.0,0.0); 32 | p +=vec2(JuliaX, JuliaY) ; 33 | 34 | 35 | vec2 z = vec2(0.0,0.0); 36 | 37 | int i = 0; 38 | for (i = 0; i < Iterations; i++) { 39 | z = complexMul(z,z) +p; 40 | if (dot(z,z)> 200.0) break; 41 | } 42 | if (i < Iterations) { 43 | float co = float( i) + 1.0 - log2(.5*log2(dot(z,z))); 44 | co = sqrt(co/256.0); 45 | return vec3( .5+.5*cos(6.2831*co),.5+.5*cos(6.2831*co),.5+.5*cos(6.2831*co) ); 46 | } else { 47 | return vec3(0.0); 48 | } 49 | 50 | } 51 | 52 | vec3 color(vec2 c) { 53 | if (ShowMap && Julia) { 54 | vec2 w = (aaCoord-mapCenter); 55 | w.y/=(pixelSize.y/pixelSize.x); 56 | if (length(w) 100.0) break; 67 | } 68 | if (i < Iterations) { 69 | // The color scheme here is based on one 70 | // from Inigo Quilez's Shader Toy: 71 | float co = float( i) + 1.0 - log2(.5*log2(dot(z,z))); 72 | co = sqrt(co/256.0); 73 | return vec3( .5+.5*cos(6.2831*co+R), 74 | .5+.5*cos(6.2831*co + G), 75 | .5+.5*cos(6.2831*co +B) ); 76 | } else { 77 | return vec3(0.0); 78 | } 79 | } 80 | 81 | #preset Default 82 | Center = -0.285288,-0.0120426 83 | Zoom = 0.854514 84 | Iterations = 328 85 | R = 0 86 | G = 0.4 87 | B = 0.7 88 | Julia = false 89 | JuliaX = -0.6 90 | JuliaY = 1.3 91 | #endpreset 92 | 93 | #preset Mandel2 94 | Center = -0.335155,0.124422 95 | Zoom = 630.163 96 | Iterations = 623 97 | R = 0.25624 98 | G = 0.66875 99 | B = 1 100 | Julia = false 101 | JuliaX = -0.6 102 | JuliaY = 1.3 103 | #endpreset 104 | 105 | #preset Julia1 106 | Center = -0.00932198,0 107 | Zoom = 1.26502 108 | Iterations = 69 109 | R = 0.76875 110 | G = 0.4 111 | B = 0.7 112 | Julia = true 113 | JuliaX = -1.26472 114 | JuliaY = -0.05884 115 | #endpreset 116 | 117 | #preset nice Julia 118 | Center = 0.16416,0.0265285 119 | Zoom = 0.854514 120 | Iterations = 328 121 | R = 0 122 | G = 0.4 123 | B = 0.7 124 | Julia = true 125 | JuliaX = -0.20588 126 | JuliaY = 0.79412 127 | ShowMap = true 128 | MapZoom = 1.74267 129 | #endpreset 130 | 131 | 132 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/MandelbrotCheckers.frag: -------------------------------------------------------------------------------- 1 | #include "Progressive2D.frag" 2 | #info Mandelbrot 3 | #group Mandelbrot 4 | 5 | // Number of iterations 6 | uniform int Iterations; slider[1,200,1000] 7 | 8 | uniform float R; slider[0,0,1] 9 | uniform float G; slider[0,0.4,1] 10 | uniform float B; slider[0,0.7,1] 11 | 12 | uniform bool Julia; checkbox[false] 13 | uniform float JuliaX; slider[-2,-0.6,2] 14 | uniform float JuliaY; slider[-2,1.3,2] 15 | 16 | vec2 c2 = vec2(JuliaX,JuliaY); 17 | 18 | vec2 complexMul(vec2 a, vec2 b) { 19 | return vec2( a.x*b.x - a.y*b.y,a.x*b.y + a.y * b.x); 20 | } 21 | 22 | uniform float Breakout; slider[0.1,1.1,10] 23 | float breakout = pow(10.0,Breakout); 24 | uniform float PatternScale; slider[0,1,200] 25 | 26 | vec3 getColor(vec2 w) { 27 | w= fract(w*PatternScale); 28 | float a = ((w.x<0.5 && w.y<0.5) || (w.x>0.5 && w.y>0.5)) ? 1.0 : 0.0; 29 | w=fract(w*2.0); 30 | if (length(w-vec2(0.5,0.5))<0.5) a = (1.0-a); 31 | return vec3 (a); 32 | } 33 | 34 | uniform bool Accumulate; checkbox[true] 35 | 36 | vec3 color(vec2 c) { 37 | 38 | vec2 z = Julia ? c : vec2(0.0,0.0); 39 | 40 | int i = 0; 41 | vec3 sum = vec3(0.0); 42 | vec3 last = vec3(0.0); 43 | for (i = 0; i < Iterations; i++) { 44 | z = complexMul(z,z) + (Julia ? c2 : c); 45 | if (dot(z,z)> breakout) break; 46 | last = getColor(z); 47 | sum += last; 48 | } 49 | sum=sum/float(i); 50 | if (!Accumulate) sum = last; 51 | 52 | if (i < Iterations) { 53 | // The color scheme here is based on one 54 | // from Inigo Quilez's Shader Toy: 55 | float co = float( i) + 1.0 - log2(.5*log2(dot(z,z))); 56 | co = sqrt(co/256.0); 57 | return sum*vec3( .5+.5*cos(6.2831*co+R), 58 | .5+.5*cos(6.2831*co + G), 59 | .5+.5*cos(6.2831*co +B) ); 60 | } else { 61 | return vec3(sum); 62 | } 63 | } 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/PenroseTiles.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | #info Penrose-like Tilings (based on formula by tomkh) 3 | #group Penrose Tilings 4 | 5 | // Iterations. Increase when zooming in. 6 | uniform int Iterations; slider[0,12,15] 7 | uniform vec2 v2; slider[(0,1),(0,1),(2,2)] 8 | 9 | // An implementation of the system 10 | // decribed by 'tomkh' in this thread; 11 | // http://www.fractalforums.com/new-theories-and-research/procedural-aperiodic-fractals/ 12 | 13 | // A lot of constants here 14 | float pi =3.141592653589 ; 15 | float sc = 2.0/(sqrt(5.0)-1.0); // inflation scale 16 | float d1 = tan(54.0*pi/180.0); 17 | float d2 = tan(18.0*pi/180.0); 18 | float a1 = .5/cos(36.0*pi/180.0); 19 | float a2 = (1.0+a1)*.5; 20 | float a3 = tan(36.0*pi/180.0)*a2; 21 | float cos1 = cos(144.0*pi/180.0)*sc; 22 | float sin1 = sin(144.0*pi/180.0)*sc; 23 | float cos2 = cos(108.0*pi/180.0)*sc; 24 | float sin2 = sin(108.0*pi/180.0)*sc; 25 | mat2 m1 = mat2(-sc,0.0, 0,sc); 26 | vec2 p1 = vec2(-a2,-a3 ); 27 | mat2 m2= mat2(cos1,-sin1,sin1,cos1); 28 | mat2 m3= mat2(cos1,sin1,-sin1,cos1); 29 | mat2 m4= mat2(-cos2,sin2,sin2,cos2); 30 | mat2 m5= mat2(cos2,sin2,-sin2,cos2); 31 | 32 | void init() {} 33 | 34 | vec3 color(vec2 z) { 35 | z*=0.1; 36 | z+=vec2(0.55,0.2)+v2; 37 | int triangleType = 0; 38 | for(int k=0; k 0.0) { 41 | z *= m1; z.x += sc; 42 | } else if (1.0 - d2*z.y - z.x > 0.0) { 43 | z += p1; z *= m2; triangleType = 1; 44 | } else { 45 | z.x-=(1.0+a1); z*= m3; 46 | } 47 | } else { 48 | if (d1*z.y - z.x > 0.0) { 49 | z*=m4; triangleType = 0; 50 | } else { 51 | z.x -= a1; z*= m5; 52 | } 53 | } 54 | } 55 | return (triangleType == 0) ? vec3(1,0.8,0.4) : vec3(0,0,0) ; 56 | } 57 | 58 | #preset Default 59 | Center = 1.09069,-10.4092 60 | Zoom = 0.905839 61 | AntiAliasScale = 1 62 | AntiAlias = 3 63 | Iterations = 12 64 | v2 = 0,1 65 | #endpreset 66 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/2D Systems/Thorn.frag: -------------------------------------------------------------------------------- 1 | #group Thorn 2 | #include "Progressive2DJulia.frag" 3 | 4 | // Thorn fractal (first seen at Softology's blog) 5 | // http://paulbourke.net/fractals/thorn/ 6 | vec2 formula(vec2 z,vec2 c) { 7 | return vec2(z.x/cos(z.y),z.y/sin(z.x))+c; 8 | } 9 | 10 | #preset Default 11 | Gamma = 2.042 12 | ToneMapping = 3 13 | Exposure = 0.4878 14 | Brightness = 1.05265 15 | Contrast = 1.43135 16 | Saturation = 2.38865 17 | Center = -1.70238,7.44304e-05 18 | Zoom = 0.648883 19 | AARange = 2 20 | AAExp = 1 21 | GaussianAA = true 22 | Iterations = 90 23 | PreIterations = 0 24 | R = 0.47985 25 | G = 0.42857 26 | B = 0.32847 27 | C = 2 28 | Julia = true 29 | JuliaX = 0.102 30 | JuliaY = -0.04517 31 | ShowMap = false 32 | MapZoom = 2.1 33 | EscapeSize = 5.12666 34 | ColoringType = 0 35 | ColorFactor = 0.50667 36 | #endpreset 37 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/IFS.frag: -------------------------------------------------------------------------------- 1 | // A very simple example of video feedback systems. 2 | // Change to Continuous. 3 | #buffer RGBA32F 4 | #include "2D.frag" 5 | #buffershader "BufferShaderIFS.frag" 6 | #define DontClearOnChange 7 | #define IterationsBetweenRedraws 10 8 | #group post 9 | uniform float Gamma; slider[0.0,2.2,5.0] 10 | uniform bool ExponentialExposure; checkbox[false] 11 | uniform float Exposure; slider[0.0,1.3,30.0] 12 | uniform float Brightness; slider[0.0,1.0,5.0]; 13 | uniform float Contrast; slider[0.0,1.0,5.0]; 14 | uniform float Saturation; slider[0.0,1.0,5.0]; 15 | 16 | uniform float AARange; slider[0.1,1.,15.3] 17 | uniform float AAExp; slider[0.1,1,15.3] 18 | uniform bool GaussianAA; checkbox[true] 19 | 20 | #group IFS 21 | uniform sampler2D backbuffer; 22 | uniform float time; 23 | 24 | vec2 pos = (viewCoord*1.0+vec2(1.0))/2.0; 25 | 26 | float rand(vec2 co){ 27 | // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html 28 | return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); 29 | } 30 | 31 | uniform float inNoise; slider[0,0.06,1.0] 32 | vec3 sample(vec2 p) { 33 | if (p.x > 1.0 || p.y>1.0) return vec3(0.0); 34 | if (p.x < 0.0 || p.y< 0.0) return vec3(0.0); 35 | vec3 v1 = texture2D( backbuffer, p ).xyz*0.8; 36 | v1+= vec3(inNoise*vec3(p,1.0)); 37 | return v1; 38 | 39 | } 40 | 41 | uniform float BIAS; slider[0,0.85,1.0] 42 | uniform float BIAS2; slider[0,0.7,1.0] 43 | 44 | uniform vec4 M1; slider[(-10,-10,-10,-10),(2,0,0,2),(10,10,10,10)] 45 | mat2 mM1 = mat2(M1.x,M1.y,M1.z,M1.w); 46 | uniform vec2 O1; slider[(-1,-1),(0,0),(1,1)] 47 | uniform vec4 M2; slider[(-10,-10,-10,-10),(2,0,0,2),(10,10,10,10)] 48 | mat2 mM2 = mat2(M2.x,M2.y,M2.z,M2.w); 49 | uniform vec2 O2; slider[(-1,-1),(0.5,1),(1,1)] 50 | uniform vec4 M3; slider[(-10,-10,-10,-10),(2,0,0,2),(10,10,10,10)] 51 | mat2 mM3 =mat2(M3.x,M3.y,M3.z,M3.w); 52 | uniform vec2 O3; slider[(-1,-1),(1,0),(1,1)] 53 | uniform vec2 v2; slider[(-5,-5),(0,0),(5,5)] 54 | vec3 color(vec2 z) { 55 | vec3 v = sample(pos); 56 | vec3 v2 =sample( pos*mM1-O1+v2/2.0)+ 57 | sample(pos*mM2-O2+v2/2.0)+ 58 | sample(pos*mM3-O3+v2/2.0); 59 | v = v*BIAS+v2*BIAS2; 60 | return v*BIAS; 61 | } 62 | 63 | 64 | #preset Default 65 | Center = 0,0 66 | Zoom = 6.15279 67 | AntiAliasScale = 1 68 | AntiAlias = 1 69 | #endpreset 70 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/Knot.frag: -------------------------------------------------------------------------------- 1 | #info Knot system (DarkBeam formula) 2 | 3 | // Based on DarkBeam formula from this thread: 4 | // http://www.fractalforums.com/new-theories-and-research/not-fractal-but-funny-trefoil-knot-routine 5 | 6 | #define providesColor 7 | #include "Sky-Pathtracer.frag" 8 | 9 | 10 | #group Knot 11 | uniform float R1; slider[0.0,1.6,2.3] 12 | uniform float R2; slider[0.0,0.1,2.3] 13 | uniform float R3; slider[0.0,1.6,2.3] 14 | uniform float R5; slider[0.0,1.6,2.3] 15 | uniform float a; slider[0,1,5] 16 | uniform float b; slider[0,1,5] 17 | uniform float polyfoldOrder; slider[0,2,15] 18 | vec2 rotate(vec2 v, float angle) { 19 | return vec2(cos(angle)*v.x+sin(angle)*v.y, 20 | -sin(angle)*v.x+cos(angle)*v.y); 21 | } 22 | 23 | vec3 baseColor(vec3 p, vec3 n) { 24 | 25 | return vec3(1.0); 26 | } 27 | 28 | 29 | float maxDim(vec2 a) { return max(a.x,a.y); } 30 | uniform float RX; slider[0,1,62] 31 | uniform float RZ; slider[0,1,6] 32 | float DE(vec3 p) { 33 | p.xz = rotate(p.xz,RX); 34 | p.yz = rotate(p.yz,RZ); 35 | float mobius = ((a+b)/polyfoldOrder) * atan(p.y,p.x); 36 | p.x = length(p.xy)-R1; 37 | p.xz = rotate(p.xz,mobius); 38 | 39 | float m = polyfoldOrder/ (2.*PI); 40 | float angle = floor(.5+m*(PI/2.-atan(p.x,p.z)))/m; 41 | p.yz = rotate(p.yz,R5); 42 | p.xz = rotate(p.xz,angle); 43 | p.x =p.x - R3; 44 | return length(p.xz)-R2; 45 | } 46 | 47 | #preset Default 48 | FOV = 0.4 49 | Eye = -0.345332,-6.16714,-4.4525 50 | Target = 0.101118,1.70231,1.70156 51 | Up = -0.52351,0.281361,-0.804222 52 | EquiRectangular = false 53 | FocalPlane = 4.84535 54 | Aperture = 0.04381 55 | Gamma = 2.0354 56 | ToneMapping = 2 57 | Exposure = 1.5465 58 | Brightness = 1 59 | Contrast = 1 60 | Saturation = 1 61 | GaussianWeight = 1 62 | AntiAliasScale = 2.1053 63 | Detail = -2.84746 64 | DetailAO = -0.20391 65 | FudgeFactor = 0.75 66 | MaxRaySteps = 83 67 | BoundingSphere = 12 68 | Dither = 0.5 69 | NormalBackStep = 1 70 | AO = 0,0,0,0.89535 71 | Specular = 1.5476 72 | SpecularExp = 25 73 | SpotLight = 0.431373,0.537255,1,1 74 | SpotLightPos = 5,-2.2034,0 75 | SpotLightSize = 0.34327 76 | CamLight = 1,1,1,1 77 | CamLightMin = 0 78 | Glow = 1,1,1,0 79 | GlowMax = 20 80 | Fog = 0 81 | Reflection = 0 82 | BaseColor = 1,1,1 83 | OrbitStrength = 1 84 | X = 0.5,0.6,0.6,0.7 85 | Y = 1,0.6,0,0.4 86 | Z = 0.8,0.78,1,0.5 87 | R = 0.4,0.7,1,0.5701 88 | BackgroundColor = 0.6,0.6,0.45 89 | GradientBackground = 0.3 90 | CycleColors = false 91 | Cycles = 1.1 92 | EnableFloor = false 93 | FloorNormal = 0,0,0 94 | FloorHeight = 0 95 | FloorColor = 1,1,1 96 | R1 = 2.01036 97 | R2 = 0.28964 98 | R3 = 0.86889 99 | R5 = 0 100 | a = 0 101 | b = 2 102 | polyfoldOrder = 3 103 | #endpreset 104 | 105 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/LiftedDomainColoring.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | #include "Complex.frag" 3 | 4 | // The simplest way to draw something in Fragmentarium, 5 | // is to include the "2D.frag" header. 6 | // 7 | // Now, we can implement a simple 'color' function, 8 | // which for each point in the plane returns a RGB color. 9 | // 10 | // Notice, that you can zoom using the mouse or the keyboard. 11 | // (A,S,D,W,Q,E,1,3) 12 | #define PI 3.141592 13 | // Hue in radians 14 | vec3 HSVtoRGB(vec3 hsv) { 15 | /// Implementation based on: http://en.wikipedia.org/wiki/HSV_color_space 16 | hsv.x = mod(hsv.x,2.*PI); 17 | int Hi = int(mod(hsv.x / (2.*PI/6.), 6.)); 18 | float f = (hsv.x / (2.*PI/6.)) -float( Hi); 19 | float p = hsv.z*(1.-hsv.y); 20 | float q = hsv.z*(1.-f*hsv.y); 21 | float t = hsv.z*(1.-(1.-f)*hsv.y); 22 | if (Hi == 0) { return vec3(hsv.z,t,p); } 23 | if (Hi == 1) { return vec3(q,hsv.z,p); } 24 | if (Hi == 2) { return vec3(p,hsv.z,t); } 25 | if (Hi == 3) { return vec3(p,q,hsv.z); } 26 | if (Hi == 4) { return vec3(t,p,hsv.z); } 27 | if (Hi == 5) { return vec3(hsv.z,p,q); } 28 | return vec3(0.); 29 | } 30 | 31 | vec2 cMul2(in vec2 a, in vec2 b) { 32 | return vec2( a.x*b.x - a.y*b.y,a.x*b.y + a.y * b.x); 33 | } 34 | 35 | float sqr(float a) { return a; } 36 | 37 | vec2 formula(vec2 z) { 38 | vec2 real = vec2(1.,0.); vec2 imag = vec2(0.,1.); 39 | vec2 z2 = cMul(cSqr(z+real), z-real); 40 | vec2 z3 = cMul(z+imag, cSqr(z-imag)); 41 | z = cDiv(z2,z3); 42 | return z; 43 | } 44 | 45 | vec2 toPhiTheta(vec2 z) { 46 | float r = length(z); 47 | float phi = 2.*atan(1./r); 48 | float theta = atan(z.y,z.x); 49 | return vec2(phi,theta); 50 | } 51 | uniform float delta; slider[0.0,0.001,1.0] 52 | 53 | // Convert to 54 | uniform float GridWidth; slider[-10,-1,10] 55 | vec3 color(vec2 z) { 56 | // Restrict 57 | //if (abs(z).x>3.0) return vec3(0.); 58 | //if (abs(z).y>3.0) return vec3(0.); 59 | 60 | z = formula(z); 61 | // Inverse map complex plane to 2-sphere 62 | // using spherical coordinates: 63 | float r = length(z); 64 | float phi = 2.*atan(1./r); 65 | float theta = atan(z.y,z.x); 66 | 67 | float b0 = fract(2.0*log(r)/log(2.)); // fractional brightness 68 | float b1 = fract(log(r)/log(2.)); // ... for every second band 69 | 70 | float m = mod(theta , PI/6.); // twelve white rays. 71 | float p10 =pow(10.,GridWidth); // grid width 72 | 73 | // adjust brightness 74 | float b = (b0+3.0)/4.0; 75 | if (b1<0.5) b = 1.0; 76 | 77 | // saturation and value 78 | float s = 1.0; 79 | float val = 1.0; 80 | if (phiPI/6.-p10) v =mix(v,vec3(1.0),( m-(PI/6.-p10) )/p10); 90 | 91 | if (b01.-p10) v =mix(v,vec3(0.0),( b0-(1.-p10) )/p10); 93 | 94 | return v; 95 | } 96 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/Mandelbrot-Progressive.frag: -------------------------------------------------------------------------------- 1 | #info Notice: set Render mode to Continous 2 | #include "Progressive2D.frag" 3 | #info Mandelbrot 4 | #group Mandelbrot 5 | 6 | // Number of iterations 7 | uniform int Iterations; slider[10,200,1000] 8 | 9 | uniform float R; slider[0,0,1] 10 | uniform float G; slider[0,0.4,1] 11 | uniform float B; slider[0,0.7,1] 12 | 13 | uniform bool Julia; checkbox[false] 14 | uniform float JuliaX; slider[-2,-0.6,2] 15 | uniform float JuliaY; slider[-2,1.3,2] 16 | 17 | vec2 c2 = vec2(JuliaX,JuliaY); 18 | 19 | void init() {} 20 | 21 | vec2 complexMul(vec2 a, vec2 b) { 22 | return vec2( a.x*b.x - a.y*b.y,a.x*b.y + a.y * b.x); 23 | } 24 | 25 | vec2 mapCenter = vec2(0.5,0.5); 26 | float mapRadius =0.4; 27 | uniform bool ShowMap; checkbox[true] 28 | uniform float MapZoom; slider[0.01,2.1,6] 29 | 30 | vec3 getMapColor2D(vec2 c) { 31 | vec2 p = (aaCoord-mapCenter)/(mapRadius); 32 | p*=MapZoom; p.x/=pixelSize.x/pixelSize.y; 33 | if (abs(p.x)<2.0*pixelSize.y*MapZoom) return vec3(0.0,0.0,0.0); 34 | if (abs(p.y)<2.0*pixelSize.x*MapZoom) return vec3(0.0,0.0,0.0); 35 | p +=vec2(JuliaX, JuliaY) ; 36 | 37 | 38 | vec2 z = vec2(0.0,0.0); 39 | 40 | int i = 0; 41 | for (i = 0; i < Iterations; i++) { 42 | z = complexMul(z,z) +p; 43 | if (dot(z,z)> 200.0) break; 44 | } 45 | if (i < Iterations) { 46 | float co = float( i) + 1.0 - log2(.5*log2(dot(z,z))); 47 | co = sqrt(co/256.0); 48 | return vec3( .5+.5*cos(6.2831*co),.5+.5*cos(6.2831*co),.5+.5*cos(6.2831*co) ); 49 | } else { 50 | return vec3(0.0); 51 | } 52 | 53 | } 54 | 55 | vec3 color(vec2 c) { 56 | if (ShowMap && Julia) { 57 | vec2 w = (aaCoord-mapCenter); 58 | w.y/=(pixelSize.y/pixelSize.x); 59 | if (length(w) 100.0) break; 70 | } 71 | if (i < Iterations) { 72 | // The color scheme here is based on one 73 | // from Inigo Quilez's Shader Toy: 74 | float co = float( i) + 1.0 - log2(.5*log2(dot(z,z))); 75 | co = sqrt(co/256.0); 76 | return vec3( .5+.5*cos(6.2831*co+R), 77 | .5+.5*cos(6.2831*co + G), 78 | .5+.5*cos(6.2831*co +B) ); 79 | } else { 80 | return vec3(0.0); 81 | } 82 | } 83 | 84 | #preset Default 85 | Center = -0.285288,-0.0120426 86 | Zoom = 0.854514 87 | Iterations = 328 88 | R = 0 89 | G = 0.4 90 | B = 0.7 91 | Julia = false 92 | JuliaX = -0.6 93 | JuliaY = 1.3 94 | #endpreset 95 | 96 | #preset Mandel2 97 | Center = -0.335155,0.124422 98 | Zoom = 630.163 99 | Iterations = 623 100 | R = 0.25624 101 | G = 0.66875 102 | B = 1 103 | Julia = false 104 | JuliaX = -0.6 105 | JuliaY = 1.3 106 | #endpreset 107 | 108 | #preset Julia1 109 | Center = -0.00932198,0 110 | Zoom = 1.26502 111 | Iterations = 69 112 | R = 0.76875 113 | G = 0.4 114 | B = 0.7 115 | Julia = true 116 | JuliaX = -1.26472 117 | JuliaY = -0.05884 118 | #endpreset 119 | 120 | #preset nice Julia 121 | Center = 0.16416,0.0265285 122 | Zoom = 0.854514 123 | Iterations = 328 124 | R = 0 125 | G = 0.4 126 | B = 0.7 127 | Julia = true 128 | JuliaX = -0.20588 129 | JuliaY = 0.79412 130 | ShowMap = true 131 | MapZoom = 1.74267 132 | #endpreset 133 | 134 | 135 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/Noise.frag: -------------------------------------------------------------------------------- 1 | #info Noise thing 2 | #define providesColor 3 | #define providesNormalOffset 4 | #include "DE-Raytracer.frag" 5 | #include "Classic-Noise.frag" 6 | #group Menger 7 | 8 | // Slow noise thingy 9 | 10 | uniform float Scale; slider[0.00,1.0,4.00] 11 | uniform float Scale2; slider[0.00,1.0,4.00] 12 | 13 | uniform float time; 14 | uniform float Amplitude; slider[0.01,0.1,2.3] 15 | uniform float Amplitude2; slider[0.01,0.1,2.3] 16 | float DE(vec3 z) 17 | { 18 | 19 | float l = abs(length(z)-2.0 ); 20 | float tt = time*0.4; 21 | if (l<2.5*Amplitude) { 22 | z+=Amplitude*vec3(cnoise( vec4(z*Scale,tt) )) 23 | +Amplitude2*vec3(cnoise( vec4(z*Scale2,tt) )); 24 | } else return l; 25 | return abs(length(z)-2.0 ) ; 26 | } 27 | 28 | vec3 baseColor(vec3 z, vec3 n) { 29 | float tt = time*0.151; 30 | return vec3(cnoise(vec4(1.0*z,tt*1.2)), 31 | cnoise(vec4(1.0*z,tt)),cnoise(vec4(1.0*z,tt*1.4))); 32 | } 33 | 34 | vec3 normalOffset(vec3 z) { 35 | return vec3(0.0); //0.0084*vec3(cnoise(0.5*z)+cnoise(0.1*z)); 36 | } 37 | 38 | #preset Default 39 | FOV = 0.4 40 | Eye = -2.26624,-4.04408,-2.56897 41 | Target = 2.00969,3.58626,2.27813 42 | Up = -0.630956,0.635898,-0.444429 43 | AntiAlias = 1 44 | Detail = -2.29201 45 | DetailAO = -1.99997 46 | FudgeFactor = 0.45783 47 | MaxRaySteps = 56 48 | BoundingSphere = 3.774 49 | Dither = 0.5 50 | NormalBackStep = 1 51 | AO = 0,0,0,0.7 52 | Specular = 0.1666 53 | SpecularExp = 16 54 | SpotLight = 1,1,1,0.19608 55 | SpotLightDir = 0.37142,0.1 56 | CamLight = 1,1,1,1.13978 57 | CamLightMin = 0.29412 58 | Glow = 1,1,1,0.07895 59 | Fog = 0.4161 60 | HardShadow = 0.33846 61 | Reflection = 0 62 | BaseColor = 1,1,1 63 | OrbitStrength = 0.2987 64 | X = 0.5,0.6,0.6,0.2126 65 | Y = 1,0.6,0,0.30708 66 | Z = 0.8,0.78,1,0.35434 67 | R = 0.666667,0.666667,0.498039,0.03174 68 | BackgroundColor = 0.6,0.6,0.45 69 | GradientBackground = 0.3 70 | CycleColors = false 71 | Cycles = 6.95699 72 | EnableFloor = false 73 | FloorNormal = 0,0,0 74 | FloorHeight = 0 75 | FloorColor = 1,1,1 76 | ShadowSoft = 0.001 77 | ShadowSoft2 = 0.001 78 | Scale = 3 79 | Scale2 = 1 80 | Amplitude = 0.1 81 | Amplitude2 = 0.1 82 | #endpreset 83 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/Raytracingtestfrag.frag: -------------------------------------------------------------------------------- 1 | #info Shader test 2 | #include "Sky-Pathtracer.frag" 3 | #include "QuilezLib.frag" 4 | uniform float S; slider[0.1,1.1,2.3] 5 | uniform vec3 V; slider[(0,0,0),(1,1,1),(10,10,10)] 6 | float DE(vec3 pos) { 7 | pos = pos.zxy; 8 | vec3 p = pos; 9 | p.yz= mod(p.yz,S)-vec2(S/2.0); 10 | float d = udRoundBox(p,V/10.0,0.1); 11 | return min(min(length(pos)-1.0, d), pos.x); 12 | } 13 | 14 | 15 | 16 | #preset Noname 17 | FOV = 0.393552 18 | Eye = -6.25504,-1.12798,4.19403 19 | Target = 1.18359,-0.580161,-2.46681 20 | Up = 0.716076,0.0574899,0.695651 21 | EquiRectangular = false 22 | FocalPlane = 6.6 23 | Aperture = 0 24 | Gamma = 2.03295 25 | ToneMapping = 3 26 | Exposure = 3 27 | Brightness = 1 28 | Contrast = 1 29 | Saturation = 1 30 | GaussianWeight = 1 31 | AntiAliasScale = 1 32 | Detail = -2.40625 33 | FudgeFactor = 1 34 | MaxRaySteps = 90 35 | BaseColor = 1,1,1 36 | OrbitStrength = 0 37 | X = 0.5,0.6,0.6,0.7 38 | Y = 1,0.6,0,0.4 39 | Z = 0.8,0.78,1,0.5 40 | R = 0.4,0.7,1,0.12 41 | CycleColors = false 42 | Cycles = 1.1 43 | turbidity = 2 44 | sunSize = 0.7165 45 | SunPos = 0.13939,0.60303 46 | Stratify = false 47 | RayDepth = 3 48 | Albedo = 0.56456 49 | BiasedSampling = true 50 | S = 1.1 51 | V = 1,1,1 52 | Reflectivity = 0 53 | DebugLast = false 54 | #endpreset 55 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/SphereSponge.frag: -------------------------------------------------------------------------------- 1 | #info SphereSponge Distance Estimator. 2 | #include "DE-Raytracer.frag" 3 | #group Sphere sponge 4 | 5 | // Based on a fractal proposed by Buddhi, with a DE outlined by Knighty: 6 | // http://www.fractalforums.com/3d-fractal-generation/revenge-of-the-half-eaten-menger-sponge/ 7 | 8 | // Number of iterations. 9 | uniform int Iterations; slider[0,10,100] 10 | uniform int ColorIterations; slider[0,10,100] 11 | 12 | // Scale parameter. 13 | uniform float Scale; slider[0.00,3.0,4.00] 14 | 15 | // Size of bubbles 16 | uniform float BubbleSize; slider[1,2.07,3]; 17 | 18 | 19 | float DE(vec3 z) 20 | { 21 | z+=vec3(1.0,1.0,1.0); 22 | float modi=4.0; 23 | float k=2.0; 24 | float d=0.0; 25 | for (int l = 0; l < Iterations ; l++) 26 | { 27 | vec3 p2 = mod(z*k, modi) - 0.5*modi; 28 | d=max(d,(BubbleSize-length(p2))/k);//intersect 29 | k *= Scale; 30 | 31 | if (lWaterLevel) r = WaterLevel; 29 | return r; 30 | } 31 | 32 | vec3 baseColor(vec3 pos, vec3 normal) { 33 | float dr = height(pos); 34 | if (dr==WaterLevel) return vec3(0.0,0.0,1.0); 35 | dr = 1.0-clamp(dr, 0.0, 1.0); 36 | if (dr>0.5) return vec3(dr-0.5,1.0,dr-0.5); 37 | if (dr<0.5) return mix(vec3(0.0,0.0,1.0),vec3(0.0,1.0,0.0),dr*2.0); 38 | 39 | } 40 | 41 | float DE(vec3 pos) { 42 | float dr = height(pos); 43 | return (pos.z-Slope*dr); 44 | } 45 | 46 | #preset Default 47 | FOV = 0.4 48 | Eye = 33.7331,-8.49179,2.31636 49 | Target = 39.0618,-14.7221,-2.22206 50 | Up = 0.376281,-0.313292,0.871889 51 | AntiAlias = 1 NotLocked 52 | Detail = -3.53094 53 | DetailAO = -0.00707 54 | FudgeFactor = 0.6747 55 | MaxRaySteps = 176 56 | BoundingSphere = 83.019 57 | Dither = 0.41228 58 | AO = 0,0,0,0.93827 59 | Specular = 3.5443 60 | SpecularExp = 14.545 61 | SpotLight = 1,1,0.796078,0.64706 62 | SpotLightDir = -0.71874,-0.25 63 | CamLight = 1,0.960784,0.921569,1.3077 64 | CamLightMin = 0.18102 65 | Glow = 1,1,1,0 66 | Fog = 0.2963 67 | HardShadow = 0.63077 NotLocked 68 | Reflection = 0 NotLocked 69 | BaseColor = 1,1,1 70 | OrbitStrength = 0.81818 71 | X = 0.5,0.6,0.6,1 72 | Y = 1,0.6,0,0.48092 73 | Z = 0.8,0.78,1,0.26718 74 | R = 0.666667,0.666667,0.498039,0.58462 75 | BackgroundColor = 0.917647,0.843137,0.564706 76 | GradientBackground = 0 77 | CycleColors = false 78 | Cycles = 1.29269 79 | EnableFloor = false NotLocked 80 | FloorNormal = 0,0,0 81 | FloorHeight = 0 82 | FloorColor = 1,1,1 83 | NormalBackStep = 1 84 | GlowMax = 10 85 | ShadowSoft = 2.258 86 | Iterations = 8 87 | S = 1 88 | Slope = -0.63717 89 | FreqMul = 2.45458 90 | Offset = 0.8122 91 | AmpMul = 0.30189 92 | WaterLevel = 0.48864 93 | #endpreset -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/TextureTest.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | 3 | #info SimpleTexture demo. 4 | #group Simple Texture demo. 5 | 6 | /* 7 | Set the render mode to continuous to test this shader. 8 | 9 | The deformation is a modified version of 10 | 'Deform' by Inigo Quilez 11 | (see http://www.iquilezles.org/apps/shadertoy/) 12 | */ 13 | 14 | uniform float time; 15 | uniform sampler2D texture; file[texture2.jpg] 16 | // You can use multiple textures: 17 | // uniform sampler2D texture2; file[texture.jpg] 18 | uniform vec2 params; slider[(-1,-1),(-0.5,0.24),(1,1)] 19 | 20 | vec3 a(vec2 z, float t) { 21 | vec2 m = params.xy; 22 | float a1 = atan(z.x-m.y,z.x-m.x); 23 | float r1 = sqrt(dot(z-m,z-m)); 24 | float a2 = -atan(z.x+m.y,z.x+m.x); 25 | float r2 = sqrt(dot(z+m,z+m)); 26 | vec2 uv; 27 | uv.x = 0.2*t + (r1-r2)*0.25; 28 | uv.y = tan(2.0*(a1-a2)); 29 | float w = r1*r2*0.8; 30 | vec3 col = texture2D(texture,uv).xyz; 31 | return vec3(col/(.1+w)); 32 | } 33 | 34 | 35 | vec3 color(vec2 z) { 36 | z.y*=2.0; 37 | z.x*=1.5; 38 | vec3 acc = vec3(0.0); 39 | float wt = 0.0; 40 | int iter = 10; 41 | for (int i = 0; i< iter; i++) { 42 | float w = (float(iter)-float(i))/(float(iter)); 43 | w= w*w; 44 | wt+= w; 45 | acc+= a(z.yx,time+(float(i)*0.02))*w; 46 | } 47 | return (acc/(wt*2.0)); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Experimental/TriPlanarTexturing.frag: -------------------------------------------------------------------------------- 1 | #info SphereSponge Distance Estimator. 2 | #define providesInit 3 | #define providesColor 4 | #include "Soft-Raytracer.frag" 5 | #include "MathUtils.frag" 6 | #group New Menger 7 | 8 | 9 | uniform sampler2D tex; file[texture.jpg] 10 | uniform float TextureScale; slider[0,1,10] 11 | vec3 baseColor(vec3 p, vec3 n) { 12 | p=p*0.5+vec3(0.5); 13 | 14 | if (p.z<0.01) return vec3(0.9); 15 | p*=TextureScale; 16 | n = abs(n); 17 | n = n/(n.x+n.y+n.z); 18 | float G= 2.2; 19 | vec3 t = pow( texture2D(tex, p.yz).xyz,vec3(G))*n.x 20 | + pow( texture2D(tex, p.xz).xyz,vec3(G))*n.y+ 21 | pow( texture2D(tex, p.xy).xyz,vec3(G))*n.z; 22 | 23 | return t; 24 | } 25 | 26 | 27 | // Based on a fractal proposed by Buddhi, with a DE outlined by Knighty: 28 | // http://www.fractalforums.com/3d-fractal-generation/revenge-of-the-half-eaten-menger-sponge/ 29 | 30 | // Number of iterations. 31 | uniform int Iterations; slider[0,10,100] 32 | uniform int ColorIterations; slider[0,4,100] 33 | 34 | // Scale parameter. 35 | uniform float Scale; slider[0.00,3.0,4.00] 36 | 37 | uniform vec3 Rotation; slider[(-180,-180,-180),(0,0,0),(180,180,180)] 38 | 39 | // Scaling center 40 | uniform vec3 Offset; slider[(0,0,0),(0,0,0),(1,1,1)] 41 | 42 | mat3 rot; 43 | 44 | void init() { 45 | rot = rotationMatrixXYZ(Rotation); 46 | } 47 | 48 | 49 | float DE(vec3 p) 50 | { 51 | p=p*0.5+vec3(0.5); 52 | vec3 pp= abs(p-0.5)-0.5; 53 | float k=1.0; 54 | float d1 = max(pp.x,max(pp.y,pp.z)); 55 | float d=d1; 56 | for (int i = 0; i < Iterations ; i++) 57 | { 58 | vec3 pa = mod(3.0*p*k, 3.0); 59 | k *= Scale; 60 | 61 | pp = 0.5-abs(pa-1.5)+Offset; 62 | pp*=rot; 63 | d1=min(max(pp.x,pp.z),min(max(pp.x,pp.y),max(pp.y,pp.z)))/k;//distance inside the 3 axis aligned square tubes 64 | d=max(d,d1); 65 | if (i escape) break; 42 | } 43 | mean/=float(i); 44 | float co = 1.0 - log2(.5*log2(mean/0.5)); 45 | return vec3( .5+.5*cos(6.2831*co+0.5),.5+.5*cos(6.2831*co + 0.5),.5+.5*cos(6.2831*co +0.5) ); 46 | 47 | } 48 | 49 | uniform int ColoringType; slider[0,0,2] 50 | uniform float ColorFactor; slider[0,0.5,1] 51 | 52 | vec3 color(vec2 c) { 53 | if (ShowMap && Julia) { 54 | vec2 w = (aaCoord-mapCenter); 55 | w.y/=(pixelSize.y/pixelSize.x); 56 | if (length(w)PreIterations) mean+=length(z); 68 | if (dot(z,z)> escape) break; 69 | } 70 | mean/=float(i-PreIterations); 71 | ci = 1.0 - log2(.5*log2(mean/C)); 72 | } else if (ColoringType == 1) { 73 | float m = 0.0; 74 | for (i = 0; i < Iterations; i++) { 75 | z = formula(z,(Julia ? c2 : c)); 76 | if (i>PreIterations) m = mix(m,length(z),ColorFactor); 77 | if (dot(z,z)> escape) break; 78 | } 79 | ci = 1.0 - log2(.5*log2(m/C)); 80 | } else if (ColoringType == 2) { 81 | for (i = 0; i < Iterations; i++) { 82 | z = formula(z,(Julia ? c2 : c)); 83 | if (dot(z,z)> escape) break; 84 | } 85 | ci = float( i) + 1.0 - log2(.5*log2(dot(z,z))); 86 | } 87 | return vec3( .5+.5*cos(6.*ci+R),.5+.5*cos(6.*ci + G),.5+.5*cos(6.*ci +B) ); 88 | } 89 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/BufferShader.frag: -------------------------------------------------------------------------------- 1 | #donotrun 2 | // This is a simple shader for rendering images 3 | // from an accumulated buffer. 4 | 5 | #vertex 6 | 7 | varying vec2 coord; 8 | 9 | void main(void) 10 | { 11 | gl_Position = gl_Vertex; 12 | coord = (gl_ProjectionMatrix*gl_Vertex).xy; 13 | } 14 | 15 | #endvertex 16 | 17 | uniform float Gamma; 18 | uniform float Exposure; 19 | uniform float Brightness; 20 | uniform float Contrast; 21 | uniform float Saturation; 22 | uniform int ToneMapping; 23 | /* 24 | ** Based on: http://mouaif.wordpress.com/2009/01/22/photoshop-gamma-correction-shader/ 25 | ** 26 | ** Contrast, saturation, brightness 27 | ** Code of this function is from TGM's shader pack 28 | ** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057 29 | */ 30 | // For all settings: 1.0 = 100% 0.5=50% 1.5 = 150% 31 | vec3 ContrastSaturationBrightness(vec3 color, float brt, float sat, float con) 32 | { 33 | const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721); 34 | vec3 AvgLumin = vec3(0.5); 35 | vec3 brtColor = color * brt; 36 | float intensityf = dot(brtColor, LumCoeff); 37 | vec3 intensity = vec3(intensityf, intensityf, intensityf); 38 | vec3 satColor = mix(intensity, brtColor, sat); 39 | vec3 conColor = mix(AvgLumin, satColor, con); 40 | return conColor; 41 | } 42 | 43 | float sigmoid(float t) { 44 | float K = 1.0-1./(1.0+exp(-0.5*Contrast*5.)); 45 | t -= 0.5; 46 | float x = 1./(1.0+exp(-t*Contrast*5.))-K; 47 | return x/((1.0-2.0*K)); 48 | } 49 | 50 | vec3 sigmoid3(vec3 t) { 51 | return vec3(sigmoid(t.x),sigmoid(t.y),sigmoid(t.z)); 52 | } 53 | 54 | 55 | 56 | varying vec2 coord; 57 | uniform sampler2D frontbuffer; 58 | void main() { 59 | vec2 pos = (coord+vec2(1.0))/2.0; 60 | vec4 tex = texture2D(frontbuffer, pos); 61 | vec3 c = tex.xyz/tex.a; 62 | 63 | 64 | 65 | if (ToneMapping==1) { 66 | // Linear 67 | c = c*Exposure; 68 | c = ContrastSaturationBrightness(c, Brightness, Saturation, Contrast); 69 | 70 | } else if (ToneMapping==2) { 71 | // ExponentialExposure 72 | c = vec3(1.0)-exp(-c*Exposure); 73 | c = ContrastSaturationBrightness(c, Brightness, Saturation, Contrast); 74 | 75 | } else if (ToneMapping==3) { 76 | // Filmic: http://filmicgames.com/archives/75 77 | c*=Exposure; 78 | vec3 x = max(vec3(0.),c-vec3(0.004)); 79 | c = (x*(6.2*x+.5))/(x*(6.2*x+1.7)+0.06); 80 | c = pow(c, vec3(2.2)); // It already takes the Gamma into acount 81 | c = ContrastSaturationBrightness(c, Brightness, Saturation, Contrast); 82 | 83 | } else if (ToneMapping==4) { 84 | // Reinhart 85 | c*=Exposure; 86 | c = c/(1.+c); 87 | c = ContrastSaturationBrightness(c, Brightness, Saturation, Contrast); 88 | } else if (ToneMapping==5) { 89 | c = sigmoid3(c*Exposure+vec3(Brightness-1.0)); 90 | 91 | } 92 | c = pow(c, vec3(1.0/Gamma)); 93 | 94 | gl_FragColor = vec4(c,1.0); 95 | } 96 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/BufferShaderIFS.frag: -------------------------------------------------------------------------------- 1 | #donotrun 2 | // This is a simple shader for rendering images 3 | // from an accumulated buffer. 4 | 5 | #vertex 6 | 7 | varying vec2 coord; 8 | 9 | void main(void) 10 | { 11 | gl_Position = gl_Vertex; 12 | coord = (gl_ProjectionMatrix*gl_Vertex).xy; 13 | } 14 | 15 | #endvertex 16 | 17 | uniform float Gamma; 18 | uniform float Exposure; 19 | uniform float Brightness; 20 | uniform float Contrast; 21 | uniform float Saturation; 22 | uniform bool ExponentialExposure; 23 | /* 24 | ** Based on: http://mouaif.wordpress.com/2009/01/22/photoshop-gamma-correction-shader/ 25 | ** 26 | ** Contrast, saturation, brightness 27 | ** Code of this function is from TGM's shader pack 28 | ** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057 29 | */ 30 | // For all settings: 1.0 = 100% 0.5=50% 1.5 = 150% 31 | vec3 ContrastSaturationBrightness(vec3 color, float brt, float sat, float con) 32 | { 33 | const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721); 34 | vec3 AvgLumin = vec3(0.5); 35 | vec3 brtColor = color * brt; 36 | float intensityf = dot(brtColor, LumCoeff); 37 | vec3 intensity = vec3(intensityf, intensityf, intensityf); 38 | vec3 satColor = mix(intensity, brtColor, sat); 39 | vec3 conColor = mix(AvgLumin, satColor, con); 40 | return conColor; 41 | } 42 | 43 | varying vec2 coord; 44 | uniform sampler2D frontbuffer; 45 | void main() { 46 | vec2 pos = (coord+vec2(1.0))/2.0; 47 | vec4 tex = texture2D(frontbuffer, pos); 48 | vec3 c =( tex.xyz)/1.0; 49 | /* 50 | if (c.x0.0) b-=2.0*3.1415; 52 | return vec2(log(length(a)),b); 53 | } 54 | 55 | vec2 cSqr(vec2 z) { 56 | return vec2(z.x*z.x-z.y*z.y,2.*z.x*z.y); 57 | } 58 | 59 | vec2 cSin(vec2 z) { 60 | return vec2(sin(z.x)*cosh(z.y), cos(z.x)*sinh(z.y)); 61 | } 62 | 63 | vec2 cCos(vec2 z) { 64 | return vec2(cos(z.x)*cosh(z.y), -sin(z.x)*sinh(z.y)); 65 | } 66 | 67 | vec2 cPower2(vec2 z, vec2 a) { 68 | return cExp(cMul(cLog(z), a)); 69 | } -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/Ditch-River-License.txt: -------------------------------------------------------------------------------- 1 | I use the Ditch-River Panorama HDR as an example in Fragmentarium. 2 | It is authored by 'Blotchi' and copyrighted by http://www.hdrlabs.com/sibl/archive.html 3 | 4 | It is licensed under a CC3.0 license: http://creativecommons.org/licenses/by-nc-sa/3.0/us/ 5 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/Ditch-River.ibl: -------------------------------------------------------------------------------- 1 | [Header] 2 | ICOfile = "Ditch-River_Thumb.jpg" 3 | PREVIEWfile = "Ditch-River_preview.jpg" 4 | Name = "Ditch River" 5 | Author = "Blochi" 6 | Location = "Skips Ditch" 7 | Comment = "A lot of concrete for a tiny river." 8 | GEOlat = 33.7017070131801400 9 | GEOlong = -117.9302716255188000 10 | Link = "http://www.hdrlabs.com/sibl/archive.html" 11 | Date = "2007:03:16" 12 | Time = "13:45:00" 13 | North = 0.500000 14 | Height = 1.600000 15 | 16 | [Background] 17 | BGfile = "Ditch-River_TMap.jpg" 18 | BGmap = 1 19 | BGu = 0.000000 20 | BGv = 0.000000 21 | BGheight = 4000 22 | 23 | [Enviroment] 24 | EVfile = "Ditch-River_Env.hdr" 25 | EVmap = 1 26 | EVu = 0.000000 27 | EVv = 0.000000 28 | EVheight = 180 29 | EVmulti = 1.192982 30 | EVgamma = 1.333333 31 | 32 | [Reflection] 33 | REFfile = "Ditch-River_2k.hdr" 34 | REFmap = 1 35 | REFu = 0.000000 36 | REFv = 0.000000 37 | REFheight = 1024 38 | REFmulti = 1.122807 39 | REFgamma = 1.578947 40 | 41 | [Sun] 42 | SUNcolor = 255,240,241 43 | SUNmulti = 1.500000 44 | SUNu = 0.172000 45 | SUNv = 0.224000 46 | 47 | [Plate1] 48 | ; actually taken much closer 49 | PLATEfile = "DSC_9738.jpg" 50 | PLATEthumb = "DSC_9738_pthumb.jpg" 51 | PLATEpreview = "DSC_9738_preview.jpg" 52 | PLATEu = 0.650000 53 | PLATEv = 0.500000 54 | PLATEroll = 0.000000 55 | PLATEhfov = 117.000000 56 | PLATErealhfov = 48.5 57 | PLATEwidth = 3872 58 | PLATEheight = 2592 59 | 60 | [Plate2] 61 | ; shot from much further away 62 | PLATEfile = "DSC_0326.jpg" 63 | PLATEthumb = "DSC_0326_pthumb.jpg" 64 | PLATEpreview = "DSC_0326_preview.jpg" 65 | PLATEu = 0.580741 66 | PLATEv = 0.477827 67 | PLATEroll = 0.000000 68 | PLATEhfov = 93.333336 69 | PLATErealhfov = 57.22 70 | PLATEwidth = 3872 71 | PLATEheight = 2592 72 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/Ditch-River_2k.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Include/Ditch-River_2k.hdr -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/Ditch-River_Env.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Include/Ditch-River_Env.hdr -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/MathUtils.frag: -------------------------------------------------------------------------------- 1 | #donotrun 2 | 3 | // Standard matrices 4 | 5 | // Return rotation matrix for rotating around vector v by angle 6 | mat3 rotationMatrix3(vec3 v, float angle) 7 | { 8 | float c = cos(radians(angle)); 9 | float s = sin(radians(angle)); 10 | 11 | return mat3(c + (1.0 - c) * v.x * v.x, (1.0 - c) * v.x * v.y - s * v.z, (1.0 - c) * v.x * v.z + s * v.y, 12 | (1.0 - c) * v.x * v.y + s * v.z, c + (1.0 - c) * v.y * v.y, (1.0 - c) * v.y * v.z - s * v.x, 13 | (1.0 - c) * v.x * v.z - s * v.y, (1.0 - c) * v.y * v.z + s * v.x, c + (1.0 - c) * v.z * v.z 14 | ); 15 | } 16 | 17 | mat3 rotationMatrixXYZ(vec3 v) { 18 | return rotationMatrix3(vec3(1.0,0.0,0.0), v.x)* 19 | rotationMatrix3(vec3(0.0,1.0,0.0), v.y)* 20 | rotationMatrix3(vec3(0.0,0.0,1.0), v.z); 21 | } 22 | 23 | // Return rotation matrix for rotating around vector v by angle 24 | mat4 rotationMatrix(vec3 v, float angle) 25 | { 26 | float c = cos(radians(angle)); 27 | float s = sin(radians(angle)); 28 | 29 | return mat4(c + (1.0 - c) * v.x * v.x, (1.0 - c) * v.x * v.y - s * v.z, (1.0 - c) * v.x * v.z + s * v.y, 0.0, 30 | (1.0 - c) * v.x * v.y + s * v.z, c + (1.0 - c) * v.y * v.y, (1.0 - c) * v.y * v.z - s * v.x, 0.0, 31 | (1.0 - c) * v.x * v.z - s * v.y, (1.0 - c) * v.y * v.z + s * v.x, c + (1.0 - c) * v.z * v.z, 0.0, 32 | 0.0, 0.0, 0.0, 1.0); 33 | } 34 | 35 | mat4 translate(vec3 v) { 36 | return mat4(1.0,0.0,0.0,0.0, 37 | 0.0,1.0,0.0,0.0, 38 | 0.0,0.0,1.0,0.0, 39 | v.x,v.y,v.z,1.0); 40 | } 41 | 42 | mat4 scale4(float s) { 43 | return mat4(s,0.0,0.0,0.0, 44 | 0.0,s,0.0,0.0, 45 | 0.0,0.0,s,0.0, 46 | 0.0,0.0,0.0,1.0); 47 | } 48 | 49 | 50 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/Progressive2D.frag: -------------------------------------------------------------------------------- 1 | #donotrun 2 | 3 | #buffer RGBA32F 4 | #buffershader "BufferShader.frag" 5 | 6 | // This is a utlity program for setting 7 | // up anti-aliased 2D rendering. 8 | 9 | #vertex 10 | 11 | #group Camera 12 | 13 | // Use this to adjust clipping planes 14 | 15 | uniform vec2 Center; slider[(-10,-10),(0,0),(10,10)] NotLockable 16 | uniform float Zoom; slider[0,1,100] NotLockable 17 | 18 | uniform vec2 pixelSize; 19 | 20 | varying vec2 coord; 21 | varying vec2 aaScale; 22 | varying vec2 viewCoord; 23 | 24 | void main(void) 25 | { 26 | float ar = pixelSize.y/pixelSize.x; 27 | gl_Position = gl_Vertex; 28 | viewCoord = (gl_Vertex).xy; 29 | coord = (((gl_ProjectionMatrix*gl_Vertex).xy*vec2(ar,1.0))/Zoom+ Center); 30 | aaScale = vec2(gl_ProjectionMatrix[0][0],gl_ProjectionMatrix[1][1])*pixelSize/Zoom; 31 | } 32 | 33 | #endvertex 34 | 35 | #group Post 36 | uniform float Gamma; slider[0.0,2.2,5.0] 37 | // 1: Linear, 2: Exponential, 3: Filmic, 4: Reinhart 38 | uniform int ToneMapping; slider[1,1,4] 39 | uniform float Exposure; slider[0.0,1.0,30.0] 40 | uniform float Brightness; slider[0.0,1.0,5.0]; 41 | uniform float Contrast; slider[0.0,1.0,5.0]; 42 | uniform float Saturation; slider[0.0,1.0,5.0]; 43 | 44 | uniform float AARange; slider[0.0,2.,15.3] 45 | uniform float AAExp; slider[0.0,1,15.3] 46 | uniform bool GaussianAA; checkbox[true] 47 | 48 | varying vec2 coord; 49 | varying vec2 aaScale; 50 | varying vec2 viewCoord; 51 | vec2 aaCoord; 52 | uniform vec2 pixelSize; 53 | 54 | #ifdef providesFiltering 55 | vec4 color(vec2 z) ; 56 | #else 57 | vec3 color(vec2 z) ; 58 | #endif 59 | 60 | #ifdef providesInit 61 | void init(); // forward declare 62 | #endif 63 | 64 | uniform int subframe; 65 | 66 | vec2 rand(vec2 co){ 67 | // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html 68 | return 69 | vec2(fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453), 70 | fract(cos(dot(co.xy ,vec2(4.898,7.23))) * 23421.631)); 71 | } 72 | 73 | uniform sampler2D backbuffer; 74 | 75 | 76 | vec2 uniformDisc(vec2 co) { 77 | if (co == vec2(0.0)) return vec2(0.0); 78 | vec2 r = rand(co); 79 | return sqrt(r.y)*vec2(cos(r.x*6.28),sin(r.x*6.28)); 80 | } 81 | 82 | void main() { 83 | aaCoord = viewCoord; 84 | #ifdef providesInit 85 | init(); 86 | #endif 87 | // vec2 r = rand(viewCoord*(float(subframe)+1.0))-vec2(0.5); 88 | #ifdef providesFiltering 89 | vec4 prev = texture2D(backbuffer,(viewCoord+vec2(1.0))/2.0); 90 | vec4 new = color(coord.xy); 91 | #ifdef linearGamma 92 | gl_FragColor = prev+ new; 93 | #else 94 | gl_FragColor = prev+vec4( pow(new.xyz,vec3(Gamma)) , new.w); 95 | #endif 96 | #else 97 | vec2 r = uniformDisc(vec2( 1.0*(float(subframe+1)) )); 98 | float w =1.0; 99 | if (GaussianAA) { 100 | // Gaussian 101 | w= exp(-dot(r,r)/AAExp)-exp(-1.0/AAExp); 102 | 103 | // Lancos 104 | // w = sin(r.x)*sin(r.x/AARange)*sin(r.y)*sin(r.y/AARange)/(r.x*r.x*r.y*r.y*AARange*AARange); 105 | // if (w!=w) w = 1.0; 106 | } // else { w =pow( 1.0-length(r),1.0);}; 107 | 108 | r*=AARange; 109 | vec2 c = coord.xy+aaScale*r; 110 | #ifdef linearGamma 111 | vec3 color = color(c); 112 | #else 113 | vec3 color = pow( color(c),vec3(Gamma)); 114 | #endif 115 | 116 | vec4 prev = texture2D(backbuffer,(viewCoord+vec2(1.0))/2.0); 117 | 118 | if (color!=color) { color =vec3( 0.0); w = 0.0; } // NAN check 119 | gl_FragColor = prev+vec4(color*w, w); 120 | #endif 121 | } 122 | 123 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/Progressive2DJulia.frag: -------------------------------------------------------------------------------- 1 | #donotrun 2 | #include "Progressive2D.frag" 3 | 4 | // Number of iterations 5 | uniform int Iterations; slider[1,200,1000] 6 | 7 | // Skip this number of iterations before starting coloring 8 | uniform int PreIterations; slider[0,1,1000] 9 | 10 | uniform float R; slider[0,0,1] 11 | uniform float G; slider[0,0.4,1] 12 | uniform float B; slider[0,0.7,1] 13 | uniform float C; slider[0,1,2] 14 | uniform bool Julia; checkbox[true] 15 | uniform float JuliaX; slider[-15,0.23528,8] 16 | uniform float JuliaY; slider[-15,5.53840,8] 17 | 18 | void init() {} 19 | 20 | vec2 formula(vec2 p, vec2 c); 21 | 22 | vec2 c2 = vec2(JuliaX,JuliaY); 23 | 24 | vec2 mapCenter = vec2(0.5,0.5); 25 | float mapRadius =0.4; 26 | uniform bool ShowMap; checkbox[true] 27 | uniform float MapZoom; slider[0.01,2.1,6] 28 | uniform float EscapeSize; slider[0,5,11] 29 | float escape = pow(10.0,EscapeSize); 30 | vec3 getMapColor2D(vec2 c) { 31 | vec2 p = (aaCoord-mapCenter)/(mapRadius); 32 | p*=MapZoom; p.x/=pixelSize.x/pixelSize.y; 33 | if (abs(p.x)<4.0*pixelSize.y*MapZoom) return vec3(0.0,0.0,0.0); 34 | if (abs(p.y)<4.0*pixelSize.x*MapZoom) return vec3(0.0,0.0,0.0); 35 | p +=vec2(JuliaX, JuliaY) ; 36 | float mean = 0.0; 37 | vec2 z = p; 38 | int Iter = 200; // 'const int' crashes on my ATI card? 39 | int i = 0; 40 | for (i = 0; i < Iter; i++) { 41 | z = formula(z, p); 42 | mean+=length(z); 43 | if (dot(z,z)> escape) break; 44 | } 45 | mean/=float(i); 46 | float co = 1.0 - log2(.5*log2(mean/0.5)); 47 | return vec3( .5+.5*cos(6.2831*co+0.5),.5+.5*cos(6.2831*co + 0.5),.5+.5*cos(6.2831*co +0.5) ); 48 | 49 | } 50 | 51 | uniform int ColoringType; slider[0,0,2] 52 | uniform float ColorFactor; slider[0,0.5,1] 53 | 54 | vec3 color(vec2 c) { 55 | if (ShowMap && Julia) { 56 | vec2 w = (aaCoord-mapCenter); 57 | w.y/=(pixelSize.y/pixelSize.x); 58 | if (length(w)PreIterations) mean+=length(z); 70 | if (dot(z,z)> escape && i>PreIterations) break; 71 | } 72 | mean/=float(i-PreIterations); 73 | ci = 1.0 - log2(.5*log2(mean/C)); 74 | } else if (ColoringType == 1) { 75 | float m = 0.0; 76 | for (i = 0; i < Iterations; i++) { 77 | z = formula(z,(Julia ? c2 : c)); 78 | if (i>PreIterations) m = mix(m,length(z),ColorFactor); 79 | if (dot(z,z)> escape && i>PreIterations) break; 80 | } 81 | ci = 1.0 - log2(.5*log2(m/C)); 82 | } else if (ColoringType == 2) { 83 | for (i = 0; i < Iterations; i++) { 84 | z = formula(z,(Julia ? c2 : c)); 85 | if (dot(z,z)> escape && i>PreIterations) break; 86 | } 87 | ci = float( i) + 1.0 - log2(.5*log2(dot(z,z))); 88 | } 89 | return vec3( .5+.5*cos(6.*ci+R),.5+.5*cos(6.*ci + G),.5+.5*cos(6.*ci +B) ); 90 | } 91 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/QuilezLib.frag: -------------------------------------------------------------------------------- 1 | #donotrun 2 | // These definitions were taken from Inigo Quilez's page: 3 | // http://iquilezles.org/www/articles/distfunctions/distfunctions.htm 4 | 5 | 6 | float maxcomp(vec3 a) { 7 | return max(a.x,max(a.y,a.z)); 8 | } 9 | 10 | // Sphere - signed 11 | float sdSphere( vec3 p, float s ) 12 | { 13 | return length(p)-s; 14 | } 15 | 16 | // Box - unsigned 17 | float udBox( vec3 p, vec3 b ) 18 | { 19 | return length(max(abs(p)-b,0.0)); 20 | } 21 | 22 | // Round Box - unsigned 23 | float udRoundBox( vec3 p, vec3 b, float r ) 24 | { 25 | return length(max(abs(p)-b,0.0))-r; 26 | } 27 | 28 | // Box - signed 29 | float sdToBox( vec3 p, vec3 b ) 30 | { 31 | vec3 di = abs(p) - b; 32 | float mc = maxcomp(di); 33 | return min(mc,length(max(di,0.0))); 34 | } 35 | 36 | // Torus - signed 37 | float sdTorus( vec3 p, vec2 t ) 38 | { 39 | vec2 q = vec2(length(p.xz)-t.x,p.y); 40 | return length(q)-t.y; 41 | } 42 | 43 | // Cylinder - signed 44 | float sdCylinder( vec3 p, vec3 c ) 45 | { 46 | return length(p.xz-c.xy)-c.z; 47 | } 48 | 49 | // Cone - signed 50 | float sdCone( vec3 p, vec2 c ) 51 | { 52 | // c must be normalized 53 | float q = length(p.xy); 54 | return dot(c,vec2(q,p.z)); 55 | } 56 | 57 | // Plane - signed 58 | float sdPlane( vec3 p, vec4 n ) 59 | { 60 | // n must be normalized 61 | return dot(p,n.xyz) + n.w; 62 | } 63 | 64 | // Hexagonal Prism - unsigned 65 | float udHexPrism( vec3 p, vec2 h ) 66 | { 67 | vec3 q = abs(p); 68 | return max(q.z-h.y,max(q.x+q.y*0.57735,q.y)-h.x); 69 | } 70 | 71 | 72 | 73 | 74 | // Union 75 | float opU( float d1, float d2 ) 76 | { 77 | return min(d1,d2); 78 | } 79 | 80 | // Substraction 81 | float opS( float d1, float d2 ) 82 | { 83 | return max(-d1,d2); 84 | } 85 | 86 | // Intersection 87 | float opI( float d1, float d2 ) 88 | { 89 | return max(d1,d2); 90 | } 91 | 92 | 93 | float length8(vec2 p) { 94 | vec2 r = p*p; 95 | r = r*r; 96 | return pow(dot(r,r), (1.0/8.0)); 97 | } 98 | 99 | float length4(vec2 p) { 100 | vec2 r = p*p; 101 | return pow(dot(r,r), (1.0/4.0)); 102 | } 103 | 104 | float sdTorus88( vec3 p, vec2 t ) 105 | { 106 | vec2 q = vec2(length8(p.xz)-t.x,p.y); 107 | return length8(q)-t.y; 108 | } 109 | 110 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/Shadertoy.frag: -------------------------------------------------------------------------------- 1 | #donotrun 2 | 3 | #vertex 4 | 5 | #group Camera 6 | 7 | uniform vec2 pixelSize; 8 | varying vec3 iResolution; 9 | varying float iGlobalTime; 10 | 11 | void main(void) 12 | { 13 | gl_Position = gl_Vertex; 14 | } 15 | 16 | #endvertex 17 | 18 | #group Settings 19 | 20 | uniform vec2 pixelSize; 21 | uniform float time; 22 | vec3 iResolution = vec3(1.0/pixelSize.x, 1.0/pixelSize.y, 1.0); 23 | float iGlobalTime = time; 24 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Include/texture.jpg -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/texture2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Include/texture2.jpg -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Include/vigga.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Include/vigga.jpg -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Kaleidoscopic IFS/Dodecahedron.frag: -------------------------------------------------------------------------------- 1 | #info Dodecahedron Distance Estimator (Syntopia 2010) 2 | #define providesInit 3 | #include "DE-Raytracer.frag" 4 | #include "MathUtils.frag" 5 | #group Dodecahedron 6 | 7 | // Based on Knighty's Kaleidoscopic IFS 3D Fractals, described here: 8 | // http://www.fractalforums.com/3d-fractal-generation/kaleidoscopic-%28escape-time-ifs%29/ 9 | 10 | uniform float Scale; slider[0.0,2.617924,4.00] 11 | 12 | uniform float Phi; slider[-5,1.618,5] Locked 13 | 14 | uniform float Bailout; slider[4,9,12] Locked 15 | float bailout2 = pow(10.0,Bailout); 16 | 17 | vec3 n1 = normalize(vec3(-1.0,Phi-1.0,1.0/(Phi-1.0))); 18 | vec3 n2 = normalize(vec3(Phi-1.0,1.0/(Phi-1.0),-1.0)); 19 | vec3 n3 = normalize(vec3(1.0/(Phi-1.0),-1.0,Phi-1.0)); 20 | 21 | vec3 offset = vec3(1.0,1.0,1.0); 22 | 23 | uniform float Angle1; slider[-180,0,180] 24 | uniform vec3 Rot1; slider[(-1,-1,-1),(1,1,1),(1,1,1)] 25 | uniform float Angle2; slider[-180,0,180] 26 | uniform vec3 Rot2; slider[(-1,-1,-1),(1,1,1),(1,1,1)] 27 | 28 | mat3 fracRotation2; 29 | mat3 fracRotation1; 30 | 31 | void init() { 32 | fracRotation2 = rotationMatrix3(normalize(Rot2), Angle2); 33 | fracRotation1 = rotationMatrix3(normalize(Rot1), Angle1); 34 | } 35 | 36 | // Number of fractal iterations. 37 | uniform int Iterations; slider[0,13,100] 38 | 39 | float DE(vec3 z) 40 | { 41 | float r; 42 | 43 | // Prefolds. 44 | float t; 45 | // Iterate to compute the distance estimator. 46 | int n = 0; 47 | while (n < Iterations) { 48 | z *= fracRotation1; 49 | 50 | // t =dot(z,n1); if (t<0.0) { z-=2.0*t*n1; } <- this form is a bit slower 51 | z-=2.0 * min(0.0, dot(z, n1)) * n1; 52 | z-= 2.0 * min(0.0, dot(z, n2)) * n2; 53 | z-= 2.0 * min(0.0, dot(z, n3)) * n3; 54 | z-=2.0 * min(0.0, dot(z, n1)) * n1; 55 | z-= 2.0 * min(0.0, dot(z, n2)) * n2; 56 | z-= 2.0 * min(0.0, dot(z, n3)) * n3; 57 | z-=2.0 * min(0.0, dot(z, n1)) * n1; 58 | z-= 2.0 * min(0.0, dot(z, n2)) * n2; 59 | z-= 2.0 * min(0.0, dot(z, n3)) * n3; 60 | 61 | z = z*Scale - offset*(Scale-1.0); 62 | z *= fracRotation2; 63 | r = dot(z, z); 64 | orbitTrap = min(orbitTrap, abs(vec4(0.0,0.0,0.0,r))); 65 | if (r > bailout2) break; 66 | n++; 67 | } 68 | 69 | // Works better when subtracting -1 70 | return (length(z) ) * pow(Scale, float(-n-1)); 71 | } 72 | 73 | #preset Default 74 | FOV = 0.360217 75 | Eye = 1.81932,-3.83045,-3.01399 76 | Target = 0.435564,-0.91705,-0.721581 77 | Up = 0.0282583,0.619615,-0.784397 78 | AntiAlias = 1 79 | Detail = -2.53981 80 | DetailAO = -1.33 81 | FudgeFactor = 1 82 | MaxRaySteps = 56 83 | BoundingSphere = 5.66 84 | Dither = 0.56521 85 | AO = 0,0,0,0.77869 86 | Specular = 0.8333 87 | SpecularExp = 16 88 | SpotLight = 1,1,1,0.32609 89 | SpotLightDir = -0.39048,0.1 90 | CamLight = 1,1,1,1.26882 91 | CamLightMin = 0.15151 92 | Glow = 1,1,1,0.06947 93 | Fog = 0.08054 94 | HardShadow = 0 95 | Reflection = 0 96 | BaseColor = 1,1,1 97 | OrbitStrength = 0.49505 98 | X = 0.5,0.6,0.6,-0.9843 99 | Y = 1,0.6,0,0.4 100 | Z = 0.8,0.78,1,0.79528 101 | R = 0.4,0.7,1,0.14286 102 | BackgroundColor = 0.666667,0.333333,0 103 | GradientBackground = 0.3 104 | CycleColors = false 105 | Cycles = 1.1 106 | FloorNormal = 0,0,0 107 | FloorHeight = 0 108 | FloorColor = 1,1,1 109 | Scale = 2.61792 110 | Phi = 1.618 111 | Bailout = 9 112 | Angle1 = 0 113 | Rot1 = 1,1,1 114 | Angle2 = 0 115 | Rot2 = 1,1,1 116 | Iterations = 13 117 | #endpreset 118 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Kaleidoscopic IFS/Tetrahedron.frag: -------------------------------------------------------------------------------- 1 | #info Tetrahedron Distance Estimator (Syntopia 2010) 2 | #define providesInit 3 | #include "DE-Raytracer.frag" 4 | #include "MathUtils.frag" 5 | #group Tetrahedron 6 | // Based on Knighty's Kaleidoscopic IFS 3D Fractals, described here: 7 | // http://www.fractalforums.com/3d-fractal-generation/kaleidoscopic-%28escape-time-ifs%29/ 8 | 9 | uniform float Scale; slider[0.00,2,4.00] 10 | 11 | uniform vec3 Offset; slider[(0,0,0),(1,1,1),(1,1,1)] 12 | 13 | uniform float Angle1; slider[-180,0,180] 14 | uniform vec3 Rot1; slider[(-1,-1,-1),(1,1,1),(1,1,1)] 15 | uniform float Angle2; slider[-180,0,180] 16 | uniform vec3 Rot2; slider[(-1,-1,-1),(1,1,1),(1,1,1)] 17 | 18 | mat3 fracRotation2; 19 | mat3 fracRotation1; 20 | 21 | void init() { 22 | fracRotation2 = rotationMatrix3(normalize(Rot2), Angle2); 23 | fracRotation1 = rotationMatrix3(normalize(Rot1), Angle1); 24 | } 25 | 26 | // Number of fractal iterations. 27 | uniform int Iterations; slider[0,13,100] 28 | uniform int ColorIterations; slider[1,13,20] 29 | 30 | // The fractal distance estimation calculation 31 | float DE(vec3 z) 32 | { 33 | float r; 34 | 35 | // Iterate to compute the distance estimator. 36 | int n = 0; 37 | while (n < Iterations) { 38 | z *= fracRotation1; 39 | 40 | if(z.x+z.y<0.0) z.xy = -z.yx; 41 | if(z.x+z.z<0.0) z.xz = -z.zx; 42 | if(z.y+z.z<0.0)z.zy = -z.yz; 43 | 44 | z = z*Scale - Offset*(Scale-1.0); 45 | z *= fracRotation2; 46 | 47 | r = dot(z, z); 48 | if (n< ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z,r))); 49 | 50 | n++; 51 | } 52 | 53 | return (length(z) ) * pow(Scale, -float(n)); 54 | } 55 | 56 | #preset Default 57 | FOV = 0.4 58 | Eye = 1.40521,1.61375,-2.51193 59 | Target = -2.66394,-3.45393,5.0881 60 | Up = 0.782265,-0.622935,0.00346293 61 | AntiAlias = 1 62 | Detail = -2.23006 63 | DetailAO = -0.63 64 | FudgeFactor = 0.916 65 | MaxRaySteps = 112 66 | BoundingSphere = 2 67 | Dither = 0.22807 68 | NormalBackStep = 1 69 | AO = 0,0,0,0.96721 70 | Specular = 1.4167 71 | SpecularExp = 18.8 72 | SpotLight = 1,1,1,0.17391 73 | SpotLightDir = 0.31428,0.1 74 | CamLight = 1,1,1,1.41936 75 | CamLightMin = 0.15294 76 | Glow = 0.835294,0.0784314,0.0784314,0 77 | GlowMax = 20 78 | Fog = 0 79 | HardShadow = 0.13846 80 | ShadowSoft = 2 81 | Reflection = 0 82 | BaseColor = 1,1,1 83 | OrbitStrength = 0.515 84 | X = 0.6,0.0117647,0.0117647,0.59056 85 | Y = 1,0.6,0,0.44882 86 | Z = 1,1,1,0.49606 87 | R = 0.666667,0.666667,0.498039,0.07936 88 | BackgroundColor = 0.666667,0.666667,0.498039 89 | GradientBackground = 0.3 90 | CycleColors = false 91 | Cycles = 4.27409 92 | EnableFloor = false 93 | FloorNormal = 0,0,0 94 | FloorHeight = 0 95 | FloorColor = 1,1,1 96 | Scale = 2 97 | Offset = 1,1,1 98 | Angle1 = 0 99 | Rot1 = 1,1,1 100 | Angle2 = 0 101 | Rot2 = 1,1,1 102 | Iterations = 13 103 | ColorIterations = 13 104 | #endpreset 105 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Kali's Creations/Kalibox.frag: -------------------------------------------------------------------------------- 1 | #info Mandelbox Distance Estimator (Rrrola's version). 2 | #define providesInit 3 | #include "DE-Raytracer-v0.9.1.frag" 4 | #include "MathUtils.frag" 5 | #group Mandelbox 6 | 7 | uniform int Iterations; slider[0,17,300] 8 | uniform int ColorIterations; slider[0,3,300] 9 | uniform float MinRad2; slider[0,0.25,2.0] 10 | 11 | uniform float Scale; slider[-3.0,1.3,3.0] 12 | uniform vec3 Trans; slider[(-5,-5,-5),(0.5,0.5,0.5),(5,5,5)] 13 | uniform vec3 Julia; slider[(-5,-5,-5),(-1,-1,-1),(0,0,0)] 14 | vec4 scale = vec4(Scale, Scale, Scale, abs(Scale)) / MinRad2; 15 | 16 | uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)] 17 | uniform float RotAngle; slider[0.00,0,180] 18 | 19 | mat3 rot; 20 | 21 | void init() { 22 | rot = rotationMatrix3(normalize(RotVector), RotAngle); 23 | } 24 | 25 | float absScalem1 = abs(Scale - 1.0); 26 | float AbsScaleRaisedTo1mIters = pow(abs(Scale), float(1-Iterations)); 27 | 28 | 29 | float DE(vec3 pos) { 30 | vec4 p = vec4(pos,1), p0 = vec4(Julia,1); // p.w is the distance estimate 31 | 32 | for (int i=0; i0.0) { z-=2.0*t*n1; } 40 | t=dot(z,n2); if (t>0.0) { z-=2.0*t*n2; } 41 | z = abs(z); 42 | t=dot(z,n1); if (t>0.0) { z-=2.0*t*n1; } 43 | t=dot(z,n2); if (t>0.0) { z-=2.0*t*n2; } 44 | z = abs(z); 45 | //t=dot(z,n1); if (t>0.0) { z-=2.0*t*n1; } 46 | //t=dot(z,n2); if (t>0.0) { z-=2.0*t*n2; } 47 | 48 | //Distance to the plane going through vec3(Size,0.,0.) and which normal is plnormal 49 | return abs(dot(z-vec3(Size,0.,0.),normalize(plnormal))); 50 | } 51 | 52 | #preset Default 53 | FOV = 0.4 54 | Eye = 4.33619,0.977377,-1.02974 55 | Target = -3.61514,-1.02586,0.81858 56 | Up = -0.296733,0.362741,-0.883381 57 | AntiAlias = 1 58 | Detail = -2.60183 59 | DetailAO = -1.00002 60 | FudgeFactor = 0.90361 61 | MaxRaySteps = 66 62 | BoundingSphere = 76.364 63 | Dither = 0.26316 64 | NormalBackStep = 1 65 | AO = 0,0,0,1 66 | Specular = 0 67 | SpecularExp = 16 68 | SpotLight = 1,1,1,0.25713 69 | SpotLightDir = 0.66266,0.1 70 | CamLight = 1,1,1,1.23076 71 | CamLightMin = 0.31765 72 | Glow = 1,1,1,0.2826 73 | GlowMax = 20 74 | Fog = 0.3307 75 | HardShadow = 0.15384 76 | ShadowSoft = 2 77 | Reflection = 0 78 | BaseColor = 1,1,1 79 | OrbitStrength = 0 80 | X = 0.5,0.6,0.6,0.71428 81 | Y = 1,0.666667,0,0.71428 82 | Z = 0.8,0.78,1,0.2 83 | R = 0.666667,0.333333,0.498039,0.98076 84 | BackgroundColor = 0.6,0.6,0.45 85 | GradientBackground = 0.17235 86 | CycleColors = false 87 | Cycles = 6.36097 88 | EnableFloor = false 89 | FloorNormal = 0,0,0 90 | FloorHeight = 0 91 | FloorColor = 1,1,1 92 | Size = 0.4918 93 | plnormal = 1,-0.0495,0.70298 94 | #endpreset -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Knighty Collection/Fold_and_cut_polyhedra_examples/octahedral_polyhedra02.frag: -------------------------------------------------------------------------------- 1 | #info Icosahedral polyhedra Distance Estimator (knighty 2011) 2 | #define providesInit 3 | #include "DE-Raytracer.frag" 4 | #include "MathUtils.frag" 5 | #group Icosahedral 6 | 7 | //Cut and fold (Houdini?) technique with icosahedral folding 8 | //Well... in 2d, it's proved that any (simple?) polygon can be obtained with Cut and fold 9 | //Seems it's the same for non auto intersecting polyhedra. Right? 10 | 11 | //Size of the polyhedra 12 | uniform float Size; slider[-2.0,.5,2.00] 13 | 14 | //normal of the cutting plane 15 | uniform vec3 plnormal; slider[(-1,-1,-1),(1,0,0),(1,1,1)] 16 | 17 | #define Phi (.5*(1.+sqrt(5.))) 18 | 19 | vec3 n1 = normalize(vec3(-Phi,Phi-1.0,1.0)); 20 | vec3 n2 = normalize(vec3(1.0,-Phi,Phi+1.0)); 21 | vec3 n3 = normalize(vec3(0.0,0.0,-1.0)); 22 | 23 | void init() { 24 | } 25 | 26 | float DE(vec3 z) 27 | { 28 | float t; 29 | // Folds. 30 | //Dodecahedral 31 | z = abs(z); 32 | if (z.y>z.x) z.xy =z.yx; 33 | if (z.z>z.x) z.xz = z.zx; 34 | if (z.y>z.x) z.xy =z.yx; 35 | 36 | //Distance to the plane going through vec3(Size,0.,0.) and which normal is plnormal 37 | return abs(dot(z-vec3(Size,0.,0.),normalize(plnormal))); 38 | } 39 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/hyperbolic-tesselation-3-5-3-colored-named-00.frag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/hyperbolic-tesselation-3-5-3-colored-named-00.frag -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/hyperbolic-tesselation-5-3-n-colored-named-00.frag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/hyperbolic-tesselation-5-3-n-colored-named-00.frag -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/hyperbolic-tesselation-bifurcating-5-3-3-colored-named-00.frag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/hyperbolic-tesselation-bifurcating-5-3-3-colored-named-00.frag -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/hyperbolic-tesselation-cyclic-m-3-n-3-colored-named-00.frag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/hyperbolic-tesselation-cyclic-m-3-n-3-colored-named-00.frag -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Knighty Collection/Hyperbolic-tesselations-named/reference.txt: -------------------------------------------------------------------------------- 1 | Namings taken from: http://http://en.wikipedia.org/wiki/Convex_uniform_honeycombs_in_hyperbolic_space#.5B3.2C5.2C3.5D_family -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Knighty Collection/Mandalabeth-generic-with-jacobian/Mandalabeth-M3-jacobian.frag: -------------------------------------------------------------------------------- 1 | #version 120 2 | #info Generic M3 Mandalabeth. DE using jacobian. by knighty 3 | #include "DE-Raytracer.frag" 4 | #include "MathUtils.frag" 5 | #group Mandalabeth 6 | 7 | 8 | // Number of fractal iterations. 9 | uniform int Iterations; slider[0,9,100] 10 | 11 | // Bailout radius 12 | uniform float Bailout; slider[0,5,64] 13 | 14 | // parameter 15 | uniform float par; slider[-3,1,3] 16 | //expo 17 | uniform float expo; slider[2,6,20] 18 | 19 | 20 | //mandala 21 | vec2 mandala(vec2 p, float par, out mat2 j){ 22 | float r=length(p); 23 | float a=atan(p.y,p.x); 24 | float r1=pow(r,par), a1=a*par; 25 | j[0].x=par*r1*cos(a1); j[0].y=par*r1*sin(a1); 26 | j[1]=j[0].yx;j[1].x*=-1.0; 27 | return r1*r*vec2(cos(a1+a),sin(a1+a)); 28 | } 29 | // Compute the distance from `pos` to the Mandalabeth. 30 | float DE(vec3 p) { 31 | vec3 v=p; 32 | float r2 = dot(v,v),dr = 1.; 33 | mat3 j=mat3(1.0); 34 | 35 | for(int i = 0; i0.01); 37 | float d=min(length(z-vec2(1.,0.)),min(length(z-vec2(-0.5,0.5*sqrt(3.))),length(z-vec2(-0.5,-0.5*sqrt(3.))))); 38 | float dd=length(dz); 39 | dd=0.5*d*log(d)/dd; 40 | return max(length(pos)-2.0,(pos.z-Slope*dd)*k); 41 | } 42 | 43 | #preset Default 44 | FOV = 0.4 45 | Eye = 0.37003,1.05946,1.00204 46 | Target = -1.59756,-5.14322,-6.68219 47 | Up = -0.161329,-0.725462,0.669087 48 | AntiAlias = 1 49 | Detail = -2.37391 50 | DetailAO = -0.7 51 | FudgeFactor = 1 52 | MaxRaySteps = 56 53 | BoundingSphere = 7.8769 54 | Dither = 0.51724 55 | AO = 0,0,0,0.7 56 | Specular = 4 57 | SpecularExp = 16 58 | SpotLight = 1,1,1,0.4 59 | SpotLightDir = -0.92772,-0.92772 60 | CamLight = 1,1,1,1 61 | CamLightMin = 0.76471 62 | Glow = 1,1,1,0 63 | Fog = 0.4567 64 | HardShadow = 0 65 | Reflection = 0 66 | BaseColor = 1,1,1 67 | OrbitStrength = 1 68 | X = 0.5,0.6,0.6,0.25712 69 | Y = 1,0.6,0,0.80952 70 | Z = 0.8,0.78,1,0.06666 71 | R = 0.4,0.7,1,0.76924 72 | BackgroundColor = 0.6,0.6,0.45 73 | GradientBackground = 0.3 74 | CycleColors = true 75 | Cycles = 1.88871 76 | FloorNormal = 0,0,0 77 | FloorHeight = 0 78 | FloorColor = 1,1,1 79 | Iterations = 22 80 | Slope = 1.7432 81 | #endpreset -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Knighty Collection/Quadray/quadray01-07.frag: -------------------------------------------------------------------------------- 1 | //Aexion's Quadray formula 2 | //Script by Knighty. Added a 'Sign' parameter to the formula 3 | //Looks like there is still some work to do on the DE formula 4 | #version 120 5 | #info Quadray sets Distance Estimator 6 | #include "DE-Raytracer.frag" 7 | #include "MathUtils.frag" 8 | #group Quadray 9 | 10 | // Number of fractal iterations. 11 | uniform int Iterations; slider[0,11,100] 12 | 13 | // Bailout radius 14 | uniform float Bailout; slider[2,3.5,64] 15 | 16 | //Offset int the 4th dimension 17 | uniform float Offset; slider[-2,0,2] 18 | 19 | //sign. Actually a factor of the c value 20 | uniform float Sign; slider[-2,-1,2] 21 | 22 | const mat3x4 mc=mat3x4(vec4(.5,-.5,-.5,.5), 23 | vec4(.5,-.5,.5,-.5), 24 | vec4(.5,.5,-.5,-.5)); 25 | float DE(vec3 pos) { 26 | vec4 cp=Sign*(abs(mc*pos)+vec4(Offset)); 27 | vec4 z=cp; 28 | float r=length(z); 29 | float dr=1.; 30 | for(int i=0; i1000.0) break; 53 | if (n1000.0) break; 64 | if (n0.) { break; } 49 | //if (dZ.x*dZ.x+dZ.w*dZ.w >1000.) { break; } // faster, but not exact 50 | dZ = dcAdd(dcSqr(dZ),add); 51 | j = i; 52 | } 53 | dotZZ = dZ.x*dZ.x+dZ.z*dZ.z; // extract high part 54 | } else { 55 | vec2 c = rawC/Zoom + Center; 56 | vec2 z = vec2(0.0); 57 | for (int i = 0; i <= Iterations; i++) { 58 | if (dot(z,z)>1000.0) { break; } 59 | z = cSqr(z) + c; 60 | j = i; 61 | } 62 | dotZZ =dot(z,z); 63 | } 64 | 65 | if (j < Iterations) { 66 | // The color scheme here is based on one 67 | // from the Mandelbrot in Inigo Quilez's Shader Toy: 68 | float co = float( j) + 1.0 - log2(.5*log2(dotZZ)); 69 | co = sqrt(max(0.,co)/256.0); 70 | return vec3( .5+.5*cos(6.2831*co+R),.5+.5*cos(6.2831*co + G),.5+.5*cos(6.2831*co +B) ); 71 | } else { 72 | // Inside 73 | return vec3(0.05,0.01,0.02); 74 | } 75 | } 76 | 77 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/00 - Simple 2D system.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | 3 | // The simplest way to draw something in Fragmentarium, 4 | // is to include the "2D.frag" header. 5 | // 6 | // Now, we can implement a simple 'color' function, 7 | // which for each point in the plane returns a RGB color. 8 | // 9 | // Notice, that you can zoom using the mouse or the keyboard. 10 | // (A,S,D,W,Q,E,1,3) 11 | 12 | vec3 color(vec2 c) { 13 | return vec3(cos(c.x),sin(c.y),sin(c.x*c.y)); 14 | } 15 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/01 - Simple 2D Escape Time Fractal.frag: -------------------------------------------------------------------------------- 1 | #include "2DJulia.frag" 2 | #include "Complex.frag" 3 | 4 | // Escape time fractals iterate a functions for each point 5 | // in the plane, and check if the sequence generated converges. 6 | // 7 | // The "2DJulia.frag" helper file makes it easy to generate 8 | // these kind of systems. 9 | // 10 | // Just implement the 'formula' function below. 11 | // It is possible to draw Mandelbrots and Julias 12 | // and customize the coloring. 13 | // 14 | // Here is an example of a Mandelbrot: 15 | 16 | vec2 formula(vec2 z, vec2 offset) { 17 | z = cMul(z,z)+offset; 18 | return z; 19 | } 20 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/02 - User Variables and Presets.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | 3 | // It is easy to create custom variables, 4 | // and tie them to sliders in the user interface. 5 | // 6 | // Hint: use the context menu to quickly 7 | // insert templates for different variable types. 8 | // Here you can also see the different types 9 | // of variables. 10 | 11 | // Organize controls by grouping them 12 | #group MySystem 13 | 14 | // Creates a floating point variable, 15 | // with a slider with minimum = 0, 16 | // default = 1, and maximum 10. 17 | uniform float X; slider[0,1,10] 18 | uniform float Y; slider[0,1,10] 19 | 20 | // Use the variable like any other in the code 21 | // (But don't assign to them) 22 | vec3 color(vec2 c) { 23 | return vec3(cos(c.x*X)+sin(c.y*Y), 24 | sin(c.x*Y)+cos(c.y*X), 25 | sin(c.x*c.y)); 26 | } 27 | 28 | // It is possible to store one or more user variable 29 | // settings in a Preset. 30 | // 31 | // Preset are parsed at build time, and will 32 | // appear in the drop-down box in the Parameter 33 | // window, where they can be quickly applied. 34 | 35 | // Presets with the name 'Default' 36 | // will be automatically assigned, 37 | // when the system is built the first time. 38 | #preset Default 39 | Center = -0.221053,0.488189 40 | Zoom = 0.186907 41 | AntiAliasScale = 1 42 | AntiAlias = 1 43 | X = 1.2977 44 | #endpreset 45 | 46 | // Create presets by using the 47 | // 'Copy to Clipboard' button in the 48 | // Parameter window. 49 | #preset Preset 2 50 | Center = -0.221053,0.488189 51 | Zoom = 0.335658 52 | AntiAliasScale = 1 53 | AntiAlias = 1 54 | X = 6.8702 55 | Y = 0.3053 56 | Y = 6.3359 57 | #endpreset 58 | 59 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/03 - Dynamic Systems.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | 3 | // It is possible to change variables 4 | // based on a special uniform 'time' variable. 5 | // 6 | // To see this in action, you must 7 | // change the Render mode to 'Animation (time)' - 8 | // otherwise the system will only render changes 9 | // when something changes. 10 | 11 | #group MySystem 12 | 13 | uniform float X; slider[0,1,10] 14 | uniform float Y; slider[0,1,10] 15 | uniform float time; 16 | 17 | vec3 color(vec2 c) { 18 | return vec3(cos(c.x*X+time)+sin(c.y*Y+time*2.0), 19 | sin(c.x*Y)+cos(c.y*X+time), 20 | sin(c.x*c.y+time)); 21 | } 22 | 23 | #preset Default 24 | Center = -1.87816,-0.786641 25 | Zoom = 0.214943 26 | AntiAliasScale = 1 27 | AntiAlias = 1 28 | X = 5.0382 29 | Y = 3.0534 30 | #endpreset 31 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/04 - Textures.frag: -------------------------------------------------------------------------------- 1 | #include "2D.frag" 2 | 3 | // It is possible to read from external bitmaps 4 | // from Fragmentarium using textures. 5 | // Set up a sampler2D as below, 6 | // and read using the texture2D command. 7 | #group MySystem 8 | 9 | uniform float T ;slider[0,4,10] 10 | uniform float R; slider[0,2,10] 11 | uniform float step; slider[0,0.004,0.01] 12 | uniform float time; 13 | 14 | // Here we read from a texture 15 | // Files locations are resolved relative to the current file, 16 | // and to the include path set in the settings. 17 | uniform sampler2D texture; file[texture2.jpg] 18 | 19 | // You can set texture parameters directly: 20 | #TexParameter texture GL_TEXTURE_MAG_FILTER GL_LINEAR 21 | #TexParameter texture GL_TEXTURE_WRAP_S GL_REPEAT 22 | #TexParameter texture GL_TEXTURE_WRAP_T GL_REPEAT 23 | 24 | // A simple system based on the 'tunnel' system by Inigo Quilez: 25 | // http://www.iquilezles.org/apps/shadertoy/ 26 | vec3 color(vec2 c) { 27 | c*= 1.3+cos(time*2.0); 28 | vec2 uv; 29 | 30 | float a = atan(c.y,c.x); 31 | float r = length(c); 32 | 33 | uv.x = .5*time+.1/r; 34 | uv.y = a/3.1416 + time*0.1; 35 | vec2 dd = vec2(step,0.0); 36 | vec2 d =uv; 37 | vec3 col = texture2D(texture,d).xyz; 38 | vec3 colX = texture2D(texture,d+dd.xy).xyz; 39 | vec3 colMX = texture2D(texture,d-dd.xy).xyz; 40 | vec2 g; 41 | g.x = length(colMX)-length(colX); 42 | vec3 colY = texture2D(texture,d+dd.yx).xyz; 43 | vec3 colMY = texture2D(texture,d-dd.yx).xyz; 44 | g.y = length(colMY)-length(colY); 45 | g = normalize(g); 46 | vec2 light = vec2(cos(time*T),sin(time*T))*R; 47 | return mix(col,r*col* max(-1.0,dot(light,g)),0.9); 48 | } 49 | 50 | #preset Default 51 | Center = -0.0214904,-0.00195827 52 | Zoom = 2.34384 53 | AntiAliasScale = 1 54 | AntiAlias = 1 55 | T = 4.3511 56 | R = 2.2308 57 | step = 0.0041 58 | #endpreset 59 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/10 - Simple Distance Estimated 3D system.frag: -------------------------------------------------------------------------------- 1 | #define providesColor 2 | #include "Soft-Raytracer.frag" 3 | 4 | // This is an example of 5 | // a simple distance estimated system. 6 | // 7 | // The function "DE" must return 8 | // the distance to the closest 9 | // point on any objects in any direction. 10 | vec3 baseColor(vec3 p, vec3 n) { 11 | if (mod(length(p*10.0),2.0)<1.0) return vec3(1.0); 12 | return vec3(0.0); 13 | } 14 | 15 | float DE(vec3 z) { 16 | float d = (length(z-vec3(1.0,0.0,0.0))-1.0); // A sphere 17 | d = max(d,- (length(z.xy-vec2(1.,0.0))-0.4)); // minus a tube 18 | d = max(d,- (length(z.yz-vec2(0.,0.0))-0.4)); // minus a tube 19 | d = max(d,- (length(z.xz-vec2(1.,0.0))-0.4)); // minus a tube 20 | d = min(d, z.x); // plus a ground plane 21 | d = min(d, length(z.yz-vec2(1.,1.0))-0.3); // plus a tube 22 | return d; 23 | } 24 | 25 | #preset Default 26 | FOV = 0.4 27 | Eye = 4.76415,-4.09381,3.08941 28 | Target = -1.17452,2.39263,-1.67067 29 | Up = 0.803593,0.507247,-0.311349 30 | #endpreset 31 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/11 - Simple Distance Estimated 3D fractal.frag: -------------------------------------------------------------------------------- 1 | #include "DE-Raytracer.frag" 2 | 3 | // Here one of the simplest fractals, 4 | // a distance estimated Menger cube. 5 | #group Menger 6 | uniform int Iterations; slider[0,8,100] 7 | uniform int ColorIterations; slider[0,8,100] 8 | uniform float Scale; slider[0.00,3.0,4.00] 9 | uniform vec3 Offset; slider[(0,0,0),(1,1,1),(1,1,1)] 10 | 11 | float DE(vec3 z) 12 | { 13 | int n = 0; 14 | while (n < Iterations) { 15 | z = abs(z); 16 | if (z.x0.0) a = 1.0-a; 22 | return vec3(a); 23 | } 24 | 25 | 26 | 27 | 28 | #preset Default 29 | Center = 0.0727965,-0.192122 30 | Zoom = 0.141329 31 | Gamma = 2.2 32 | ToneMapping = 1 33 | Exposure = 1 34 | Brightness = 1 35 | Contrast = 1 36 | Saturation = 1 37 | AARange = 4.15701 38 | AAExp = 1.81626 39 | GaussianAA = true 40 | #endpreset 41 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/21 - Progressive 2D Escape Time Fractal.frag: -------------------------------------------------------------------------------- 1 | #include "Progressive2DJulia.frag" 2 | #include "Complex.frag" 3 | 4 | // An example of Escape Time Fractals, 5 | // using progressive rendering. 6 | // Bbuffers are set up by the 'Progressive2DJulia' fragment. 7 | // 8 | // Remember to set 'Render mode' to 'Continous'. 9 | // Progressive rendering, makes very high-quality AA possible. 10 | 11 | // Fractal by Kali: http://www.fractalforums.com/new-theories-and-research/very-simple-formula-for-fractal-patterns/msg31800/#msg31800 12 | 13 | uniform float MinRadius; slider[0,0,10] 14 | uniform float Scaling; slider[-5,0,5] 15 | 16 | vec2 formula(vec2 z,vec2 c) { 17 | float m =dot(z,z); 18 | if (m0.08) return (rand(time*z) < 0.5 ? vec3(1.0,0.0,0.0) : vec3(0.0)); 46 | vec4 v1 = texture2D( backbuffer, mod ( position , 1.0 ) ); 47 | int neighbours = 0; 48 | int alive =0; 49 | isAlive(0.0,0.0,alive); 50 | 51 | // Count neighbours 52 | isAlive(1.0,0.0, neighbours); 53 | isAlive(1.0,1.0, neighbours); 54 | isAlive(1.0,-1.0, neighbours); 55 | isAlive(0.0,1.0, neighbours); 56 | isAlive(0.0,-1.0, neighbours); 57 | isAlive(-1.0,1.0, neighbours); 58 | isAlive(-1.0,0.0, neighbours); 59 | isAlive(-1.0,-1.0, neighbours); 60 | 61 | // Rules 62 | if (alive==1) { 63 | if (neighbours<2) return vec3(v1.x*0.99,v1.y*0.99,v1.z); 64 | else if (neighbours<4) return vec3(1.0); 65 | } else { 66 | if (neighbours==3) return vec3(1.0); 67 | } 68 | 69 | return vec3(v1.x*0.95,v1.y*0.98,v1.z*0.999) ; 70 | } 71 | 72 | 73 | #preset Default 74 | Center = 0,0 75 | Zoom = 6.15279 76 | AntiAliasScale = 1 77 | AntiAlias = 1 78 | #endpreset 79 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/24 - Pure 3D.frag: -------------------------------------------------------------------------------- 1 | #include "3D.frag" 2 | uniform sampler2D texture; file[Ditch-River_2k.hdr] 3 | uniform sampler2D texture2; file[Ditch-River_Env.hdr] 4 | 5 | // An example of working with 3D without a distance estimator 6 | 7 | // Free HDRI's: http://www.hdrlabs.com/sibl/archive.html 8 | 9 | float sphereLine(vec3 pos, vec3 dir, vec3 center, float radius, out vec3 normal) { 10 | vec3 sd=center-pos; 11 | float b = dot(dir,sd); 12 | float temp = b*b+radius*radius-dot(sd,sd); 13 | if (temp>0.0) { 14 | temp = b - sqrt(temp); // intersection distance 15 | normal = normalize((pos+temp*dir)-center); 16 | return temp; 17 | } 18 | normal = vec3(0.0); 19 | return -1.; 20 | } 21 | 22 | #define PI 3.14159265358979323846264 23 | 24 | vec3 equirectangularMap(vec3 dir, sampler2D sampler) { 25 | dir = normalize(dir); 26 | vec2 longlat = vec2(atan(dir.y,dir.x),acos(dir.z)); 27 | return texture2D(sampler,longlat/vec2(2.0*PI,PI) ).xyz; 28 | 29 | } 30 | 31 | uniform float Specular; slider[0,1,1] 32 | uniform float Diffuse;slider[0,1,1] 33 | 34 | vec3 color(vec3 pos, vec3 dir) { 35 | 36 | vec3 normal = vec3(1.0,1.0,1.0); 37 | float intersect = 10000.0; 38 | vec3 finalNormal = vec3(0.0); 39 | for (int j = 0; j < 6; j++) { 40 | float z = (float(j)-6.0)/2.0; 41 | float i = sphereLine(pos,normalize(dir),vec3(1.0,0.0+float(j),z),0.5, normal); 42 | if (i0.) { 43 | intersect =i; 44 | finalNormal = normal; 45 | } 46 | } 47 | 48 | if (intersect<10000.) { 49 | vec3 reflected = -2.0*dot(dir,finalNormal)*finalNormal+dir; 50 | vec3 col = Specular*equirectangularMap(reflected, texture); 51 | vec3 col2 = Diffuse*equirectangularMap(finalNormal, texture2); 52 | return col+col2; 53 | } 54 | vec3 col =equirectangularMap(dir,texture); 55 | return col; 56 | } 57 | 58 | 59 | 60 | #preset Default 61 | FOV = 0.4 62 | Eye = 8.42062,8.55686,-1.41974 63 | Target = 0.781867,2.10355,-1.35523 64 | Up = 0.0291443,-0.024509,0.999275 65 | EquiRectangular = false 66 | FocalPlane = 1 67 | Aperture = 0 68 | Gamma = 2.2222 69 | ToneMapping = 3 70 | Exposure = 1 71 | Brightness = 1 72 | Contrast = 1 73 | Saturation = 1 74 | GaussianWeight = 1 75 | AntiAliasScale = 2 76 | texture = Ditch-River_2k.hdr 77 | texture2 = Ditch-River_Env.hdr 78 | Specular = 1,0 79 | Diffuse = 1,0,1 80 | #endpreset 81 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/25 - Image Based Lighting.frag: -------------------------------------------------------------------------------- 1 | // An example of Image Based Lighting. 2 | // 3 | // NOTICE: 4 | // The Ditch-River Panorama HDR is authored by 'Blotchi' and copyrighted by http://www.hdrlabs.com/sibl/archive.html 5 | // It is licensed under a CC3.0 license: http://creativecommons.org/licenses/by-nc-sa/3.0/us/ 6 | #include "IBL-Raytracer.frag" 7 | #include "QuilezLib.frag" 8 | #group TestScene 9 | uniform float TextureScale; slider[0,1,40] 10 | 11 | // Just a simple test scene... 12 | float DE(vec3 p) 13 | { 14 | p.xy=p.yx; 15 | float d = length(p+vec3(0.0,0.0,-0.25))-0.25; // sphere 16 | d= min(d, udRoundBox(p+vec3(0.2,1.0,-0.25),vec3(0.2),0.05)); // rounded box 17 | d =min(d, sdCone(p+vec3(1.,1.,-0.5),vec2(0.95,0.45))); // cone 18 | d = min(d, sdTorus88(p+vec3(-1.4,1.,-0.6),vec2(0.5,0.1))); // torus 19 | return min(p.z,d);// distance estimate 20 | } 21 | 22 | #preset Default 23 | FOV = 0.58536 24 | Eye = 0.246321,-1.72201,0.434156 25 | Target = -5.5875,6.37903,-0.148662 26 | Up = -0.00420879,0.0687221,0.997349 27 | EquiRectangular = false 28 | FocalPlane = 1 29 | Aperture = 0 30 | Gamma = 2.2685 31 | ToneMapping = 3 32 | Exposure = 0.82653 33 | Brightness = 1 34 | Contrast = 1 35 | Saturation = 1 36 | GaussianWeight = 1 37 | AntiAliasScale = 2 38 | Detail = -3.65484 39 | DetailAO = -1.14289 40 | FudgeFactor = 1 41 | MaxRaySteps = 198 42 | BoundingSphere = 4.3373 43 | Dither = 0.5 44 | NormalBackStep = 1 45 | AO = 0,0,0,1 46 | CamLight = 1,1,1,0 47 | CamLightMin = 0 48 | Glow = 1,1,1,0 49 | GlowMax = 20 50 | Fog = 0 51 | Shadow = 0.70455 52 | Background = Ditch-River_2k.hdr 53 | Specular =Ditch-River_2k.hdr 54 | Diffuse =Ditch-River_env.hdr 55 | EnvSpecular = 1.8 56 | EnvDiffuse = 0 57 | SpecularMax = 100 58 | Sun = 1.38949,1.02653 59 | SunSize = 0.0045 60 | DebugSun = true 61 | BaseColor = 1,1,1 62 | OrbitStrength = 0 63 | X = 0.5,0.6,0.6,0.2126 64 | Y = 1,0.6,0,0.30708 65 | Z = 0.8,0.78,1,0.35434 66 | R = 0.666667,0.666667,0.498039,0.03174 67 | BackgroundColor = 1,1,1 68 | GradientBackground = 0.4348 69 | CycleColors = false 70 | Cycles = 1.1 71 | EnableFloor = true 72 | FloorNormal = 0,0,0.17074 73 | FloorHeight = 0 74 | FloorColor = 1,1,1 75 | ShowFloor = false 76 | TextureScale = 1 77 | #endpreset 78 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Examples/Tutorials/26 - 3D fractals without a DE.frag: -------------------------------------------------------------------------------- 1 | #info Mandelbulb without Distance Estimator 2 | 3 | #define providesInside 4 | 5 | #define providesColor 6 | 7 | #include "Brute-Raytracer.frag" 8 | #group Mandelbulb 9 | //#define IterationsBetweenRedraws 5 10 | 11 | // Number of fractal iterations. 12 | uniform int Iterations; slider[0,9,100] 13 | 14 | // Mandelbulb exponent (8 is standard) 15 | uniform float Power; slider[-10,8,10] 16 | 17 | // Bailout radius 18 | uniform float Bailout; slider[0,5,30] 19 | 20 | uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)] 21 | 22 | uniform float RotAngle; slider[0.00,0,180] 23 | 24 | uniform bool Julia; checkbox[false] 25 | uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)] 26 | 27 | vec3 color(vec3 p) { 28 | return abs(vec3(p)); 29 | } 30 | 31 | void powN2(inout vec3 z, float zr0) { 32 | float zo0 = asin( z.z/zr0 ); 33 | float zi0 = atan( z.y,z.x ); 34 | float zr = pow( zr0, Power-1.0 ); 35 | float zo = zo0 * Power; 36 | float zi = zi0 * Power; 37 | zr *= zr0; 38 | z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) ); 39 | } 40 | 41 | 42 | bool inside(vec3 pos) { 43 | vec3 z=pos; 44 | float r; 45 | int i=0; 46 | r=length(z); 47 | while(r 2 | 3 | Icons/copy.png 4 | Icons/cut.png 5 | Icons/padlocka.png 6 | Icons/padlockb.png 7 | Icons/new.png 8 | Icons/open.png 9 | Icons/paste.png 10 | Icons/save.png 11 | Icons/filesaveas.png 12 | Icons/folder.png 13 | Icons/mail_new.png 14 | Icons/render.png 15 | Icons/agt_internet.png 16 | Icons/exit.png 17 | Icons/fileclose.png 18 | Icons/documentinfo.png 19 | Icons/fragmentarium.png 20 | Icons/player_rew.png 21 | Icons/player_play.png 22 | Icons/player_stop.png 23 | 24 | 25 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Fragmentarium/GUI/FileManager.cpp: -------------------------------------------------------------------------------- 1 | #include "FileManager.h" 2 | #include "../../SyntopiaCore/Exceptions/Exception.h" 3 | #include 4 | 5 | using namespace SyntopiaCore::Exceptions; 6 | 7 | using namespace SyntopiaCore::Logging; 8 | namespace Fragmentarium { 9 | namespace GUI { 10 | 11 | QStringList FileManager::getImageFiles() { 12 | QStringList l; 13 | l << "*.jpg" << "*.jpeg" << "*.png" << "*.hdr"; 14 | return getFiles(l); 15 | 16 | } 17 | 18 | QStringList FileManager::getFiles(QStringList filters) { 19 | QString key = filters.join(";;"); 20 | if (cachedFilters.contains(key)) return cachedFilters[key]; 21 | QStringList entries; 22 | 23 | // Check relative to current file 24 | if (!originalFileName.isEmpty()) { 25 | QDir d = QFileInfo(originalFileName).absolutePath(); 26 | entries = d.entryList(filters,QDir::Files) ; 27 | } 28 | 29 | // Check relative to files in include path 30 | foreach (QString p, includePaths) { 31 | QDir d(p); 32 | entries += d.entryList(filters,QDir::Files) ; 33 | } 34 | 35 | cachedFilters[key] = entries; 36 | return entries; 37 | } 38 | 39 | bool FileManager::fileExists(QString fileName) { 40 | // First check absolute filenames 41 | if (QFileInfo(fileName).isAbsolute()) return QFileInfo(fileName).exists(); 42 | 43 | // Check relative to current file 44 | if (!originalFileName.isEmpty()) { 45 | QDir d = QFileInfo(originalFileName).absolutePath(); 46 | QString path = d.absoluteFilePath(fileName); 47 | if (QFileInfo(path).exists()) return true; 48 | } 49 | 50 | // Check relative to files in include path 51 | foreach (QString p, includePaths) { 52 | QString path = QDir(p).absoluteFilePath(fileName); 53 | if (QFileInfo(path).exists()) return true; 54 | } 55 | 56 | return false; 57 | } 58 | 59 | QString FileManager::resolveName(QString fileName) { 60 | return resolveName(fileName, originalFileName); 61 | } 62 | 63 | QString FileManager::resolveName(QString fileName, QString originalFileName) { 64 | // First check absolute filenames 65 | if (QFileInfo(fileName).isAbsolute() && QFileInfo(fileName).exists()) return fileName; 66 | 67 | QStringList pathsTried; 68 | 69 | // Check relative to current file 70 | if (!originalFileName.isEmpty()) { 71 | QDir d = QFileInfo(originalFileName).absolutePath(); 72 | QString path = d.absoluteFilePath(fileName); 73 | if (QFileInfo(path).exists()) return path; 74 | pathsTried.append(path); 75 | } 76 | 77 | // Check relative to files in include path 78 | foreach (QString p, includePaths) { 79 | QDir d(p); 80 | QString path = d.absoluteFilePath(fileName); 81 | if (QFileInfo(path).exists()) return path; 82 | pathsTried.append(path); 83 | } 84 | 85 | // We failed. 86 | foreach (QString s, pathsTried) { 87 | INFO("Tried path: " + s); 88 | } 89 | throw Exception("Could not resolve path for file: " + fileName); 90 | } 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Fragmentarium/GUI/FileManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "SyntopiaCore/Logging/Logging.h" 10 | 11 | 12 | /// Small class for handling include paths 13 | namespace Fragmentarium { 14 | namespace GUI { 15 | 16 | class FileManager { 17 | public: 18 | FileManager() {} 19 | void setOriginalFileName(QString f) { originalFileName = f; } 20 | void setIncludePaths(QStringList paths) { includePaths = paths; } 21 | QString resolveName(QString fileName); 22 | QString resolveName(QString fileName, QString originalFileName); 23 | bool fileExists(QString fileName); 24 | QStringList getFiles(QStringList filters); 25 | QStringList getImageFiles(); 26 | 27 | 28 | private: 29 | QString originalFileName; 30 | QStringList includePaths; 31 | QMap cachedFilters; 32 | }; 33 | 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Fragmentarium/GUI/OutputDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | namespace Fragmentarium { 23 | namespace GUI { 24 | class OutputDialog : public QDialog 25 | { 26 | Q_OBJECT 27 | public: 28 | OutputDialog(QWidget* parent, int w, int h); 29 | ~OutputDialog(); 30 | int getTiles(); 31 | float getPadding(); 32 | int getFrames() { return frameSpinBox->value(); } 33 | int getFPS() {return fpsSpinBox->value(); } 34 | int getMaxTime() {return animCheckBox->isChecked() ? endTimeSpinBox->value() : 0; } 35 | bool preview() { return previewFrameCheckbox->isChecked(); } 36 | 37 | public slots: 38 | void animationChanged(); 39 | void previewToggled(bool); 40 | void chooseFile(); 41 | void updateTotalTiles(int); 42 | void tilesChanged(int); 43 | void updateFileName(const QString &); 44 | void updateFileName(); 45 | QString getFileName(); 46 | QString getFragmentFileName(); 47 | bool doSaveFragment() { return autoSaveCheckBox; } 48 | 49 | private: 50 | QString uniqueFileName; 51 | QCheckBox* previewFrameCheckbox; 52 | int width; 53 | int height; 54 | QVBoxLayout *verticalLayout; 55 | QLabel *label; 56 | QSlider *tilesSlider; 57 | QSpacerItem *verticalSpacer; 58 | QHBoxLayout *horizontalLayout_4; 59 | QSpinBox *filterSizeSpinBox; 60 | QSpacerItem *horizontalSpacer_3; 61 | QSpacerItem *verticalSpacer_2; 62 | QSpacerItem *verticalSpacer_3; 63 | QHBoxLayout *horizontalLayout; 64 | QLabel *label_3; 65 | QLineEdit *filenameEdit; 66 | QPushButton *fileButton; 67 | QHBoxLayout *horizontalLayout_2; 68 | QSpacerItem *horizontalSpacer; 69 | QCheckBox* animCheckBox; 70 | QCheckBox *uniqueCheckBox; 71 | QLayout* fpsLayout; 72 | QLayout* endTimeLayout; 73 | 74 | QSpinBox* endTimeSpinBox; 75 | QSpinBox* fpsSpinBox; 76 | 77 | QHBoxLayout *horizontalLayout_3; 78 | QSpacerItem *horizontalSpacer_2; 79 | QCheckBox *autoSaveCheckBox; 80 | QSpacerItem *verticalSpacer_4; 81 | QDialogButtonBox *buttonBox; 82 | QSpinBox* frameSpinBox; 83 | QSlider* paddingSlider; 84 | QLabel* label5; 85 | QLabel* totalFrames; 86 | QStringList extensions; 87 | QString fragmentFileName; 88 | }; 89 | } 90 | } 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Fragmentarium/GUI/VariableEditor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "SyntopiaCore/Math/Vector3.h" 16 | #include "../Parser/Preprocessor.h" 17 | #include "SyntopiaCore/Logging/Logging.h" 18 | #include "DisplayWidget.h" 19 | 20 | /// The editor window for GUI variables (uniforms) 21 | namespace Fragmentarium { 22 | namespace GUI { 23 | 24 | using namespace SyntopiaCore::Logging; 25 | using namespace SyntopiaCore::Math; 26 | 27 | class MainWindow; // forward 28 | class ComboSlider; // forward 29 | 30 | /// The Variable Editor window. 31 | class VariableEditor : public QWidget { 32 | Q_OBJECT 33 | public: 34 | VariableEditor(QWidget* parent, MainWindow* mainWindow); 35 | 36 | void updateFromFragmentSource(Parser::FragmentSource* fs, bool* showGUI); 37 | void updateCamera(CameraControl* c); 38 | void setUserUniforms(QGLShaderProgram* shaderProgram); 39 | QString getSettings(); 40 | bool setSettings(QString text); 41 | void createGroup(QString g); 42 | VariableWidget* getWidgetFromName(QString name); 43 | void setPresets(QMap presets); 44 | ComboSlider* getCurrentComboSlider() { return currentComboSlider; } 45 | bool setDefault(); 46 | void substituteLockedVariables(Parser::FragmentSource* fs); 47 | void updateTextures(Parser::FragmentSource* fs, FileManager* fileManager); 48 | protected: 49 | bool eventFilter(QObject *obj, QEvent *ev); 50 | signals: 51 | 52 | void changed(bool lockedChanged); 53 | 54 | public slots: 55 | void sliderDestroyed(QObject* o); 56 | void focusChanged(QWidget* oldWidget,QWidget* newWidget); 57 | bool applyPreset(); 58 | void resetUniforms(); 59 | void resetUniforms(bool clear); 60 | void resetGroup(); 61 | void lockGroup(); 62 | void unlockGroup(); 63 | void copy(); 64 | void paste(); 65 | void childChanged(bool lockedChanged); 66 | 67 | private: 68 | QMap presets; 69 | MainWindow* mainWindow; 70 | QSpacerItem* spacer; 71 | QVector variables; 72 | QVBoxLayout* layout; 73 | QComboBox* presetComboBox; 74 | QWidget* currentWidget; 75 | 76 | QMap tabs; 77 | QMap spacers; 78 | QTabWidget* tabWidget; 79 | ComboSlider* currentComboSlider; 80 | }; 81 | 82 | 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Fragmentarium/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "Fragmentarium/GUI/MainWindow.h" 7 | 8 | // Needed for unicode commandline below. 9 | #ifdef Q_WS_WIN 10 | #define WIN32_LEAN_AND_MEAN 11 | #include "windows.h" 12 | #endif 13 | 14 | int main(int argc, char *argv[]) 15 | { 16 | Q_INIT_RESOURCE(Fragmentarium); 17 | //QApplication::setStyle("cleanlooks"); 18 | QApplication app(argc, argv); 19 | 20 | QCoreApplication::setOrganizationName("Syntopia Software"); 21 | QCoreApplication::setApplicationName("Fragmentarium"); 22 | 23 | QPixmap pixmap(QDir(Fragmentarium::GUI::MainWindow::getMiscDir()).absoluteFilePath("splash.png")); 24 | QSplashScreen splash(pixmap, Qt::WindowStaysOnTopHint); 25 | splash.setMask(pixmap.mask()); 26 | splash.show(); 27 | qApp->processEvents(); 28 | 29 | // We will parse for filenames. 30 | // On Windows 'argv*' is not of much use, since it fails for Unicode paths. 31 | // We will fetch the unicode strings... 32 | QStringList args; 33 | 34 | // QtCreator on Windows fails to link with CommandLineToArgvW, so unicode is disabled for now... 35 | #ifdef Q_WS_WIN_DISABLED 36 | // On Windows we call this Win32 call... 37 | int nArgs = 0; 38 | LPWSTR* wargv = CommandLineToArgvW(GetCommandLineW(), &nArgs); 39 | for (int i = 0; i < nArgs; i++) { args.append(QString::fromUtf16((const ushort *)wargv[i])); } 40 | #else 41 | // Other platforms must implement their unicode parsing here... 42 | // I believe Linux and Unix will store UTF8 in the argv array. 43 | for (int i = 0; i < argc; i++) { 44 | args.append(QString::fromUtf8(argv[i])); 45 | } 46 | #endif 47 | 48 | Fragmentarium::GUI::MainWindow *mainWin; 49 | if (args.size() <= 1) { 50 | mainWin = new Fragmentarium::GUI::MainWindow(&splash); 51 | } else { 52 | // We ignore more then one argument 53 | mainWin = new Fragmentarium::GUI::MainWindow(&splash,args[1]); 54 | } 55 | mainWin->setSplashWidget(&splash); 56 | mainWin->show(); 57 | return app.exec(); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/agt_internet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/agt_internet.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/copy.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/cut.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/documentinfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/documentinfo.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/exit.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileclose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileclose.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/Fragmentarium-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/Fragmentarium-16.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/Fragmentarium-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/Fragmentarium-256.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/Fragmentarium.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/Fragmentarium.icns -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/Fragmentarium.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/Fragmentarium.ico -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/FragmentariumDoc-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/FragmentariumDoc-256.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/FragmentariumDoc.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/FragmentariumDoc.icns -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/FragmentariumDoc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/FragmentariumDoc.ico -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/icon.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/icon.pdn -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fileicons/icon2.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fileicons/icon2.pdn -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/filesaveas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/filesaveas.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/folder.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/fragmentarium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/fragmentarium.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/mail_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/mail_new.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/new.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/open.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/padlocka.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/padlocka.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/padlockb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/padlockb.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/paste.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/player_eject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/player_eject.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/player_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/player_pause.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/player_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/player_play.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/player_rew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/player_rew.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/player_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/player_stop.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/render.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/render.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/save.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Icons/saveas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Icons/saveas.png -------------------------------------------------------------------------------- /Fragmentarium-Source/LICENSE.README: -------------------------------------------------------------------------------- 1 | This software is licensed under either LGPL 2.1 ("LICENSE.LGPL") or GPL 3 ("LICENSE.GPL3"). 2 | 3 | The choice of license is determined and inherited from the version of Qt used. 4 | See: http://www.qtsoftware.com/products/licensing for more info. 5 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Misc/about.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Misc/about.html -------------------------------------------------------------------------------- /Fragmentarium-Source/Misc/control.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | Notice: the 3D view must have keyboard focus! 4 |

5 |

2D

6 |

7 |

    8 |
  • Left mousebutton: translate center.
  • 9 |
  • Right mousebutton: zoom.
  • 10 |
  • Wheel: zoom
  • 11 |
  • A/D: left/right
  • 12 |
  • W/S: up/down
  • 13 |
  • Q/E: zoom in/out
  • 14 |
15 |

16 | 17 |

3D

18 |

19 |

    20 |
  • Left mousebutton: change camera direction.
  • 21 |
  • Right mousebutton: move camera in screen plane.
  • 22 |
  • Left+Right mousebutton: zoom.
  • 23 |
  • Shift+Left mousebutton: rotate object (around origo).
  • 24 |
  • Wheel: Move forward/backward
  • 25 |
  • W/S: move forward/back.
  • 26 |
  • A/D: move left/right.
  • 27 |
  • Q/E: roll
  • 28 |
  • 1/3: increase/decrease step size x2
  • 29 |
  • 2/X: increase/decrease step size x10
  • 30 |
  • Shift+Wheel: change step size
  • 31 |
  • T/H: move up/down.
  • 32 |
  • R/F: yaw
  • 33 |
  • T/G: pitch
  • 34 |
35 |

36 | 37 |

Sliders

38 |

39 | When a (float) slider recieves focus, its background color will change. It is then possible to finetune it using: 40 |

    41 |
  • Arrow Left/Right: increase/decrease slider.
  • 42 |
  • Arrow Up/Down: increase/decrase step size.
  • 43 |
44 | 45 |

46 | 47 | 48 | -------------------------------------------------------------------------------- /Fragmentarium-Source/Misc/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Misc/icon.jpg -------------------------------------------------------------------------------- /Fragmentarium-Source/Misc/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/Fragmentarium-Source/Misc/splash.png -------------------------------------------------------------------------------- /Fragmentarium-Source/Roadmap.txt: -------------------------------------------------------------------------------- 1 | Roadmap 2 | 3 | V0.9.12 (august 2012) 4 | ------ 5 | + HDRI Panorama for background, lighting, and specular. 6 | + 2D shader: both a AntiAliasScale and a AASize... 7 | + control wrapping and sampling of textures (#texture Name ...) 8 | + TextureManager 9 | + Delete unused textures 10 | + TextureGUIWidget 11 | + Has layout issues 12 | + Always Locked 13 | + Serialization 14 | + IBL-raytracer: name, debug sun toggle 15 | + Limit number of frames in continous mode. 16 | 17 | V1.0.0 (august 2013) 18 | ------ 19 | + Non-DE raytracer 20 | + Padding for high resolution rendering 21 | + New Progressive and Animation mode. 22 | + New output dialog 23 | 24 | V1.5 (christmas 2013) 25 | ---- 26 | - Path tracer 27 | - Fix BufferShader, so that it can handle GUI widgets... 28 | - Keyframe Animation. 29 | 30 | Other (prioritized) ideas: 31 | -------------------------- 32 | - Export in RGBE 33 | - A 2D camera which scales from the current mouse position 34 | - Mouse sensitivity 35 | - Fix: icons 36 | - Commandline support 37 | - WebGL export [Difficult, has made some experiments] 38 | - Check for updates 39 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Exceptions/Exception.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace SyntopiaCore { 4 | namespace Exceptions { 5 | 6 | /// A base exception class. 7 | /// 8 | /// When using Exceptions: 9 | /// (1) Throw temporaries (throw Exception("Error occoured");) 10 | /// (2) Catch by reference ( try {} catch (Exception& e) {} ) 11 | /// 12 | /// (Perhaps this ought to inherit from std::exception?) 13 | class Exception { 14 | 15 | public: 16 | /// Constructor. 17 | Exception(QString message) : message(message) {} 18 | 19 | /// Returns the error message. 20 | QString getMessage() const { return message; } 21 | 22 | private: 23 | QString message; 24 | 25 | }; 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Logging/ListWidgetLogger.cpp: -------------------------------------------------------------------------------- 1 | #include "ListWidgetLogger.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace SyntopiaCore { 8 | namespace Logging { 9 | namespace { 10 | class ListWidget : public QListWidget { 11 | public: 12 | ListWidget(QWidget* parent) : QListWidget(parent) { 13 | } 14 | 15 | void contextMenuEvent(QContextMenuEvent* ev) { 16 | QMenu contextMenu; 17 | QAction copyAction("Copy to Clipboard", &contextMenu); 18 | QAction clearAction("Clear", &contextMenu); 19 | contextMenu.addAction(©Action); 20 | contextMenu.addAction(&clearAction); 21 | QAction* choice = contextMenu.exec(ev->globalPos()); 22 | if (choice == ©Action) { 23 | QClipboard *clipboard = QApplication::clipboard(); 24 | QList items = selectedItems(); 25 | QStringList l; 26 | foreach (QListWidgetItem* i, items) { 27 | l.append(i->text()); 28 | } 29 | INFO(QString("Copied %1 lines to clipboard").arg(l.count())); 30 | clipboard->setText(l.join("\n")); 31 | 32 | } else if (choice == &clearAction) { 33 | clear(); 34 | } 35 | } 36 | }; 37 | } 38 | 39 | ListWidgetLogger::ListWidgetLogger(QWidget* parent) : parent(parent) { 40 | listWidget = new ListWidget(parent); 41 | listWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); 42 | } 43 | 44 | ListWidgetLogger::~ListWidgetLogger() { 45 | } 46 | 47 | void ListWidgetLogger::log(QString message, LogLevel priority) { 48 | if (listWidget->count() > 100) { 49 | listWidget->setUpdatesEnabled(false); 50 | while (listWidget->count() > 20) { 51 | delete(listWidget->takeItem(0)); 52 | } 53 | listWidget->setUpdatesEnabled(true); 54 | } 55 | 56 | 57 | QListWidgetItem* i = new QListWidgetItem(message, listWidget); 58 | 59 | // Levels: NoneLevel, DebugLevel, TimingLevel, InfoLevel, WarningLevel, CriticalLevel, AllLevel 60 | 61 | if ( priority == InfoLevel ) { 62 | i->setBackgroundColor(QColor(255,255,255)); 63 | } else if ( priority == ScriptInfoLevel ) { 64 | i->setBackgroundColor(QColor(50,50,50)); 65 | i->setForeground(QBrush(QColor(255,255,255))); 66 | QFont f = i->font(); 67 | f.setBold(true); 68 | i->setFont(f); 69 | } else if ( priority == WarningLevel ) { 70 | parent->show(); 71 | i->setBackgroundColor(QColor(255,243,73)); 72 | } else if ( priority == CriticalLevel ) { 73 | parent->show(); 74 | i->setBackgroundColor(QColor(255,2,0)); 75 | } else if ( priority == TimingLevel ) { 76 | parent->show(); 77 | i->setBackgroundColor(QColor(25,255,0)); 78 | } else { 79 | i->setBackgroundColor(QColor(220,220,220)); 80 | } 81 | listWidget->scrollToItem(i); 82 | 83 | } 84 | 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Logging/ListWidgetLogger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | #include "Logging.h" 10 | 11 | namespace SyntopiaCore { 12 | namespace Logging { 13 | 14 | class ListWidgetLogger : public Logger { 15 | public: 16 | ListWidgetLogger(QWidget* parent); 17 | 18 | virtual ~ListWidgetLogger(); 19 | 20 | /// This method all loggers must implement 21 | void log(QString message, LogLevel priority); 22 | 23 | QListWidget* getListWidget() { return listWidget; } 24 | 25 | private: 26 | QListWidget* listWidget; 27 | QWidget* parent; 28 | }; 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Logging/Logging.cpp: -------------------------------------------------------------------------------- 1 | #include "Logging.h" 2 | 3 | #ifdef WIN32 4 | #include "windows.h" 5 | #endif 6 | 7 | namespace SyntopiaCore { 8 | namespace Logging { 9 | QVector Logger::loggers; 10 | QStack Logger::timeStack; 11 | QStack Logger::timeStringStack; 12 | 13 | void LOG(QString message, LogLevel priority) { 14 | 15 | // On Windows this allows us to see debug in the Output::Debug window while running. 16 | #ifdef WIN32 17 | OutputDebugString((LPCWSTR) (message+"\r\n").utf16()); 18 | #endif 19 | 20 | for (int i = 0; i < Logger::loggers.size(); i++) { 21 | Logger::loggers[i]->log(message, priority); 22 | } 23 | } 24 | 25 | /// Useful aliases 26 | void Debug(QString text) { LOG(text, DebugLevel); } 27 | void INFO(QString text) { LOG(text, InfoLevel); } 28 | void SCRIPTINFO(QString text) { LOG(text, ScriptInfoLevel); } 29 | void WARNING(QString text) { LOG(text, WarningLevel); } 30 | void CRITICAL(QString text) { LOG(text, CriticalLevel); } 31 | 32 | void TIME(QString text) { 33 | LOG(text, TimingLevel); 34 | 35 | Logger::timeStack.push(QTime::currentTime()); 36 | Logger::timeStringStack.push(text); 37 | } 38 | 39 | void TIME(int repetitions) { 40 | QTime t = Logger::timeStack.pop(); 41 | QString s = Logger::timeStringStack.pop(); 42 | int secs = t.msecsTo(QTime::currentTime()); 43 | if (repetitions == 0) { 44 | LOG(QString("Time: %1s for ").arg(secs/1000.0f) + s, TimingLevel); 45 | } else { 46 | LOG(QString("Time: %1s for %2. %3 repetitions, %4s per repetition.").arg(secs/1000.0f).arg(s) 47 | .arg(repetitions).arg((secs/repetitions)/1000.0f), TimingLevel); 48 | } 49 | } 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Logging/Logging.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace SyntopiaCore { 9 | namespace Logging { 10 | /// Predefined logging levels 11 | enum LogLevel { NoneLevel, DebugLevel, TimingLevel, InfoLevel, ScriptInfoLevel, WarningLevel, CriticalLevel, AllLevel }; 12 | 13 | /// Abstract base class for all loggers 14 | class Logger { 15 | public: 16 | /// The destructors and constructors automatically add to the list of installed loggers. 17 | Logger() { 18 | loggers.append(this); 19 | } 20 | 21 | virtual ~Logger() { 22 | // Remove from list of available loggers. 23 | for (int i = loggers.size()-1; i >= 0; i--) { 24 | if (loggers[i] == this) loggers.remove(i); 25 | } 26 | } 27 | 28 | /// This method all loggers must implement 29 | virtual void log(QString message, LogLevel priority) = 0; 30 | 31 | /// Log messages are sent to this list of loggers. 32 | static QVector loggers; 33 | static QStack timeStack; 34 | static QStack timeStringStack; 35 | private: 36 | 37 | }; 38 | 39 | 40 | void LOG(QString message, LogLevel priority); 41 | 42 | /// Useful aliases 43 | void Debug(QString text); 44 | void INFO(QString text); 45 | void SCRIPTINFO(QString text); 46 | void TIME(QString text); 47 | void TIME(int repetitions = 0); // End time... 48 | void WARNING(QString text); 49 | void CRITICAL(QString text); 50 | 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Math/Matrix4.cpp: -------------------------------------------------------------------------------- 1 | #include "Matrix4.h" 2 | 3 | 4 | namespace SyntopiaCore { 5 | namespace Math { 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Math/Random.cpp: -------------------------------------------------------------------------------- 1 | #include "Random.h" 2 | 3 | 4 | namespace SyntopiaCore { 5 | namespace Math { 6 | 7 | namespace { 8 | struct SortPair { 9 | SortPair() {} 10 | SortPair(int index, double sortValue) : index(index), sortValue(sortValue) {} 11 | int index; 12 | double sortValue; 13 | bool operator< (const SortPair& rhs) const { return sortValue < rhs.sortValue; } 14 | }; 15 | } 16 | 17 | QVector RandomNumberGenerator::getRandomIndices(int count) { 18 | QVector sp(count); 19 | for (int i = 0; i < count; i++) sp[i] = SortPair(i, getDouble()); 20 | qSort(sp); 21 | QVector out(count); 22 | for (int i = 0; i < count; i++) out[i] = sp[i].index; 23 | return out; 24 | } 25 | 26 | Vector3f RandomNumberGenerator::getUniform2D() { 27 | Vector3f v; 28 | do { 29 | v = Vector3f(getDouble(-1,1),getDouble(-1,1),0); 30 | } while (v.sqrLength()>1.0); 31 | return v; 32 | } 33 | 34 | Vector3f RandomNumberGenerator::getUniform3D() { 35 | Vector3f v; 36 | do { 37 | v = Vector3f(getDouble(-1,1),getDouble(-1,1),getDouble(-1,1)); 38 | } while (v.sqrLength()>1.0); 39 | return v; 40 | } 41 | 42 | namespace { 43 | const int UniformTableSize = 10000; // size of precalculated tables. 44 | } 45 | 46 | // Uses precalculated tables. 47 | // Initialized on first use (so init before using in multithreaded code) 48 | Vector3f RandomNumberGenerator::getUniform2DFromTable() { 49 | static QVector uniform2D; 50 | if (uniform2D.count() == 0) { 51 | for (int i = 0; i < UniformTableSize; i++) uniform2D.append(getUniform2D()); 52 | } 53 | uniformCounter2D++; 54 | if (uniformCounter2D>=uniform2D.count()) uniformCounter2D = 0; 55 | return uniform2D[uniformCounter2D]; 56 | } 57 | 58 | Vector3f RandomNumberGenerator::getUniform3DFromTable() { 59 | static QVector uniform3D; 60 | if (uniform3D.count() == 0) { 61 | for (int i = 0; i < UniformTableSize; i++) uniform3D.append(getUniform3D()); 62 | } 63 | uniformCounter3D++; 64 | if (uniformCounter3D>=uniform3D.count()) uniformCounter3D = 0; 65 | return uniform3D[uniformCounter3D]; 66 | } 67 | 68 | void RandomNumberGenerator::randomizeUniformCounter(){ 69 | uniformCounter2D = getInt(UniformTableSize); 70 | uniformCounter3D = getInt(UniformTableSize); 71 | } 72 | 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Math/Vector3.cpp: -------------------------------------------------------------------------------- 1 | #include "Vector3.h" 2 | 3 | 4 | namespace SyntopiaCore { 5 | namespace Math { 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Misc/ColorUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "ColorUtils.h" 2 | #include "../Logging/Logging.h" 3 | 4 | using namespace SyntopiaCore::Math; 5 | using namespace SyntopiaCore::Logging; 6 | 7 | 8 | namespace SyntopiaCore { 9 | namespace Misc { 10 | 11 | SyntopiaCore::Math::Vector3f ColorUtils::HSVtoRGB(SyntopiaCore::Math::Vector3f hsv) { 12 | /// Implementation based on: http://en.wikipedia.org/wiki/HSV_color_space 13 | if (hsv[0] >= 360) hsv[0]-=360; 14 | int Hi = (int)(hsv[0] / 60) % 6; 15 | double f = (hsv[0] / 60) - Hi; 16 | double p = hsv[2]*(1-hsv[1]); 17 | double q = hsv[2]*(1-f*hsv[1]); 18 | double t = hsv[2]*(1-(1-f)*hsv[1]); 19 | if (Hi == 0) return Vector3f(hsv[2],t,p); 20 | if (Hi == 1) return Vector3f(q,hsv[2],p); 21 | if (Hi == 2) return Vector3f(p,hsv[2],t); 22 | if (Hi == 3) return Vector3f(p,q,hsv[2]); 23 | if (Hi == 4) return Vector3f(t,p,hsv[2]); 24 | if (Hi == 5) return Vector3f(hsv[2],p,q); 25 | WARNING("ColorUtils::HSVtoRGB failed"); 26 | return Vector3f(0,0,0); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Misc/ColorUtils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "../Math/Vector3.h" 7 | 8 | namespace SyntopiaCore { 9 | namespace Misc { 10 | 11 | 12 | class ColorUtils { 13 | public: 14 | static SyntopiaCore::Math::Vector3f HSVtoRGB(SyntopiaCore::Math::Vector3f hsv); 15 | }; 16 | 17 | 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Misc/MiniParser.cpp: -------------------------------------------------------------------------------- 1 | #include "MiniParser.h" 2 | 3 | #include "../Logging/Logging.h" 4 | 5 | using namespace SyntopiaCore::Logging; 6 | 7 | namespace SyntopiaCore { 8 | namespace Misc { 9 | 10 | 11 | MiniParser::MiniParser( QString value, QChar separator ) : separator(separator), original(value), value(value), paramCount(0) { 12 | } 13 | 14 | MiniParser& MiniParser::getInt(int& val) { 15 | paramCount++; 16 | QString first = value.section(separator, 0,0); 17 | value = value.section(separator, 1); 18 | 19 | 20 | if (first.isEmpty()) { 21 | WARNING(QString("Expected argument number %1 for %2").arg(paramCount).arg(original)); 22 | } 23 | 24 | bool succes = false; 25 | int i = first.toInt(&succes); 26 | if (!succes) { 27 | WARNING(QString("Expected argument number %1 to be an integer. Found: %2").arg(paramCount).arg(first)); 28 | } 29 | val = i; 30 | 31 | return *this; 32 | } 33 | 34 | 35 | 36 | MiniParser& MiniParser::getBool(bool& val) { 37 | paramCount++; 38 | QString first = value.section(separator, 0,0); 39 | value = value.section(separator, 1); 40 | 41 | if (first.isEmpty()) { 42 | WARNING(QString("Expected argument number %1 for %2").arg(paramCount).arg(original)); 43 | } 44 | 45 | if (first.toLower() == "true") { 46 | val = true; 47 | } else if (first.toLower() == "false") { 48 | val = false; 49 | } else { 50 | WARNING(QString("Expected argument number %1 to be either true or false. Found: %2").arg(paramCount).arg(first)); 51 | } 52 | 53 | return *this; 54 | } 55 | 56 | MiniParser& MiniParser::getDouble(double& val) { 57 | paramCount++; 58 | QString first = value.section(separator, 0,0); 59 | value = value.section(separator, 1); 60 | 61 | if (first.isEmpty()) { 62 | WARNING(QString("Expected argument number %1 for %2").arg(paramCount).arg(original)); 63 | } 64 | 65 | bool succes = false; 66 | double d = first.toDouble(&succes); 67 | if (!succes) { 68 | WARNING(QString("Expected argument number %1 to be an double. Found: %2").arg(paramCount).arg(first)); 69 | } 70 | val = d; 71 | 72 | return *this; 73 | } 74 | 75 | MiniParser& MiniParser::getFloat(float& val) { 76 | paramCount++; 77 | QString first = value.section(separator, 0,0); 78 | value = value.section(separator, 1); 79 | 80 | if (first.isEmpty()) { 81 | WARNING(QString("Expected argument number %1 for %2").arg(paramCount).arg(original)); 82 | } 83 | 84 | bool succes = false; 85 | float d = first.toFloat(&succes); 86 | if (!succes) { 87 | WARNING(QString("Expected argument number %1 to be an float. Found: %2").arg(paramCount).arg(first)); 88 | } 89 | val = d; 90 | 91 | return *this; 92 | } 93 | 94 | 95 | 96 | } 97 | } 98 | 99 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Misc/MiniParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | 7 | namespace SyntopiaCore { 8 | namespace Misc { 9 | 10 | /// Small class for parsing values from simple text strings. 11 | class MiniParser { 12 | public: 13 | MiniParser( QString value, QChar separator = ','); 14 | 15 | MiniParser& getInt(int& val); 16 | MiniParser& getBool(bool& val); 17 | MiniParser& getDouble(double& val); 18 | MiniParser& getFloat(float& val); 19 | private: 20 | QChar separator; 21 | QString original; 22 | QString value; 23 | int paramCount ; 24 | }; 25 | 26 | } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Misc/Misc.cpp: -------------------------------------------------------------------------------- 1 | #include "Misc.h" 2 | #include 3 | #include 4 | 5 | #include "../Logging/Logging.h" 6 | 7 | using namespace SyntopiaCore::Logging; 8 | 9 | namespace SyntopiaCore { 10 | namespace Misc { 11 | 12 | QString GetImageFileName(QWidget* parent, QString label) { 13 | QList a = QImageWriter::supportedImageFormats(); 14 | QStringList allowedTypesFilter; 15 | QStringList allowedTypes; 16 | for (int i = 0; i < a.count(); i++) { 17 | allowedTypesFilter.append("*."+a[i]); 18 | allowedTypes.append(a[i]); 19 | } 20 | QString filter = "Image Files (" + allowedTypesFilter.join(" ")+")"; 21 | 22 | QString filename = QFileDialog::getSaveFileName(parent, label, QString(), filter); 23 | if (filename.isEmpty()) { 24 | INFO("User cancelled save..."); 25 | return ""; 26 | } 27 | 28 | QString ext = filename.section(".", -1).toLower(); 29 | if (!allowedTypes.contains(ext)) { 30 | WARNING("Invalid image extension."); 31 | WARNING("File must be one of the following types: " + allowedTypes.join(",")); 32 | return ""; 33 | } 34 | 35 | return filename; 36 | } 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Misc/Misc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | namespace SyntopiaCore { 9 | namespace Misc { 10 | QString GetImageFileName(QWidget* parent, QString label); 11 | } 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Misc/Persistence.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | namespace SyntopiaCore { 9 | namespace Misc { 10 | 11 | 12 | /// Util classes for making GUI settings persistent. 13 | /// (i.e. remember the state of drop-downs, line-edits, and so on). 14 | /// 15 | /// Per default, the widget is stored under its objectName, but it possible to specify 16 | /// another name (e.g. to share widget data between dialogs). 17 | /// 18 | /// Notice that widgets must be hardcoded into the cpp-file to be supported 19 | class Persistence { 20 | public: 21 | static void Store(QWidget* widget, QString storageName = QString()); 22 | static void Restore(QWidget* widget, QString storageName = QString()); 23 | static bool Contains(QString storageName); 24 | static QVariant Get(QString storageName); 25 | static void Put(QString storageName, QVariant value); 26 | private: 27 | static QMap& GetStore(); 28 | }; 29 | 30 | 31 | } 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /Fragmentarium-Source/SyntopiaCore/Misc/Version.cpp: -------------------------------------------------------------------------------- 1 | #include "Version.h" 2 | 3 | #include "../Logging/Logging.h" 4 | 5 | using namespace SyntopiaCore::Logging; 6 | 7 | namespace SyntopiaCore { 8 | namespace Misc { 9 | 10 | Version::Version() : revision(0), build(0), codename("") { 11 | this->major = 0; 12 | this->minor = 0; 13 | } 14 | 15 | Version::Version(int major, int minor, int revision, int build, QString codename) : revision(revision), build(build), codename(codename) { 16 | this->major = major; 17 | this->minor = minor; 18 | } 19 | 20 | QList Version::GetNewVersions(QString /*url*/) const { 21 | return QList(); 22 | } 23 | 24 | QString Version::toLongString() const { 25 | QString s = QString("%1.%2").arg(major).arg(minor); 26 | if (revision >= 0) s+= QString(".%3").arg(revision); 27 | if (build >= 0) s+= QString(".%4").arg(build); 28 | 29 | if (!codename.isEmpty()) s+= " " + codename; 30 | 31 | return s; 32 | } 33 | 34 | bool Version::operator<(const Version &rhs) const { 35 | if (major == rhs.major) { 36 | if (minor == rhs.minor) { 37 | if (revision == rhs.revision) { 38 | return (build < rhs.build); 39 | } else { 40 | return (revision < rhs.revision); 41 | } 42 | } else { 43 | return (minor < rhs.minor); 44 | } 45 | } else { 46 | return (major < rhs.major); 47 | } 48 | 49 | } 50 | 51 | bool Version::operator>(const Version &rhs) const { 52 | if ( (*this) == rhs ) return false; 53 | return !((*this) 4 | #include 5 | 6 | 7 | namespace SyntopiaCore { 8 | namespace Misc { 9 | 10 | /// For keeping track of versions 11 | /// Having a formalized version object, can 12 | /// be helpful when checking the internet for updates. 13 | class Version { 14 | public: 15 | /// Constructor. 16 | /// Settings revision or build to -1 indicates they are not in use. 17 | Version(); 18 | Version(int major, int minor, int revision = -1, int build = -1, QString codename = ""); 19 | 20 | /// Long human-readable version. 21 | QString toLongString() const; 22 | 23 | /// Returns a list of versions, newer than 'this' version, 24 | /// by reading an XML-file from the specified URL. 25 | /// 26 | /// Todo: Implement 27 | QList GetNewVersions(QString url) const; 28 | 29 | /// Comparisons 30 | bool operator<(const Version &rhs) const; 31 | bool operator>(const Version &rhs) const; 32 | bool operator==(const Version &rhs) const; 33 | 34 | private: 35 | int major; 36 | int minor; 37 | int revision; 38 | int build; 39 | QString codename; 40 | }; 41 | 42 | 43 | } 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /Fragmentarium-Source/ThirdPartyCode/hdrloader.h: -------------------------------------------------------------------------------- 1 | 2 | /*********************************************************************************** 3 | Created: 17:9:2002 4 | FileName: hdrloader.h 5 | Author: Igor Kravtchenko 6 | 7 | Info: Load HDR image and convert to a set of float32 RGB triplet. 8 | ************************************************************************************/ 9 | 10 | class HDRLoaderResult { 11 | public: 12 | ~HDRLoaderResult() { delete[] cols; } 13 | int width, height; 14 | // each pixel takes 3 float32, each component can be of any value... 15 | float *cols; 16 | }; 17 | 18 | class HDRLoader { 19 | public: 20 | static bool load(const char *fileName, HDRLoaderResult &res); 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | *Update:* I do not plan any further releases of Fragmentarium. For an actively maintained version, please see this fork: 2 | https://github.com/3Dickulus/FragM 3 | 4 | Fragmentarium is a cross-platform application for exploring pixel based graphics on the GPU. 5 | 6 | Features: 7 | 8 | * Multi-tabbed IDE, with GLSL syntax highlighting 9 | * User widgets to manipulate parameter settings. 10 | * Different 'mouse to GLSL' mapping schemes 11 | * Modular GLSL programming - include other fragments 12 | * Includes simple raytracer for distance estimated systems 13 | * Many examples including Mandelbulb, Mandelbox, Kaleidoscopic IFS, and Julia Quaternion. 14 | 15 | Fragmentarium is built in C++, OpenGL/GLSL, and Qt 5. 16 | 17 | For more information see: 18 | http://syntopia.github.com/Fragmentarium 19 | -------------------------------------------------------------------------------- /fragmentarium-splash.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Syntopia/Fragmentarium/7f5f918793e4cac35b0648208fff0cfc7d4a2c43/fragmentarium-splash.pdn --------------------------------------------------------------------------------