├── src ├── 4klang.obj ├── intro.h ├── config.h ├── 4klang.h ├── ext.cpp ├── intro.cpp ├── ext.h ├── _windows │ └── main_rel.cpp ├── shaders │ ├── fragment_original.fs │ └── fragment.inl └── fp.h ├── music ├── satie-1f.4kp └── gymnopedies_2f.xrns ├── README.md ├── pbr_introsystem-16.1.0.sln ├── .gitignore ├── leviathan.vcproj └── leviathan.vcxproj /src/4klang.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armak/pbr-whitespace/HEAD/src/4klang.obj -------------------------------------------------------------------------------- /music/satie-1f.4kp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armak/pbr-whitespace/HEAD/music/satie-1f.4kp -------------------------------------------------------------------------------- /music/gymnopedies_2f.xrns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armak/pbr-whitespace/HEAD/music/gymnopedies_2f.xrns -------------------------------------------------------------------------------- /src/intro.h: -------------------------------------------------------------------------------- 1 | #ifndef _INTRO_H_ 2 | #define _INTRO_H_ 3 | 4 | #ifdef DEBUG 5 | #include 6 | #include "ext.h" 7 | #include "shaders/fragment.inl" 8 | 9 | 10 | void intro_init(void); 11 | int pid; 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/config.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------// 2 | // iq / rgba . tiny codes . 2008 // 3 | //--------------------------------------------------------------------------// 4 | 5 | #ifndef _CONFIG_H_ 6 | #define _CONFIG_H_ 7 | 8 | //#define CLEANDESTROY // destroy stuff (windows, glContext, ...) 9 | #define XRES 1280 10 | #define YRES 720 11 | 12 | #endif -------------------------------------------------------------------------------- /src/4klang.h: -------------------------------------------------------------------------------- 1 | // some useful song defines for 4klang 2 | #define SAMPLE_RATE 44100 3 | #define BPM 120.000000 4 | #define MAX_INSTRUMENTS 5 5 | #define MAX_PATTERNS 136 6 | #define PATTERN_SIZE_SHIFT 3 7 | #define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT) 8 | #define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE) 9 | #define SAMPLES_PER_TICK 5512 10 | #define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS) 11 | #define POLYPHONY 2 12 | #define INTEGER_16BIT 13 | #define SAMPLE_TYPE short 14 | 15 | #define WINDOWS_OBJECT 16 | 17 | // declaration of the external synth render function, you'll always need that 18 | extern "C" void __stdcall _4klang_render(void*); 19 | // declaration of the external envelope buffer. access only if you're song was exported with that option -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # "Whitespace" by Prismbeings 2 | 3 | A 4k intro (compresses to 3900 bytes with Crinkler 2.0) released at Simulaatio 2016. Download Crinkler from http://crinkler.net/ and place it as "link.exe" at the root of the project*. Both the original shader and minified are included. Compiled under VS2013, should work on newer versions as well. See releases for a compiled version. 4 | 5 | The content of the intro is licensed under CC BY-NC 4.0, more info: http://creativecommons.org/licenses/by-nc-nd/4.0/ 6 | 7 | AO solution based on XT95's "Hemispherical SDF AO": https://www.shadertoy.com/view/4sdGWN 8 | 9 | Some distance function formulas provided by "hg_sdf" by Mercury: http://mercury.sexy/hg_sdf/ 10 | 11 | (* Not needed to compile the project, but essential to produce an actual sub 4 kilobyte executable.) 12 | -------------------------------------------------------------------------------- /pbr_introsystem-16.1.0.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30501.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pbr-introsystem-2016.1", "leviathan.vcxproj", "{59C1D4F3-AE93-4A0A-B4FE-60841CA865E5}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {59C1D4F3-AE93-4A0A-B4FE-60841CA865E5}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {59C1D4F3-AE93-4A0A-B4FE-60841CA865E5}.Debug|Win32.Build.0 = Debug|Win32 16 | {59C1D4F3-AE93-4A0A-B4FE-60841CA865E5}.Release|Win32.ActiveCfg = Release|Win32 17 | {59C1D4F3-AE93-4A0A-B4FE-60841CA865E5}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /src/ext.cpp: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------// 2 | // iq / rgba . tiny codes . 2008 // 3 | //--------------------------------------------------------------------------// 4 | 5 | #ifdef WINDOWS 6 | #define WIN32_LEAN_AND_MEAN 7 | #define WIN32_EXTRA_LEAN 8 | #include 9 | #endif 10 | #include 11 | #include "glext.h" 12 | #ifdef LINUX 13 | #include 14 | #endif 15 | 16 | //--- d a t a --------------------------------------------------------------- 17 | 18 | #include "ext.h" 19 | void* myglfunc[9]; 20 | void EXT_Init( void ) 21 | { 22 | myglfunc[0] = wglGetProcAddress("glCreateProgram"); 23 | myglfunc[1] = wglGetProcAddress("glCreateShader"); 24 | myglfunc[2] = wglGetProcAddress("glShaderSource"); 25 | myglfunc[3] = wglGetProcAddress("glCompileShader"); 26 | myglfunc[4] = wglGetProcAddress("glAttachShader"); 27 | myglfunc[5] = wglGetProcAddress("glLinkProgram"); 28 | myglfunc[6] = wglGetProcAddress("glUseProgram"); 29 | myglfunc[7] = wglGetProcAddress("glUniform1i"); 30 | myglfunc[8] = wglGetProcAddress("glGetUniformLocation"); 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/intro.cpp: -------------------------------------------------------------------------------- 1 | #ifdef DEBUG 2 | #define WIN32_LEAN_AND_MEAN 3 | #define WIN32_EXTRA_LEAN 4 | #define VC_LEANMEAN 5 | #define VC_EXTRALEAN 6 | #include 7 | #include "intro.h" 8 | #include "config.h" 9 | 10 | void initShader(short* pid, const char* fs) 11 | { 12 | pid[0] = oglCreateProgram(); 13 | const int fsId = oglCreateShader(GL_FRAGMENT_SHADER); 14 | oglShaderSource(fsId,1,&fs,0); 15 | oglCompileShader(fsId); 16 | oglAttachShader(pid[0],fsId); 17 | oglLinkProgram(pid[0]); 18 | 19 | int result; 20 | char info[1536]; 21 | //oglGetObjectParameteriv( vsId, GL_OBJECT_COMPILE_STATUS_ARB, &result ); oglGetInfoLog( vsId, 1024, NULL, (char *)info ); if (!result) MessageBox(NULL, info, "", 0x00000000L); 22 | oglGetObjectParameteriv( fsId, GL_OBJECT_COMPILE_STATUS_ARB, &result); oglGetInfoLog(fsId, 1024, NULL, (char *)info); if (!result) MessageBox(NULL, info, "", 0x00000000L); 23 | oglGetObjectParameteriv( pid[0], GL_OBJECT_LINK_STATUS_ARB, &result ); oglGetInfoLog( pid[0], 1024, NULL, (char*)info ); //if (!result) MessageBox(NULL, info, "", 0x00000000L); 24 | } 25 | 26 | void intro_init(void) 27 | { 28 | EXT_Init(); 29 | initShader(&pid, fragment); 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /src/ext.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------// 2 | // iq / rgba . tiny codes . 2008 // 3 | //--------------------------------------------------------------------------// 4 | 5 | #ifndef _EXTENSIONES_H_ 6 | #define _EXTENSIONES_H_ 7 | 8 | #ifdef WINDOWS 9 | #define WIN32_LEAN_AND_MEAN 10 | #define WIN32_EXTRA_LEAN 11 | #include 12 | #endif 13 | #include 14 | #include "glext.h" 15 | 16 | 17 | #ifdef DEBUG 18 | #define NUMFUNCIONES 12 19 | #else 20 | #define NUMFUNCIONES 10 21 | #endif 22 | 23 | extern void *myglfunc[9]; 24 | 25 | 26 | #define oglCreateProgram ((PFNGLCREATEPROGRAMPROC)myglfunc[0]) 27 | #define oglCreateShader ((PFNGLCREATESHADERPROC)myglfunc[1]) 28 | #define oglShaderSource ((PFNGLSHADERSOURCEPROC)myglfunc[2]) 29 | #define oglCompileShader ((PFNGLCOMPILESHADERPROC)myglfunc[3]) 30 | #define oglAttachShader ((PFNGLATTACHSHADERPROC)myglfunc[4]) 31 | #define oglLinkProgram ((PFNGLLINKPROGRAMPROC)myglfunc[5]) 32 | #define oglUseProgram ((PFNGLUSEPROGRAMPROC)myglfunc[6]) 33 | //#define oglUniform4fv ((PFNGLUNIFORM4FVPROC)myglfunc[7]) 34 | #define oglUniform1i ((PFNGLUNIFORM1IPROC)myglfunc[7]) 35 | #define oglGetUniformLocation ((PFNGLGETUNIFORMLOCATIONARBPROC)myglfunc[8]) 36 | 37 | #ifdef DEBUG 38 | #define oglGetObjectParameteriv ((PFNGLGETOBJECTPARAMETERIVARBPROC)myglfunc[10]) 39 | #define oglGetInfoLog ((PFNGLGETINFOLOGARBPROC)myglfunc[11]) 40 | #endif 41 | 42 | // init 43 | void EXT_Init( void ); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/_windows/main_rel.cpp: -------------------------------------------------------------------------------- 1 | #define WIN32_LEAN_AND_MEAN 2 | #define WIN32_EXTRA_LEAN 3 | #define VC_LEANMEAN 4 | #define VC_EXTRALEAN 5 | #include 6 | #include 7 | #include "../config.h" 8 | #include 9 | #include "../ext.h" 10 | #include "../shaders/fragment.inl" 11 | 12 | #include "../4klang.h" 13 | #include "mmsystem.h" 14 | #include "mmreg.h" 15 | 16 | static const PIXELFORMATDESCRIPTOR pfd = { 17 | sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 18 | 32, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; 19 | 20 | static DEVMODE screenSettings = { {0}, 21 | #if _MSC_VER < 1400 22 | 0,0,148,0,0x001c0000,{0},0,0,0,0,0,0,0,0,0,{0},0,32,XRES,YRES,0,0, // Visual C++ 6.0 23 | #else 24 | 0,0,156,0,0x001c0000,{0},0,0,0,0,0,{0},0,32,XRES,YRES,{0}, 0, // Visual Studio 2005+ 25 | #endif 26 | #if(WINVER >= 0x0400) 27 | 0,0,0,0,0,0, 28 | #if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400) 29 | 0,0 30 | #endif 31 | #endif 32 | }; 33 | 34 | SAMPLE_TYPE lpSoundBuffer[MAX_SAMPLES * 2]; 35 | static HWAVEOUT hWaveOut; 36 | 37 | #pragma data_seg(".wavefmt") 38 | static WAVEFORMATEX WaveFMT = 39 | { 40 | #ifdef FLOAT_32BIT 41 | WAVE_FORMAT_IEEE_FLOAT, 42 | #else 43 | WAVE_FORMAT_PCM, 44 | #endif 45 | 2, // channels 46 | SAMPLE_RATE, // samples per sec 47 | SAMPLE_RATE*sizeof(SAMPLE_TYPE) * 2, // bytes per sec 48 | sizeof(SAMPLE_TYPE) * 2, // block alignment; 49 | sizeof(SAMPLE_TYPE) * 8, // bits per sample 50 | 0 // extension not needed 51 | }; 52 | 53 | #pragma data_seg(".wavehdr") 54 | static WAVEHDR WaveHDR = 55 | { 56 | (LPSTR)lpSoundBuffer, MAX_SAMPLES*sizeof(SAMPLE_TYPE)*2,0,0,0,0,0,0 57 | }; 58 | 59 | static MMTIME MMTime = 60 | { 61 | TIME_SAMPLES, 0 62 | }; 63 | 64 | #define FULLSCREEN 65 | //#define SHADER_DEBUG 66 | void entrypoint( void ) 67 | { 68 | // initialize window 69 | #ifdef FULLSCREEN 70 | ChangeDisplaySettings(&screenSettings,CDS_FULLSCREEN); 71 | ShowCursor(0); 72 | HDC hDC = GetDC(CreateWindow((LPCSTR)0xC018, 0, WS_POPUP | WS_VISIBLE, 0, 0, XRES, YRES, 0, 0, 0, 0)); 73 | #else 74 | HDC hDC = GetDC(CreateWindow("static", 0, WS_POPUP | WS_VISIBLE, 0, 0, XRES, YRES, 0, 0, 0, 0)); 75 | #endif 76 | 77 | // initalize opengl 78 | SetPixelFormat(hDC,ChoosePixelFormat(hDC,&pfd),&pfd); 79 | wglMakeCurrent(hDC,wglCreateContext(hDC)); 80 | EXT_Init(); 81 | 82 | // initialize, compile and link shader(s) 83 | const int pid = oglCreateProgram(); 84 | const int fsId = oglCreateShader(GL_FRAGMENT_SHADER); 85 | oglShaderSource(fsId, 1, &fragment, 0); 86 | oglCompileShader(fsId); 87 | 88 | #ifdef SHADER_DEBUG 89 | int result; 90 | char info[2048]; 91 | #define oglGetObjectParameteriv ((PFNGLGETOBJECTPARAMETERIVARBPROC) wglGetProcAddress("glGetObjectParameterivARB")) 92 | #define oglGetInfoLog ((PFNGLGETINFOLOGARBPROC) wglGetProcAddress("glGetInfoLogARB")) 93 | oglGetObjectParameteriv(fsId, GL_OBJECT_COMPILE_STATUS_ARB, &result); 94 | oglGetInfoLog(fsId, 2047, NULL, (char*)info); 95 | if(!result) 96 | { 97 | MessageBox(NULL, info, "", 0x00000000L); 98 | ExitProcess(0); 99 | } 100 | #endif 101 | 102 | oglAttachShader(pid, fsId); 103 | oglLinkProgram(pid); 104 | 105 | // initialize sound 106 | CreateThread(0, 0, (LPTHREAD_START_ROUTINE)_4klang_render, lpSoundBuffer, 0, 0); 107 | waveOutOpen(&hWaveOut, WAVE_MAPPER, &WaveFMT, NULL, 0, CALLBACK_NULL); 108 | waveOutPrepareHeader(hWaveOut, &WaveHDR, sizeof(WaveHDR)); 109 | waveOutWrite(hWaveOut, &WaveHDR, sizeof(WaveHDR)); 110 | const int to = timeGetTime(); 111 | 112 | // play intro 113 | do 114 | { 115 | waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME)); 116 | oglUseProgram(pid); 117 | oglUniform1i(oglGetUniformLocation(pid, "v"), timeGetTime() - to); 118 | glRects(-1, -1, 1, 1); 119 | SwapBuffers(hDC); 120 | } while(!GetAsyncKeyState(VK_ESCAPE) && MMTime.u.sample < 5990000); 121 | 122 | #ifdef CLEANDESTROY 123 | sndPlaySound(0,0); 124 | ChangeDisplaySettings( 0, 0 ); 125 | ShowCursor(1); 126 | #endif 127 | 128 | ExitProcess(0); 129 | } 130 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | 24 | # Visual Studio 2015 cache/options directory 25 | .vs/ 26 | # Uncomment if you have tasks that create the project's static files in wwwroot 27 | #wwwroot/ 28 | 29 | # MSTest test Results 30 | [Tt]est[Rr]esult*/ 31 | [Bb]uild[Ll]og.* 32 | 33 | # NUNIT 34 | *.VisualState.xml 35 | TestResult.xml 36 | 37 | # Build Results of an ATL Project 38 | [Dd]ebugPS/ 39 | [Rr]eleasePS/ 40 | dlldata.c 41 | 42 | # DNX 43 | project.lock.json 44 | artifacts/ 45 | 46 | *_i.c 47 | *_p.c 48 | *_i.h 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.tmp_proj 63 | *.log 64 | *.vspscc 65 | *.vssscc 66 | .builds 67 | *.pidb 68 | *.svclog 69 | *.scc 70 | 71 | # Chutzpah Test files 72 | _Chutzpah* 73 | 74 | # Visual C++ cache files 75 | ipch/ 76 | *.aps 77 | *.ncb 78 | *.opendb 79 | *.opensdf 80 | *.sdf 81 | *.cachefile 82 | 83 | # Visual Studio profiler 84 | *.psess 85 | *.vsp 86 | *.vspx 87 | *.sap 88 | 89 | # TFS 2012 Local Workspace 90 | $tf/ 91 | 92 | # Guidance Automation Toolkit 93 | *.gpState 94 | 95 | # ReSharper is a .NET coding add-in 96 | _ReSharper*/ 97 | *.[Rr]e[Ss]harper 98 | *.DotSettings.user 99 | 100 | # JustCode is a .NET coding add-in 101 | .JustCode 102 | 103 | # TeamCity is a build add-in 104 | _TeamCity* 105 | 106 | # DotCover is a Code Coverage Tool 107 | *.dotCover 108 | 109 | # NCrunch 110 | _NCrunch_* 111 | .*crunch*.local.xml 112 | nCrunchTemp_* 113 | 114 | # MightyMoose 115 | *.mm.* 116 | AutoTest.Net/ 117 | 118 | # Web workbench (sass) 119 | .sass-cache/ 120 | 121 | # Installshield output folder 122 | [Ee]xpress/ 123 | 124 | # DocProject is a documentation generator add-in 125 | DocProject/buildhelp/ 126 | DocProject/Help/*.HxT 127 | DocProject/Help/*.HxC 128 | DocProject/Help/*.hhc 129 | DocProject/Help/*.hhk 130 | DocProject/Help/*.hhp 131 | DocProject/Help/Html2 132 | DocProject/Help/html 133 | 134 | # Click-Once directory 135 | publish/ 136 | 137 | # Publish Web Output 138 | *.[Pp]ublish.xml 139 | *.azurePubxml 140 | # TODO: Comment the next line if you want to checkin your web deploy settings 141 | # but database connection strings (with potential passwords) will be unencrypted 142 | *.pubxml 143 | *.publishproj 144 | 145 | # NuGet Packages 146 | *.nupkg 147 | # The packages folder can be ignored because of Package Restore 148 | **/packages/* 149 | # except build/, which is used as an MSBuild target. 150 | !**/packages/build/ 151 | # Uncomment if necessary however generally it will be regenerated when needed 152 | #!**/packages/repositories.config 153 | # NuGet v3's project.json files produces more ignoreable files 154 | *.nuget.props 155 | *.nuget.targets 156 | 157 | # Microsoft Azure Build Output 158 | csx/ 159 | *.build.csdef 160 | 161 | # Microsoft Azure Emulator 162 | ecf/ 163 | rcf/ 164 | 165 | # Microsoft Azure ApplicationInsights config file 166 | ApplicationInsights.config 167 | 168 | # Windows Store app package directory 169 | AppPackages/ 170 | BundleArtifacts/ 171 | 172 | # Visual Studio cache files 173 | # files ending in .cache can be ignored 174 | *.[Cc]ache 175 | # but keep track of directories ending in .cache 176 | !*.[Cc]ache/ 177 | 178 | # Others 179 | ClientBin/ 180 | ~$* 181 | *~ 182 | *.dbmdl 183 | *.dbproj.schemaview 184 | *.pfx 185 | *.publishsettings 186 | node_modules/ 187 | orleans.codegen.cs 188 | 189 | # RIA/Silverlight projects 190 | Generated_Code/ 191 | 192 | # Backup & report files from converting an old project file 193 | # to a newer Visual Studio version. Backup files are not needed, 194 | # because we have git ;-) 195 | _UpgradeReport_Files/ 196 | Backup*/ 197 | UpgradeLog*.XML 198 | UpgradeLog*.htm 199 | 200 | # SQL Server files 201 | *.mdf 202 | *.ldf 203 | 204 | # Business Intelligence projects 205 | *.rdl.data 206 | *.bim.layout 207 | *.bim_*.settings 208 | 209 | # Microsoft Fakes 210 | FakesAssemblies/ 211 | 212 | # GhostDoc plugin setting file 213 | *.GhostDoc.xml 214 | 215 | # Node.js Tools for Visual Studio 216 | .ntvs_analysis.dat 217 | 218 | # Visual Studio 6 build log 219 | *.plg 220 | 221 | # Visual Studio 6 workspace options file 222 | *.opt 223 | 224 | # Visual Studio LightSwitch build output 225 | **/*.HTMLClient/GeneratedArtifacts 226 | **/*.DesktopClient/GeneratedArtifacts 227 | **/*.DesktopClient/ModelManifest.xml 228 | **/*.Server/GeneratedArtifacts 229 | **/*.Server/ModelManifest.xml 230 | _Pvt_Extensions 231 | 232 | # Paket dependency manager 233 | .paket/paket.exe 234 | 235 | # FAKE - F# Make 236 | .fake/ 237 | -------------------------------------------------------------------------------- /src/shaders/fragment_original.fs: -------------------------------------------------------------------------------- 1 | uniform int m; 2 | float PI = 3.1416; 3 | float t = m*.001; 4 | float rep = 2.0; 5 | float dist = 18.0; 6 | float scene = 0; 7 | float brg = 1.48; 8 | 9 | float ap1 = 23.0; 10 | float ap2 = 35.0; 11 | 12 | float hash(float c){return fract(sin(dot(c, 12.9898)) * 43758.5453);} 13 | mat3 rx(float a){return mat3(1.0,0.0,0.0,0.0,cos(a),-sin(a),0.0,sin(a),cos(a));} 14 | mat3 ry(float a){return mat3(cos(a),0.0,sin(a),0.0,1.0,0.0,-sin(a),0.0,cos(a));} 15 | mat3 rz(float a){return mat3(cos(a),-sin(a),0.0,sin(a),cos(a),0.0,0.0,0.0,1.0);} 16 | 17 | float box(vec3 p, vec3 b) 18 | { 19 | return max(max(abs(p.x)-b.x,abs(p.y)-b.y),abs(p.z)-b.z); 20 | } 21 | 22 | float modp(inout vec2 p, float rep) { 23 | float angle = 2*PI/rep; 24 | float a = atan(p.y, p.x) + angle/2; 25 | float c = floor(a/angle); 26 | a = mod(a,angle) - angle/2.; 27 | p = vec2(cos(a), sin(a))*length(p); 28 | if (abs(c) >= (rep/2)) c = abs(c); 29 | return c; 30 | } 31 | 32 | vec2 mod2(inout vec2 p, vec2 size) { 33 | vec2 c = floor((p + size*0.5)/size); 34 | p = mod(p + size*0.5,size) - size*0.5; 35 | return c; 36 | } 37 | 38 | float sp(vec3 p, float r) 39 | { 40 | return length(p)-r; 41 | } 42 | 43 | float caps(vec3 p, float r, float c){ 44 | return mix(length(p.xz) - r, length(vec3(p.x, abs(p.y) - c, p.z)) - r, step(c, abs(p.y))); 45 | } 46 | 47 | float map(vec3 p) 48 | { 49 | if( scene < 1 ){ 50 | float d = (p.y); 51 | vec2 r = mod2(p.zx, vec2(dist)); 52 | modp(p.zx, rep); 53 | d = min(d, box((p-vec3(0.,1,9)), vec3(9,9,0.2)) ); 54 | d = min(d, box((p-vec3(-6,1,0)), vec3(0.2,9.,9)) ); 55 | d = min(d, box((p-vec3(6,1,-9)), vec3(0.2,9.,9)) ); 56 | d = max(d, -box((p-vec3(0,4,0)), vec3(1.5,4.,10))); 57 | return d; 58 | } 59 | else 60 | { 61 | p += vec3(-70,0,0); 62 | vec3 q = p; 63 | modp(p.xz, 4.0); 64 | vec3 o = p; 65 | mod2(o.yx, vec2(6,9)); 66 | vec3 r = p; 67 | float d = caps(p-vec3(rep,-3,0), 44.0, dist); 68 | mod2(r.xz, vec2(12.7)); 69 | float d2 = box((o-vec3(0.,1,0)), vec3(9,1.5,ap1)); 70 | d2 = max(d2, p.y-28.0); 71 | d = max(d, -d2); 72 | d = min(d, box((r-vec3(0.,8,0)), vec3(.6,9,.6))); 73 | d = max(d, -caps(p-vec3(rep,-3,0), 24.0, 15.0)); 74 | float d6 = sp(p-vec3(rep,40,0), 30.0 ); 75 | d = max(d, -d6); 76 | float d3 = caps(q-vec3(0,-3,0), 55.0, 0.0); 77 | d3 = max(d3, -caps(q-vec3(0,-3,0), ap2, 15.0)); 78 | d3 = max(d3, -sp(q-vec3(0,40,0), 30.0 )); 79 | d = max(d, d3); 80 | return min(d, p.y); 81 | } 82 | } 83 | 84 | vec3 rhs(vec3 dir, float i) 85 | { 86 | vec2 rnd = vec2(hash(i+1.), hash(i+2.)); 87 | float s = rnd.x*PI*2.; 88 | float t = rnd.y*2.-1.; 89 | vec3 v = vec3(sin(s), cos(s), t) / sqrt(1.0 + t * t); 90 | return v * sign(dot(v, dir)); 91 | } 92 | 93 | float ao( vec3 p, vec3 n, float maxDist, float falloff) 94 | { 95 | float ao = 0.0; 96 | for( int i=0; i<10; i++ ) 97 | { 98 | float l = hash(float(i))*maxDist; 99 | vec3 rd = normalize(n+rhs(n, l )*0.95)*l; 100 | ao += (l - map( p + rd )) / pow(1.+l, falloff); 101 | } 102 | return clamp(1.-ao*0.1,0.0,999.0); 103 | } 104 | 105 | vec3 shade( vec3 p, vec3 n, vec3 org, vec3 dir, vec2 v ) 106 | { 107 | return vec3(0.8)*sqrt(mix(ao(p,n, 8., 0.97), ao(p,n, 2., 0.9), 0.4)); 108 | } 109 | vec3 normal( vec3 p ) 110 | { 111 | vec3 eps = vec3(0.001, 0.0, 0.0); 112 | return normalize( vec3( 113 | map(p+eps.xyy)-map(p-eps.xyy), 114 | map(p+eps.yxy)-map(p-eps.yxy), 115 | map(p+eps.yyx)-map(p-eps.yyx) 116 | )); 117 | } 118 | vec3 mr( vec3 ro, vec3 rd, vec2 nfplane, out float f) 119 | { 120 | vec3 p = ro+rd*nfplane.x; 121 | float t = 0.; 122 | for(int i=0; i<19; i++) 123 | { 124 | float d = map(p); 125 | t += d; 126 | p += rd*d; 127 | if( d < 0.01 || t > nfplane.y ) 128 | break; 129 | } 130 | f = 0.04*sqrt(nfplane.y/max(9.0, distance(ro, p))); 131 | return p; 132 | } 133 | vec3 rm( vec3 ro, vec3 rd, vec2 nfplane ) 134 | { 135 | vec3 p = ro+rd*nfplane.x; 136 | float t = 0.; 137 | for(int i=0; i<80; i++) 138 | { 139 | float d = map(p); 140 | t += d; 141 | p += rd*d; 142 | if( d < 0.01 || t > nfplane.y ) 143 | break; 144 | } 145 | return p; 146 | } 147 | vec3 cc(vec3 c) 148 | { 149 | return 0.08+0.94*pow(-0.5+1.7*pow(c,vec3(1.6)), vec3(0.6)); 150 | } 151 | void main() 152 | { 153 | vec2 res = vec2(1280,720); 154 | vec2 q = gl_FragCoord.xy/res.xy; 155 | vec2 v = -1.0+2.0*q; 156 | v.x *= res.x/res.y; 157 | 158 | vec3 ro; 159 | vec3 rd; 160 | if(t < 4){ 161 | gl_FragColor = vec4(0.035*hash(length(q)*t)); 162 | return; 163 | } else if(t < 9.0) { 164 | ro = vec3( 90.0+t,90.0,-130.0+t ); 165 | rd = normalize( vec3(v.x, v.y, 8.0))*rx(1.)*ry(.5); 166 | rep = 6.0; 167 | dist = 13.9; 168 | } else if(t < 16){ 169 | ro = vec3( 90.0,90.0,-130.0+t ); 170 | rd = normalize( vec3(v.x, v.y, 8.0))*rx(1.)*ry(.5); 171 | rep = 8.0; 172 | dist = 16.0; 173 | } else if(t < 26){ 174 | ro = vec3( 90.0+t,90.0,-130.0+t*0.1 ); 175 | rd = normalize( vec3(v.x, v.y, 8.0))*rx(1.)*ry(.5); 176 | } 177 | else if(t < 32){ 178 | ro = vec3( 90.0+t,90.0,-130.0 ); 179 | rd = normalize( vec3(v.x, v.y, 5.0))*rx(PI/2.); 180 | } 181 | else if(t < 35){ 182 | ro = vec3( 90.0+t,90.0,-130.0+t ); 183 | rd = normalize( vec3(v.x, v.y, 8.0))*rx(1.)*ry(.5); 184 | rep = 6.0; 185 | dist = 11.9; 186 | } 187 | else if(t < 44){ 188 | ro = vec3( 90.0-t*0.1,90.0,-130.0+t ); 189 | rd = normalize( vec3(v.x, v.y, 8.0))*rx(1.)*ry(.5); 190 | rep = 6.0; 191 | brg = 2.48-smoothstep(33,41,y); 192 | } 193 | else if(t < 49.5){ 194 | ro = vec3( 90.0+t*.5,40.0,-130.0+t*2 ); 195 | rd = normalize( vec3(v.x, v.y, 4.0))*rx(.5)*ry(-.2); 196 | rep = 6.0; 197 | dist = 21.0; 198 | brg = 1.6; 199 | } 200 | else if(t < 58){ 201 | ro = vec3( 90.0+t,90.0,-130.0+t*0.1 ); 202 | rd = normalize( vec3(v.x, v.y, 8.0))*rx(1.)*ry(.5); 203 | rep = 8.0; 204 | } 205 | else if(t < 69){ 206 | ro = vec3(t*.5,90.0,-t*.5 ); 207 | rd = normalize( vec3(v.x, v.y, 5.0))*rx(PI/2.)*ry(t*.01); 208 | rep = 6.0; 209 | dist = 16.0 - 3.0*smoothstep(21,30,t*.4); 210 | } 211 | else if(t < 75){ 212 | float tt = t-69; 213 | ro = vec3( 0,290+tt*2,-tt*3); 214 | rd = normalize( vec3(v.x, v.y, 8.0) )*ry(1.2)*rx(1.5-0.01*tt)*rz(-1); 215 | rep = 0.0; 216 | dist = -26+43*smoothstep(70,82,t); 217 | scene = 1; 218 | brg = 1.4; 219 | } 220 | else if(t < 81){ 221 | float tt = t-75; 222 | ro = vec3( 90.0-tt*3,210-tt,160-tt); 223 | rd = normalize( vec3(v.x, v.y, 5.0) )*ry(3.1-(t-73)*0.01)*rx(-.9); 224 | rep = 0.0; 225 | dist = -26+43*smoothstep(70,82,t); 226 | scene = 1; 227 | } 228 | else if(t < 98){ 229 | float tt = t-80; 230 | ro = vec3( t,290-t,240-t); 231 | rd = normalize( vec3(v.x, v.y, 5.0) )*ry(3.1+tt*0.003)*rx(-.9); 232 | rep = 60.0; 233 | dist = 17.0; 234 | ap2 = 58-19*smoothstep(75,95,t)-12*smoothstep(85,96,t); 235 | ap1 = 9+19*smoothstep(80,95,t); 236 | scene = 1; 237 | } 238 | else if(t < 105){ 239 | ro = vec3( 90.0+t,90.0,-130.0+t ); 240 | rd = normalize( vec3(v.x, v.y, 8.0))*rx(1.)*ry(.5); 241 | rep = 6.0; 242 | dist = 11.9; 243 | } 244 | else if(t < 190){ 245 | ro = vec3( 90.0+t,90.0,-130.0+t*0.1 ); 246 | rd = normalize( vec3(v.x, v.y, 8.0))*rx(1.)*ry(.5); 247 | brg = 1.48+1.5*smoothstep(111,140,t); 248 | } 249 | vec3 p = rm(ro, rd, vec2(1., 545.) ); 250 | vec3 n = normal(p.xyz); 251 | vec3 col = shade(p, n, ro, rd, q); 252 | if(p.y < 26.0){ 253 | float f; 254 | vec3 rp = mr(p, reflect(rd, n), vec2(0.1, 300.), f ); 255 | vec3 rn = normal(rp.xyz); 256 | col += shade(rp, rn, ro, rd, q)*f; 257 | col *= 0.8; 258 | } else { 259 | col = mix(col,0.5+0.5*vec3(col*dot(n, normalize(p-vec3(99,-99,0)))), 0.3); 260 | } 261 | col = pow(col*brg/sqrt(2.+dot(v*0.3,v*0.3)), vec3(1./2.2)); 262 | gl_FragColor = vec4(cc(col-0.035*hash(length(q)*t)),1); 263 | } -------------------------------------------------------------------------------- /src/shaders/fragment.inl: -------------------------------------------------------------------------------- 1 | static const char* fragment = \ 2 | "uniform int v;" 3 | "float i=3.1416,y=v*.001,f=2.,r=18.,e=0,s=1.48,z=23.,x=35.;" 4 | "float n(float y)" 5 | "{" 6 | "return fract(sin(dot(y,12.9898))*43758.5);" 7 | "}" 8 | "mat3 t(float y)" 9 | "{" 10 | "return mat3(1.,0.,0.,0.,cos(y),-sin(y),0.,sin(y),cos(y));" 11 | "}" 12 | "mat3 p(float y)" 13 | "{" 14 | "return mat3(cos(y),0.,sin(y),0.,1.,0.,-sin(y),0.,cos(y));" 15 | "}" 16 | "mat3 m(float y)" 17 | "{" 18 | "return mat3(cos(y),-sin(y),0.,sin(y),cos(y),0.,0.,0.,1.);" 19 | "}" 20 | "float m(vec3 y,vec3 v)" 21 | "{" 22 | "return max(max(abs(y.x)-v.x,abs(y.y)-v.y),abs(y.z)-v.z);" 23 | "}" 24 | "float n(inout vec2 y,float v)" 25 | "{" 26 | "float f=2*i/v,r=atan(y.y,y.x)+f/2,s=floor(r/f);" 27 | "r=mod(r,f)-f/2.;" 28 | "y=vec2(cos(r),sin(r))*length(y);" 29 | "if(abs(s)>=v/2)" 30 | "s=abs(s);" 31 | "return s;" 32 | "}" 33 | "vec2 p(inout vec2 y,vec2 v)" 34 | "{" 35 | "vec2 i=floor((y+v*.5)/v);" 36 | "y=mod(y+v*.5,v)-v*.5;" 37 | "return i;" 38 | "}" 39 | "float t(vec3 y,float v)" 40 | "{" 41 | "return length(y)-v;" 42 | "}" 43 | "float m(vec3 y,float v,float i)" 44 | "{" 45 | "return mix(length(y.xz)-v,length(vec3(y.x,abs(y.y)-i,y.z))-v,step(i,abs(y.y)));" 46 | "}" 47 | "float c(vec3 y)" 48 | "{" 49 | "if(e<1)" 50 | "{" 51 | "float v=y.y;" 52 | "vec2 i=p(y.zx,vec2(r));" 53 | "n(y.zx,f);" 54 | "v=min(v,m(y-vec3(0.,1,9),vec3(9,9,.2)));" 55 | "v=min(v,m(y-vec3(-6,1,0),vec3(.2,9.,9)));" 56 | "v=min(v,m(y-vec3(6,1,-9),vec3(.2,9.,9)));" 57 | "v=max(v,-m(y-vec3(0,4,0),vec3(1.5,4.,10)));" 58 | "return v;" 59 | "}" 60 | "else" 61 | "{" 62 | "y+=vec3(-70,0,0);" 63 | "vec3 v=y;" 64 | "n(y.xz,4.);" 65 | "vec3 i=y;" 66 | "p(i.yx,vec2(6,9));" 67 | "vec3 s=y;" 68 | "float c=m(y-vec3(f,-3,0),44.,r);" 69 | "p(s.xz,vec2(12.7));" 70 | "float l=m(i-vec3(0.,1,0),vec3(9,1.5,z));" 71 | "l=max(l,y.y-28.);" 72 | "c=max(c,-l);" 73 | "c=min(c,m(s-vec3(0.,8,0),vec3(.6,9,.6)));" 74 | "c=max(c,-m(y-vec3(f,-3,0),24.,15.));" 75 | "float h=t(y-vec3(f,40,0),30.);" 76 | "c=max(c,-h);" 77 | "float a=m(v-vec3(0,-3,0),55.,0.);" 78 | "a=max(a,-m(v-vec3(0,-3,0),x,15.));" 79 | "a=max(a,-t(v-vec3(0,40,0),30.));" 80 | "c=max(c,a);" 81 | "return min(c,y.y);" 82 | "}" 83 | "}" 84 | "vec3 c(vec3 y,float v)" 85 | "{" 86 | "vec2 m=vec2(n(v+1.),n(v+2.));" 87 | "float f=m.x*i*2.,s=m.y*2.-1.;" 88 | "vec3 c=vec3(sin(f),cos(f),s)/sqrt(1.+s*s);" 89 | "return c*sign(dot(c,y));" 90 | "}" 91 | "float c(vec3 y,vec3 v,float i,float f)" 92 | "{" 93 | "float r=0.;" 94 | "for(int s=0;s<10;s++)" 95 | "{" 96 | "float x=n(float(s))*i;" 97 | "vec3 m=normalize(v+c(v,x)*.95)*x;" 98 | "r+=(x-c(y+m))/pow(1.+x,f);" 99 | "}" 100 | "return clamp(1.-r*.1,0.,999.);" 101 | "}" 102 | "vec3 c(vec3 y,vec3 v,vec3 i,vec3 x,vec2 f)" 103 | "{" 104 | "return vec3(.8)*sqrt(mix(c(y,v,8.,.97),c(y,v,2.,.9),.4));" 105 | "}" 106 | "vec3 h(vec3 y)" 107 | "{" 108 | "vec3 v=vec3(.001,0.,0.);" 109 | "return normalize(vec3(c(y+v.xyy)-c(y-v.xyy),c(y+v.yxy)-c(y-v.yxy),c(y+v.yyx)-c(y-v.yyx)));" 110 | "}" 111 | "vec3 h(vec3 y,vec3 v,vec2 i,out float f)" 112 | "{" 113 | "vec3 r=y+v*i.x;" 114 | "float e=0.;" 115 | "for(int s=0;s<19;s++)" 116 | "{" 117 | "float m=c(r);" 118 | "e+=m;" 119 | "r+=v*m;" 120 | "if(m<.01||e>i.y)" 121 | "break;" 122 | "}" 123 | "f=.04*sqrt(i.y/max(9.,distance(y,r)));" 124 | "return r;" 125 | "}" 126 | "vec3 c(vec3 y,vec3 v,vec2 i)" 127 | "{" 128 | "vec3 f=y+v*i.x;" 129 | "float r=0.;" 130 | "for(int s=0;s<80;s++)" 131 | "{" 132 | "float m=c(f);" 133 | "r+=m;" 134 | "f+=v*m;" 135 | "if(m<.01||r>i.y)" 136 | "break;" 137 | "}" 138 | "return f;" 139 | "}" 140 | "vec3 l(vec3 y)" 141 | "{" 142 | "return.08+.94*pow(-.5+1.7*pow(y,vec3(1.6)),vec3(.6));" 143 | "}" 144 | "void main()" 145 | "{" 146 | "vec2 v=vec2(1280,720),a=gl_FragCoord.xy/v.xy,d=-1.+2.*a;" 147 | "d.x*=v.x/v.y;" 148 | "vec3 b,k;" 149 | "if(y<4)" 150 | "{" 151 | "gl_FragColor=vec4(.035*n(length(a)*y));" 152 | "return;" 153 | "}" 154 | "else" 155 | " if(y<9.)" 156 | "b=vec3(90.+y,90.,-130.+y),k=normalize(vec3(d.x,d.y,8.))*t(1.)*p(.5),f=6.,r=13.9;" 157 | "else" 158 | " if(y<16)" 159 | "b=vec3(90.,90.,-130.+y),k=normalize(vec3(d.x,d.y,8.))*t(1.)*p(.5),f=8.,r=16.;" 160 | "else" 161 | " if(y<26)" 162 | "b=vec3(90.+y,90.,-130.+y*.1),k=normalize(vec3(d.x,d.y,8.))*t(1.)*p(.5);" 163 | "else" 164 | " if(y<32)" 165 | "b=vec3(90.+y,90.,-130.),k=normalize(vec3(d.x,d.y,5.))*t(i/2.);" 166 | "else" 167 | " if(y<35)" 168 | "b=vec3(90.+y,90.,-130.+y),k=normalize(vec3(d.x,d.y,8.))*t(1.)*p(.5),f=6.,r=11.9;" 169 | "else" 170 | " if(y<44)" 171 | "b=vec3(90.-y*.1,90.,-130.+y),k=normalize(vec3(d.x,d.y,8.))*t(1.)*p(.5),f=6.,s=2.48-smoothstep(33,41,y);" 172 | "else" 173 | " if(y<49.5)" 174 | "b=vec3(90.+y*.5,40.,-130.+y*2),k=normalize(vec3(d.x,d.y,4.))*t(.5)*p(-.2),f=6.,r=21.,s=1.6;" 175 | "else" 176 | " if(y<58)" 177 | "b=vec3(90.+y,90.,-130.+y*.1),k=normalize(vec3(d.x,d.y,8.))*t(1.)*p(.5),f=8.;" 178 | "else" 179 | " if(y<69)" 180 | "b=vec3(y*.5,90.,-y*.5),k=normalize(vec3(d.x,d.y,5.))*t(i/2.)*p(y*.01),f=6.,r=16.-3.*smoothstep(21,30,y*.4);" 181 | "else" 182 | " if(y<75)" 183 | "{" 184 | "float o=y-69;" 185 | "b=vec3(0,290+o*2,-o*3);" 186 | "k=normalize(vec3(d.x,d.y,8.))*p(1.2)*t(1.5-.01*o)*m(-1.);" 187 | "f=0.;" 188 | "r=-26+43*smoothstep(70,82,y);" 189 | "e=1;" 190 | "s=1.4;" 191 | "}" 192 | "else" 193 | " if(y<81)" 194 | "{" 195 | "float o=y-75;" 196 | "b=vec3(90.-o*3,210-o,160-o);" 197 | "k=normalize(vec3(d.x,d.y,5.))*p(3.1-(y-73)*.01)*t(-.9);" 198 | "f=0.;" 199 | "r=-26+43*smoothstep(70,82,y);" 200 | "e=1;" 201 | "}" 202 | "else" 203 | " if(y<98)" 204 | "{" 205 | "float o=y-80;" 206 | "b=vec3(y,290-y,240-y);" 207 | "k=normalize(vec3(d.x,d.y,5.))*p(3.1+o*.003)*t(-.9);" 208 | "f=60.;" 209 | "r=17.;" 210 | "x=58-14*smoothstep(75,95,y)-9*smoothstep(85,96,y);" 211 | "z=9+14*smoothstep(80,95,y);" 212 | "e=1;" 213 | "}" 214 | "else" 215 | " if(y<105)" 216 | "b=vec3(90.+y,90.,-130.+y),k=normalize(vec3(d.x,d.y,8.))*t(1.)*p(.5),f=6.,r=11.9;" 217 | "else" 218 | " if(y<190)" 219 | "b=vec3(90.+y,90.,-130.+y*.1),k=normalize(vec3(d.x,d.y,8.))*t(1.)*p(.5),s=1.48+1.5*smoothstep(111,140,y);" 220 | "vec3 o=c(b,k,vec2(1.,545.)),u=h(o.xyz),g=c(o,u,b,k,a);" 221 | "if(o.y<25.)" 222 | "{" 223 | "float w;" 224 | "vec3 q=h(o,reflect(k,u),vec2(.1,300.),w),F=h(q.xyz);" 225 | "g+=c(q,F,b,k,a)*w;" 226 | "g*=.8;" 227 | "}" 228 | "else" 229 | " g=mix(g,.5+.5*vec3(g*dot(u,normalize(o-vec3(99,-99,0)))),.3);" 230 | "g=pow(g*s/sqrt(2.+dot(d*.3,d*.3)),vec3(1./2.2));" 231 | "gl_FragColor=vec4(l(g-.035*n(length(a)*y)),1);" 232 | "}"; -------------------------------------------------------------------------------- /leviathan.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 26 | 29 | 32 | 35 | 38 | 47 | 64 | 67 | 72 | 75 | 88 | 91 | 94 | 97 | 102 | 105 | 108 | 111 | 112 | 121 | 124 | 127 | 130 | 133 | 142 | 167 | 170 | 175 | 178 | 194 | 197 | 200 | 203 | 208 | 211 | 214 | 217 | 218 | 219 | 220 | 221 | 222 | 226 | 229 | 230 | 233 | 236 | 241 | 242 | 245 | 251 | 252 | 255 | 260 | 261 | 262 | 265 | 266 | 269 | 270 | 273 | 274 | 277 | 280 | 285 | 286 | 289 | 295 | 296 | 299 | 304 | 305 | 306 | 309 | 310 | 313 | 316 | 321 | 322 | 325 | 331 | 332 | 335 | 340 | 341 | 342 | 345 | 346 | 349 | 352 | 356 | 359 | 360 | 361 | 364 | 368 | 371 | 372 | 373 | 374 | 377 | 378 | 381 | 384 | 385 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | -------------------------------------------------------------------------------- /leviathan.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {59C1D4F3-AE93-4A0A-B4FE-60841CA865E5} 15 | Leviathan 16 | 17 | 18 | 19 | Application 20 | v120 21 | false 22 | 23 | 24 | Application 25 | v120 26 | false 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | <_ProjectFileVersion>12.0.30501.0 41 | 42 | 43 | .\bin\Leviathan\Debug\ 44 | .\bin\Leviathan\Debug\ 45 | true 46 | 47 | 48 | .\bin\Leviathan\Release\ 49 | .\bin\Leviathan\Release\ 50 | false 51 | false 52 | 53 | 54 | 55 | _DEBUG;%(PreprocessorDefinitions) 56 | true 57 | true 58 | Win32 59 | .\bin/Debug/Leviathan.tlb 60 | 61 | 62 | 63 | Disabled 64 | ../;%(AdditionalIncludeDirectories) 65 | _DEBUG;WINDOWS;DEBUG;SIMD;A32BITS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 66 | EnableFastChecks 67 | MultiThreaded 68 | .\bin/Debug/Leviathan.pch 69 | $(OutDir) 70 | $(OutDir) 71 | $(OutDir) 72 | true 73 | Level3 74 | false 75 | true 76 | ProgramDatabase 77 | CompileAsC 78 | 79 | 80 | _DEBUG;%(PreprocessorDefinitions) 81 | 0x0409 82 | 83 | 84 | winmm.lib;opengl32.lib;src/4klang.obj;%(AdditionalDependencies) 85 | exe/leviathan-debug.exe 86 | true 87 | true 88 | $(OutDir)4verts_deb.pdb 89 | Windows 90 | false 91 | 92 | MachineX86 93 | 94 | 95 | true 96 | $(OutDir)Leviathan.bsc 97 | 98 | 99 | 100 | 101 | NDEBUG;%(PreprocessorDefinitions) 102 | true 103 | true 104 | Win32 105 | .\bin/Release/Leviathan.tlb 106 | 107 | 108 | 109 | /QIfist /Gs %(AdditionalOptions) 110 | MinSpace 111 | OnlyExplicitInline 112 | false 113 | Size 114 | ../;%(AdditionalIncludeDirectories) 115 | WINDOWS;A32BITS;SIMD;NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 116 | false 117 | false 118 | MultiThreaded 119 | 1Byte 120 | false 121 | Fast 122 | .\bin/Release/Leviathan.pch 123 | AssemblyAndSourceCode 124 | $(OutDir) 125 | $(OutDir) 126 | $(OutDir) 127 | Level3 128 | false 129 | true 130 | StdCall 131 | CompileAsCpp 132 | true 133 | false 134 | false 135 | Default 136 | NotSet 137 | true 138 | false 139 | 140 | 141 | NDEBUG;%(PreprocessorDefinitions) 142 | 0x0409 143 | 144 | 145 | /CRINKLER /HASHTRIES:3000 /COMPMODE:SLOW /ORDERTRIES:6000 /REPORT:out.txt /PROGRESSGUI /SATURATE /HASHSIZE:900 /UNSAFEIMPORT /NOALIGNMENT /NOINITIALIZERS %(AdditionalOptions) 146 | opengl32.lib;winmm.lib;src/4klang.obj;%(AdditionalDependencies) 147 | exe/leviathan-release.exe 148 | true 149 | true 150 | Windows 151 | entrypoint 152 | 153 | false 154 | 155 | MachineX86 156 | 157 | 158 | true 159 | .\bin/Release/Leviathan.bsc 160 | 161 | 162 | false 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | MaxSpeed 175 | 176 | 177 | MaxSpeed 178 | 179 | 180 | true 181 | 182 | 183 | true 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /src/fp.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------// 2 | // iq / rgba . tiny codes . 2008 // 3 | //--------------------------------------------------------------------------// 4 | #ifndef _FPCONSTANTS_H_ 5 | #define _FPCONSTANTS_H_ 6 | #define p0d00 0.0000000000f // 0.00f 0x00000000 7 | #define p0d01 0.0100097656f // 0.01f 0x3c240000 8 | #define p0d02 0.0200195313f // 0.02f 0x3ca40000 9 | #define p0d03 0.0300292969f // 0.03f 0x3cf60000 10 | #define p0d04 0.0400390625f // 0.04f 0x3d240000 11 | #define p0d05 0.0500488281f // 0.05f 0x3d4d0000 12 | #define p0d06 0.0600585938f // 0.06f 0x3d760000 13 | #define p0d07 0.0698242188f // 0.07f 0x3d8f0000 14 | #define p0d08 0.0800781250f // 0.08f 0x3da40000 15 | #define p0d09 0.0898437500f // 0.09f 0x3db80000 16 | #define p0d10 0.1000976563f // 0.10f 0x3dcd0000 17 | #define p0d11 0.1098632813f // 0.11f 0x3de10000 18 | #define p0d12 0.1201171875f // 0.12f 0x3df60000 19 | #define p0d13 0.1298828125f // 0.13f 0x3e050000 20 | #define p0d14 0.1396484375f // 0.14f 0x3e0f0000 21 | #define p0d15 0.1503906250f // 0.15f 0x3e1a0000 22 | #define p0d16 0.1601562500f // 0.16f 0x3e240000 23 | #define p0d17 0.1699218750f // 0.17f 0x3e2e0000 24 | #define p0d18 0.1796875000f // 0.18f 0x3e380000 25 | #define p0d19 0.1904296875f // 0.19f 0x3e430000 26 | #define p0d20 0.2001953125f // 0.20f 0x3e4d0000 27 | #define p0d21 0.2099609375f // 0.21f 0x3e570000 28 | #define p0d22 0.2197265625f // 0.22f 0x3e610000 29 | #define p0d23 0.2304687500f // 0.23f 0x3e6c0000 30 | #define p0d24 0.2402343750f // 0.24f 0x3e760000 31 | #define p0d25 0.2500000000f // 0.25f 0x3e800000 32 | #define p0d26 0.2597656250f // 0.26f 0x3e850000 33 | #define p0d27 0.2695312500f // 0.27f 0x3e8a0000 34 | #define p0d28 0.2792968750f // 0.28f 0x3e8f0000 35 | #define p0d29 0.2890625000f // 0.29f 0x3e940000 36 | #define p0d30 0.3007812500f // 0.30f 0x3e9a0000 37 | #define p0d31 0.3105468750f // 0.31f 0x3e9f0000 38 | #define p0d32 0.3203125000f // 0.32f 0x3ea40000 39 | #define p0d33 0.3300781250f // 0.33f 0x3ea90000 40 | #define p0d34 0.3398437500f // 0.34f 0x3eae0000 41 | #define p0d35 0.3496093750f // 0.35f 0x3eb30000 42 | #define p0d36 0.3593750000f // 0.36f 0x3eb80000 43 | #define p0d37 0.3691406250f // 0.37f 0x3ebd0000 44 | #define p0d38 0.3808593750f // 0.38f 0x3ec30000 45 | #define p0d39 0.3906250000f // 0.39f 0x3ec80000 46 | #define p0d40 0.4003906250f // 0.40f 0x3ecd0000 47 | #define p0d41 0.4101562500f // 0.41f 0x3ed20000 48 | #define p0d42 0.4199218750f // 0.42f 0x3ed70000 49 | #define p0d43 0.4296875000f // 0.43f 0x3edc0000 50 | #define p0d44 0.4394531250f // 0.44f 0x3ee10000 51 | #define p0d45 0.4492187500f // 0.45f 0x3ee60000 52 | #define p0d46 0.4609375000f // 0.46f 0x3eec0000 53 | #define p0d47 0.4707031250f // 0.47f 0x3ef10000 54 | #define p0d48 0.4804687500f // 0.48f 0x3ef60000 55 | #define p0d49 0.4902343750f // 0.49f 0x3efb0000 56 | #define p0d50 0.5000000000f // 0.50f 0x3f000000 57 | #define p0d51 0.5117187500f // 0.51f 0x3f030000 58 | #define p0d52 0.5195312500f // 0.52f 0x3f050000 59 | #define p0d53 0.5312500000f // 0.53f 0x3f080000 60 | #define p0d54 0.5390625000f // 0.54f 0x3f0a0000 61 | #define p0d55 0.5507812500f // 0.55f 0x3f0d0000 62 | #define p0d56 0.5585937500f // 0.56f 0x3f0f0000 63 | #define p0d57 0.5703125000f // 0.57f 0x3f120000 64 | #define p0d58 0.5781250000f // 0.58f 0x3f140000 65 | #define p0d59 0.5898437500f // 0.59f 0x3f170000 66 | #define p0d60 0.6015625000f // 0.60f 0x3f1a0000 67 | #define p0d61 0.6093750000f // 0.61f 0x3f1c0000 68 | #define p0d62 0.6210937500f // 0.62f 0x3f1f0000 69 | #define p0d63 0.6289062500f // 0.63f 0x3f210000 70 | #define p0d64 0.6406250000f // 0.64f 0x3f240000 71 | #define p0d65 0.6484375000f // 0.65f 0x3f260000 72 | #define p0d66 0.6601562500f // 0.66f 0x3f290000 73 | #define p0d67 0.6718750000f // 0.67f 0x3f2c0000 74 | #define p0d68 0.6796875000f // 0.68f 0x3f2e0000 75 | #define p0d69 0.6914062500f // 0.69f 0x3f310000 76 | #define p0d70 0.6992187500f // 0.70f 0x3f330000 77 | #define p0d71 0.7109375000f // 0.71f 0x3f360000 78 | #define p0d72 0.7187500000f // 0.72f 0x3f380000 79 | #define p0d73 0.7304687500f // 0.73f 0x3f3b0000 80 | #define p0d74 0.7382812500f // 0.74f 0x3f3d0000 81 | #define p0d75 0.7500000000f // 0.75f 0x3f400000 82 | #define p0d76 0.7617187500f // 0.76f 0x3f430000 83 | #define p0d77 0.7695312500f // 0.77f 0x3f450000 84 | #define p0d78 0.7812500000f // 0.78f 0x3f480000 85 | #define p0d79 0.7890625000f // 0.79f 0x3f4a0000 86 | #define p0d80 0.8007812500f // 0.80f 0x3f4d0000 87 | #define p0d81 0.8085937500f // 0.81f 0x3f4f0000 88 | #define p0d82 0.8203125000f // 0.82f 0x3f520000 89 | #define p0d83 0.8281250000f // 0.83f 0x3f540000 90 | #define p0d84 0.8398437500f // 0.84f 0x3f570000 91 | #define p0d85 0.8515625000f // 0.85f 0x3f5a0000 92 | #define p0d86 0.8593750000f // 0.86f 0x3f5c0000 93 | #define p0d87 0.8710937500f // 0.87f 0x3f5f0000 94 | #define p0d88 0.8789062500f // 0.88f 0x3f610000 95 | #define p0d89 0.8906250000f // 0.89f 0x3f640000 96 | #define p0d90 0.8984375000f // 0.90f 0x3f660000 97 | #define p0d91 0.9101562500f // 0.91f 0x3f690000 98 | #define p0d92 0.9218750000f // 0.92f 0x3f6c0000 99 | #define p0d93 0.9296875000f // 0.93f 0x3f6e0000 100 | #define p0d94 0.9414062500f // 0.94f 0x3f710000 101 | #define p0d95 0.9492187500f // 0.95f 0x3f730000 102 | #define p0d96 0.9609375000f // 0.96f 0x3f760000 103 | #define p0d97 0.9687500000f // 0.97f 0x3f780000 104 | #define p0d98 0.9804687500f // 0.98f 0x3f7b0000 105 | #define p0d99 0.9882812500f // 0.99f 0x3f7d0000 106 | #define p1d00 1.0000000000f // 1.00f 0x3f800000 107 | #define p1d01 1.0078125000f // 1.01f 0x3f810000 108 | #define p1d02 1.0234375000f // 1.02f 0x3f830000 109 | #define p1d03 1.0312500000f // 1.03f 0x3f840000 110 | #define p1d04 1.0390625000f // 1.04f 0x3f850000 111 | #define p1d05 1.0468750000f // 1.05f 0x3f860000 112 | #define p1d06 1.0625000000f // 1.06f 0x3f880000 113 | #define p1d07 1.0703125000f // 1.07f 0x3f890000 114 | #define p1d08 1.0781250000f // 1.08f 0x3f8a0000 115 | #define p1d09 1.0937500000f // 1.09f 0x3f8c0000 116 | #define p1d10 1.1015625000f // 1.10f 0x3f8d0000 117 | #define p1d11 1.1093750000f // 1.11f 0x3f8e0000 118 | #define p1d12 1.1171875000f // 1.12f 0x3f8f0000 119 | #define p1d13 1.1328125000f // 1.13f 0x3f910000 120 | #define p1d14 1.1406250000f // 1.14f 0x3f920000 121 | #define p1d15 1.1484375000f // 1.15f 0x3f930000 122 | #define p1d16 1.1562500000f // 1.16f 0x3f940000 123 | #define p1d17 1.1718750000f // 1.17f 0x3f960000 124 | #define p1d18 1.1796875000f // 1.18f 0x3f970000 125 | #define p1d19 1.1875000000f // 1.19f 0x3f980000 126 | #define p1d20 1.2031250000f // 1.20f 0x3f9a0000 127 | #define p1d21 1.2109375000f // 1.21f 0x3f9b0000 128 | #define p1d22 1.2187500000f // 1.22f 0x3f9c0000 129 | #define p1d23 1.2265625000f // 1.23f 0x3f9d0000 130 | #define p1d24 1.2421875000f // 1.24f 0x3f9f0000 131 | #define p1d25 1.2500000000f // 1.25f 0x3fa00000 132 | #define p1d26 1.2578125000f // 1.26f 0x3fa10000 133 | #define p1d27 1.2734375000f // 1.27f 0x3fa30000 134 | #define p1d28 1.2812500000f // 1.28f 0x3fa40000 135 | #define p1d29 1.2890625000f // 1.29f 0x3fa50000 136 | #define p1d30 1.2968750000f // 1.30f 0x3fa60000 137 | #define p1d31 1.3125000000f // 1.31f 0x3fa80000 138 | #define p1d32 1.3203125000f // 1.32f 0x3fa90000 139 | #define p1d33 1.3281250000f // 1.33f 0x3faa0000 140 | #define p1d34 1.3437500000f // 1.34f 0x3fac0000 141 | #define p1d35 1.3515625000f // 1.35f 0x3fad0000 142 | #define p1d36 1.3593750000f // 1.36f 0x3fae0000 143 | #define p1d37 1.3671875000f // 1.37f 0x3faf0000 144 | #define p1d38 1.3828125000f // 1.38f 0x3fb10000 145 | #define p1d39 1.3906250000f // 1.39f 0x3fb20000 146 | #define p1d40 1.3984375000f // 1.40f 0x3fb30000 147 | #define p1d41 1.4062500000f // 1.41f 0x3fb40000 148 | #define p1d42 1.4218750000f // 1.42f 0x3fb60000 149 | #define p1d43 1.4296875000f // 1.43f 0x3fb70000 150 | #define p1d44 1.4375000000f // 1.44f 0x3fb80000 151 | #define p1d45 1.4531250000f // 1.45f 0x3fba0000 152 | #define p1d46 1.4609375000f // 1.46f 0x3fbb0000 153 | #define p1d47 1.4687500000f // 1.47f 0x3fbc0000 154 | #define p1d48 1.4765625000f // 1.48f 0x3fbd0000 155 | #define p1d49 1.4921875000f // 1.49f 0x3fbf0000 156 | #define p1d50 1.5000000000f // 1.50f 0x3fc00000 157 | #define p1d51 1.5078125000f // 1.51f 0x3fc10000 158 | #define p1d52 1.5234375000f // 1.52f 0x3fc30000 159 | #define p1d53 1.5312500000f // 1.53f 0x3fc40000 160 | #define p1d54 1.5390625000f // 1.54f 0x3fc50000 161 | #define p1d55 1.5468750000f // 1.55f 0x3fc60000 162 | #define p1d56 1.5625000000f // 1.56f 0x3fc80000 163 | #define p1d57 1.5703125000f // 1.57f 0x3fc90000 164 | #define p1d58 1.5781250000f // 1.58f 0x3fca0000 165 | #define p1d59 1.5937500000f // 1.59f 0x3fcc0000 166 | #define p1d60 1.6015625000f // 1.60f 0x3fcd0000 167 | #define p1d61 1.6093750000f // 1.61f 0x3fce0000 168 | #define p1d62 1.6171875000f // 1.62f 0x3fcf0000 169 | #define p1d63 1.6328125000f // 1.63f 0x3fd10000 170 | #define p1d64 1.6406250000f // 1.64f 0x3fd20000 171 | #define p1d65 1.6484375000f // 1.65f 0x3fd30000 172 | #define p1d66 1.6562500000f // 1.66f 0x3fd40000 173 | #define p1d67 1.6718750000f // 1.67f 0x3fd60000 174 | #define p1d68 1.6796875000f // 1.68f 0x3fd70000 175 | #define p1d69 1.6875000000f // 1.69f 0x3fd80000 176 | #define p1d70 1.7031250000f // 1.70f 0x3fda0000 177 | #define p1d71 1.7109375000f // 1.71f 0x3fdb0000 178 | #define p1d72 1.7187500000f // 1.72f 0x3fdc0000 179 | #define p1d73 1.7265625000f // 1.73f 0x3fdd0000 180 | #define p1d74 1.7421875000f // 1.74f 0x3fdf0000 181 | #define p1d75 1.7500000000f // 1.75f 0x3fe00000 182 | #define p1d76 1.7578125000f // 1.76f 0x3fe10000 183 | #define p1d77 1.7734375000f // 1.77f 0x3fe30000 184 | #define p1d78 1.7812500000f // 1.78f 0x3fe40000 185 | #define p1d79 1.7890625000f // 1.79f 0x3fe50000 186 | #define p1d80 1.7968750000f // 1.80f 0x3fe60000 187 | #define p1d81 1.8125000000f // 1.81f 0x3fe80000 188 | #define p1d82 1.8203125000f // 1.82f 0x3fe90000 189 | #define p1d83 1.8281250000f // 1.83f 0x3fea0000 190 | #define p1d84 1.8437500000f // 1.84f 0x3fec0000 191 | #define p1d85 1.8515625000f // 1.85f 0x3fed0000 192 | #define p1d86 1.8593750000f // 1.86f 0x3fee0000 193 | #define p1d87 1.8671875000f // 1.87f 0x3fef0000 194 | #define p1d88 1.8828125000f // 1.88f 0x3ff10000 195 | #define p1d89 1.8906250000f // 1.89f 0x3ff20000 196 | #define p1d90 1.8984375000f // 1.90f 0x3ff30000 197 | #define p1d91 1.9062500000f // 1.91f 0x3ff40000 198 | #define p1d92 1.9218750000f // 1.92f 0x3ff60000 199 | #define p1d93 1.9296875000f // 1.93f 0x3ff70000 200 | #define p1d94 1.9375000000f // 1.94f 0x3ff80000 201 | #define p1d95 1.9531250000f // 1.95f 0x3ffa0000 202 | #define p1d96 1.9609375000f // 1.96f 0x3ffb0000 203 | #define p1d97 1.9687500000f // 1.97f 0x3ffc0000 204 | #define p1d98 1.9765625000f // 1.98f 0x3ffd0000 205 | #define p1d99 1.9921875000f // 1.99f 0x3fff0000 206 | #define p2d00 2.0000000000f 207 | #define p2d10 2.0937500000f 208 | 209 | #endif --------------------------------------------------------------------------------