port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

22
ev4k/4klang.h Normal file
View File

@@ -0,0 +1,22 @@
// some useful song defines for 4klang
#define SAMPLE_RATE 44100
#define BPM 145.065796
#define MAX_INSTRUMENTS 7
#define MAX_PATTERNS 68
#define PATTERN_SIZE_SHIFT 4
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
#define SAMPLES_PER_TICK 4559
#define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
#define POLYPHONY 1
#define FLOAT_32BIT
#define SAMPLE_TYPE float
#define WINDOWS_OBJECT
// declaration of the external synth render function, you'll always need that
extern "C" void __stdcall _4klang_render(void*);
// declaration of the external envelope buffer. access only if you're song was exported with that option
extern "C" float _4klang_envelope_buffer;
// declaration of the external note buffer. access only if you're song was exported with that option
extern "C" int _4klang_note_buffer;

BIN
ev4k/4klang.obj Normal file

Binary file not shown.

BIN
ev4k/GlU32.Lib Normal file

Binary file not shown.

BIN
ev4k/OpenGL32.Lib Normal file

Binary file not shown.

366
ev4k/Shaders.cpp Normal file
View File

@@ -0,0 +1,366 @@
#include "Shaders.h"
//#define DEBUG_COMPRESSED_SHADER
#ifdef _DEBUG
PFNGLCREATESHADERPROC glCreateShader = NULL;
PFNGLSHADERSOURCEPROC glShaderSource = NULL;
PFNGLCOMPILESHADERPROC glCompileShader = NULL;
PFNGLGETSHADERIVPROC glGetShaderiv = NULL;
PFNGLGETPROGRAMIVPROC glGetProgramiv = NULL;
PFNGLCREATEPROGRAMPROC glCreateProgram = NULL;
PFNGLATTACHSHADERPROC glAttachShader = NULL;
PFNGLLINKPROGRAMPROC glLinkProgram = NULL;
PFNGLUSEPROGRAMPROC glUseProgram = NULL;
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog = NULL;
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog = NULL;
void useProgram(GLhandleARB ah_Program)
{
glUseProgram(ah_Program);
}
void initShaders()
{
glCreateShader = (PFNGLCREATESHADERPROC)myGetProcAddress("glCreateShader");
glShaderSource = (PFNGLSHADERSOURCEPROC)myGetProcAddress("glShaderSource");
glCompileShader = (PFNGLCOMPILESHADERPROC)myGetProcAddress("glCompileShader");
glGetShaderiv = (PFNGLGETSHADERIVPROC)myGetProcAddress("glGetShaderiv");
glGetProgramiv = (PFNGLGETPROGRAMIVPROC)myGetProcAddress("glGetProgramiv");
glCreateProgram = (PFNGLCREATEPROGRAMPROC)myGetProcAddress("glCreateProgram");
glAttachShader = (PFNGLATTACHSHADERPROC)myGetProcAddress("glAttachShader");
glLinkProgram = (PFNGLLINKPROGRAMPROC)myGetProcAddress("glLinkProgram");
glUseProgram = (PFNGLUSEPROGRAMPROC)myGetProcAddress("glUseProgram");
glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)myGetProcAddress("glGetShaderInfoLog");
glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)myGetProcAddress("glGetProgramInfoLog");
if (!(glCreateShader && glShaderSource && glCompileShader && glGetShaderiv && glGetProgramiv && glCreateProgram && glAttachShader && glLinkProgram && glUseProgram && glGetShaderInfoLog && glGetProgramInfoLog))
{
std::cerr << "Some shader functions are not available!" << std::endl;
}
}
#include <sstream>
#include <fstream>
std::string ReplaceString(const std::string &stringSearchString, const std::string &stringReplaceString, std::string stringStringToReplace)
{
std::string::size_type pos = stringStringToReplace.find(stringSearchString, 0);
int intLengthSearch = stringSearchString.length();
int intLengthReplacment = stringReplaceString.length();
while(std::string::npos != pos)
{
stringStringToReplace.replace(pos, intLengthSearch, stringReplaceString);
pos = stringStringToReplace.find(stringSearchString, pos + intLengthReplacment);
}
return stringStringToReplace;
}
std::string MakeFileName( const char* as_FileName, int ShaderID, bool bDebug )
{
std::stringstream ss;
ss << as_FileName << "_" << ShaderID;
if( bDebug )
{
ss << "_dbg";
}
return ss.str();
}
void CreateSubShader( const char* as_FileName, int ShaderID, bool bDebug )
{
char* ls_ShaderSource = textFileRead(as_FileName);
std::string strData= ls_ShaderSource;
std::string strNewData;
bool bRemove= false;
for( size_t i= 0; i < strData.size(); ++i )
{
bool bEndRemove= false;
if( strData[ i ] == '@' )
{
if( i + 2 >= strData.size() )
{
break;
}
i++;
if( strData[ i ] == '@' )
{
bRemove= false;
}
else if( strData[ i ] == 'D' )
{
bRemove= !bDebug;
}
else
{
int ID= (int)(strData[ i ] - '0');
bRemove= ID!=ShaderID;
}
i++;
}
if( !bRemove || strData[ i ] == 10 || strData[ i ] == 13)
{
strNewData+= strData[ i ];
}
}
std::string strFileOut= MakeFileName( as_FileName, ShaderID, bDebug );
std::ofstream ofs(strFileOut.c_str());
// some Renaming
strNewData= ReplaceString( "rayDir","q", strNewData);
strNewData= ReplaceString( "cRes","b", strNewData);
strNewData= ReplaceString( "cFac","a", strNewData);
strNewData= ReplaceString( "CurStep","d", strNewData);
strNewData= ReplaceString( "rotate","r", strNewData);
strNewData= ReplaceString( "repeat","s", strNewData);
strNewData= ReplaceString( "pi","g", strNewData);
strNewData= ReplaceString( "sqrtOf075","h", strNewData);
strNewData= ReplaceString( "EndlessBar","i", strNewData);
strNewData= ReplaceString( "CurTime","j", strNewData);
strNewData= ReplaceString( "CurScene","k", strNewData);
strNewData= ReplaceString( "torus","l", strNewData);
strNewData= ReplaceString( "noise3D","u", strNewData);
strNewData= ReplaceString( "smoothnoise","w", strNewData);
strNewData= ReplaceString( "f0(","A(", strNewData);
strNewData= ReplaceString( "f1(","B(", strNewData);
strNewData= ReplaceString( "f2(","C(", strNewData);
strNewData= ReplaceString( "f3(","D(", strNewData);
ofs << strNewData;
}
void CreateAllSubShader( const char* as_FileName )
{
for( int i= 0; i < MAX_SHADER_ID; ++i )
{
CreateSubShader( as_FileName, i, true );
CreateSubShader( as_FileName, i, false );
}
}
void PrintErrors()
{
GLenum lr_Error = GL_NO_ERROR;
int li_ErrorCount = 5;
do
{
lr_Error = glGetError();
if (lr_Error != GL_NO_ERROR)
{
li_ErrorCount--;
char* ls_ErrorString = (char*)gluErrorString(lr_Error);
if (ls_ErrorString != 0)
std::cout << "OPENGL :: ERROR " << ls_ErrorString << std::endl;
}
if (li_ErrorCount == 0)
{
std::cout << "OPENGL :: ERROR Too many errors!" << std::endl;
break;
}
} while (lr_Error != GL_NO_ERROR);
}
GLhandleARB createVertexShader(const char* as_FileName)
{
GLhandleARB lh_Shader = 0;
char* ls_ShaderSource = textFileRead(as_FileName);
if (ls_ShaderSource == NULL)
{
std::cerr << "Error reading file: " << as_FileName << std::endl;
return lh_Shader;
}
lh_Shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(lh_Shader, 1, (const char**)&ls_ShaderSource, NULL);
glCompileShader(lh_Shader);
free(ls_ShaderSource);
int li_Status = 0;
glGetShaderiv(lh_Shader, GL_COMPILE_STATUS, &li_Status);
if (li_Status == GL_FALSE)
{
std::cerr << "Error compiling vertex shader: " << as_FileName << std::endl;
}
printShaderInfoLog(lh_Shader);
return lh_Shader;
}
#ifdef DEBUG_COMPRESSED_SHADER
#include "shader_code.h"
#endif
GLhandleARB createFragmentShader(const char* as_FileName, int ShaderID, bool bDebug)
{
CreateAllSubShader( as_FileName );
GLhandleARB lh_Shader = 0;
char* ls_ShaderSource = textFileRead(MakeFileName(as_FileName, ShaderID, bDebug).c_str());
if (ls_ShaderSource == NULL)
{
std::cerr << "Error reading file: " << as_FileName << std::endl;
return lh_Shader;
}
lh_Shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(lh_Shader, 1, (const char**)&ls_ShaderSource, NULL);
#ifdef DEBUG_COMPRESSED_SHADER
glShaderSource(lh_Shader, 1, (const char**)&mark_fs, NULL);
#endif
glCompileShader(lh_Shader);
int li_Status = 0;
glGetShaderiv(lh_Shader, GL_COMPILE_STATUS, &li_Status);
if (li_Status == GL_FALSE)
{
std::cerr << "Error compiling fragment shader: " << as_FileName << std::endl;
}
printShaderInfoLog(lh_Shader);
free(ls_ShaderSource);
return lh_Shader;
}
GLhandleARB createProgram(GLhandleARB ah_VertexShader, GLhandleARB ah_FragmentShader)
{
GLhandleARB lh_Program = 0;
if (ah_VertexShader + ah_FragmentShader <= 1)
{
std::cerr << "Cannot create program." << std::endl;
return lh_Program;
}
lh_Program = glCreateProgram();
glAttachShader(lh_Program, ah_VertexShader);
glAttachShader(lh_Program, ah_FragmentShader);
glLinkProgram(lh_Program);
int li_Status = 0;
glGetProgramiv(lh_Program, GL_LINK_STATUS, &li_Status);
if (li_Status == GL_FALSE)
{
std::cerr << "Error linking shaders." << std::endl;
}
printProgramInfoLog(lh_Program);
return lh_Program;
}
char* textFileRead(const char* as_FileName)
{
FILE* lh_File;
char* ls_Content = NULL;
size_t li_Count = 0;
if (as_FileName != NULL)
{
fopen_s(&lh_File, as_FileName, "rt");
if (lh_File != NULL)
{
fseek(lh_File, 0, SEEK_END);
li_Count = ftell(lh_File);
rewind(lh_File);
if (li_Count > 0)
{
ls_Content = (char*) malloc(sizeof(char) * (li_Count + 1));
li_Count = fread(ls_Content, sizeof(char), li_Count, lh_File);
ls_Content[li_Count] = '\0';
}
fclose(lh_File);
}
}
return ls_Content;
}
void printShaderInfoLog(GLhandleARB ah_Shader)
{
int li_InfologLength = 0;
int li_CharsWritten = 0;
char* li_InfoLog;
glGetShaderiv(ah_Shader, GL_INFO_LOG_LENGTH, &li_InfologLength);
if (li_InfologLength > 0)
{
li_InfoLog = (char*) malloc(li_InfologLength);
glGetShaderInfoLog(ah_Shader, li_InfologLength, &li_CharsWritten, li_InfoLog);
std::cerr << li_InfoLog << std::endl;
free(li_InfoLog);
}
}
void printProgramInfoLog(GLhandleARB ah_Program)
{
int li_InfologLength = 0;
int li_CharsWritten = 0;
char* ls_InfoLog;
glGetProgramiv(ah_Program, GL_INFO_LOG_LENGTH, &li_InfologLength);
if (li_InfologLength > 0)
{
ls_InfoLog = (char *)malloc(li_InfologLength);
glGetProgramInfoLog(ah_Program, li_InfologLength, &li_CharsWritten, ls_InfoLog);
std::cerr << ls_InfoLog << std::endl;
free(ls_InfoLog);
}
}
bool printShaderStatistics()
{
if (GL_VERSION_2_1) std::cout << "Supports OpenGL 2.1. " << std::endl;
else if (GL_VERSION_2_0) std::cout << "Supports OpenGL 2.0. " << std::endl;
else if (GL_VERSION_1_5) std::cout << "Supports OpenGL 1.5. " << std::endl;
else if (GL_VERSION_1_4) std::cout << "Supports OpenGL 1.4. " << std::endl;
else if (GL_VERSION_1_3) std::cout << "Supports OpenGL 1.3. " << std::endl;
else if (GL_VERSION_1_2) std::cout << "Supports OpenGL 1.2. " << std::endl;
else if (GL_VERSION_1_1) std::cout << "Supports OpenGL 1.1. " << std::endl;
if (GL_ARB_shader_objects && GL_ARB_vertex_shader && GL_ARB_fragment_shader)
{
std::cout << "Status: Using GLSL " << glGetString(GL_SHADING_LANGUAGE_VERSION_ARB) << std::endl;
}
else
{
std::cerr << "No GLSL support!" << std::endl;
return false;
}
return true;
}
#endif

21
ev4k/Shaders.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#define MAX_SHADER_ID 4
#include <windows.h>
#include <iostream>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"
#define myGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
void initShaders();
GLhandleARB createVertexShader(const char* as_FileName);
GLhandleARB createFragmentShader(const char* as_FileName, int ShaderID, bool bDebug);
GLhandleARB createProgram(GLhandleARB ah_VertexShader, GLhandleARB ah_FragmentShader);
void PrintErrors();
void useProgram(GLhandleARB ah_Program);
char* textFileRead(const char* as_FileName);
void printShaderInfoLog(GLhandleARB ah_Shader);
void printProgramInfoLog(GLhandleARB ah_Program);
bool printShaderStatistics();

20
ev4k/UpgradeLog.XML Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type='text/xsl' href='_UpgradeReport_Files/UpgradeReport.xslt'?><UpgradeLog>
<Properties><Property Name="Solution" Value="bp4k">
</Property><Property Name="Solution File" Value="C:\Users\Frank\Desktop\ev4k\bp4k.sln">
</Property><Property Name="Date" Value="Donnerstag, 11. August 2011">
</Property><Property Name="Time" Value="23:57">
</Property></Properties><Event ErrorLevel="0" Project="bp4k" Source="bp4k.vcproj" Description="Converting project file 'C:\Users\Frank\Desktop\ev4k\bp4k.vcproj'.">
</Event><Event ErrorLevel="1" Project="bp4k" Source="bp4k.vcproj" Description="This application has been updated to include settings related to the User Account Control (UAC) feature of Windows Vista. By default, when run on Windows Vista with UAC enabled, this application is marked to run with the same privileges as the process that launched it. This marking also disables the application from running with virtualization. You can change UAC related settings from the Property Pages of the project.">
</Event><Event ErrorLevel="1" Project="bp4k" Source="bp4k.vcproj" Description="VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.">
</Event><Event ErrorLevel="0" Project="bp4k" Source="bp4k.vcproj" Description="Web deployment to the local IIS server is no longer supported. The Web Deployment build tool has been removed from your project settings.">
</Event><Event ErrorLevel="1" Project="bp4k" Source="bp4k.vcproj" Description="MSB8012: $(TargetName) ('bp4k') does not match the Linker's OutputFile property value 'C:\Users\Frank\Desktop\ev4k\bin\bp4k_Debug.exe' ('bp4k_Debug') in project configuration 'Debug|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetName) property value matches the value specified in %(Link.OutputFile).">
</Event><Event ErrorLevel="1" Project="bp4k" Source="bp4k.vcproj" Description="MSB8012: $(TargetPath) ('C:\Users\Frank\Desktop\ev4k\bin\bp4k.exe') does not match the Linker's OutputFile property value 'C:\Users\Frank\Desktop\ev4k\bin\bp4k_Debug.exe' ('C:\Users\Frank\Desktop\ev4k\bin\bp4k_Debug.exe') in project configuration 'Debug|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetPath) property value matches the value specified in %(Link.OutputFile).">
</Event><Event ErrorLevel="1" Project="bp4k" Source="bp4k.vcproj" Description="MSB8012: $(TargetName) ('bp4k') does not match the Linker's OutputFile property value 'C:\Users\Frank\Desktop\ev4k\bin\bp4k_Release.exe' ('bp4k_Release') in project configuration 'Release|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetName) property value matches the value specified in %(Link.OutputFile).">
</Event><Event ErrorLevel="1" Project="bp4k" Source="bp4k.vcproj" Description="MSB8012: $(TargetPath) ('C:\Users\Frank\Desktop\ev4k\bin\bp4k.exe') does not match the Linker's OutputFile property value 'C:\Users\Frank\Desktop\ev4k\bin\bp4k_Release.exe' ('C:\Users\Frank\Desktop\ev4k\bin\bp4k_Release.exe') in project configuration 'Release|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetPath) property value matches the value specified in %(Link.OutputFile).">
</Event><Event ErrorLevel="1" Project="bp4k" Source="bp4k.vcproj" Description="MSB8012: $(TargetName) ('bp4k') does not match the Linker's OutputFile property value 'C:\Users\Frank\Desktop\ev4k\bin\bp4k_Compress (Slow).exe' ('bp4k_Compress (Slow)') in project configuration 'Compress (Slow)|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetName) property value matches the value specified in %(Link.OutputFile).">
</Event><Event ErrorLevel="1" Project="bp4k" Source="bp4k.vcproj" Description="MSB8012: $(TargetPath) ('C:\Users\Frank\Desktop\ev4k\bin\bp4k.exe') does not match the Linker's OutputFile property value 'C:\Users\Frank\Desktop\ev4k\bin\bp4k_Compress (Slow).exe' ('C:\Users\Frank\Desktop\ev4k\bin\bp4k_Compress (Slow).exe') in project configuration 'Compress (Slow)|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetPath) property value matches the value specified in %(Link.OutputFile).">
</Event><Event ErrorLevel="0" Project="bp4k" Source="bp4k.vcproj" Description="Done converting to new project file 'C:\Users\Frank\Desktop\ev4k\bp4k.vcxproj'.">
</Event><Event ErrorLevel="3" Project="bp4k" Source="bp4k.vcproj" Description="Converted">
</Event><Event ErrorLevel="0" Project="" Source="bp4k.sln" Description="Solution converted successfully">
</Event><Event ErrorLevel="3" Project="" Source="bp4k.sln" Description="Converted">
</Event></UpgradeLog>

BIN
ev4k/bf-red_src.zip Normal file

Binary file not shown.

23
ev4k/bp4k.sln Normal file
View File

@@ -0,0 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bp4k", "bp4k.vcxproj", "{213903DE-E40A-4D23-9310-E520AC2B412E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Compress (Slow)|Win32 = Compress (Slow)|Win32
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{213903DE-E40A-4D23-9310-E520AC2B412E}.Compress (Slow)|Win32.ActiveCfg = Compress (Slow)|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Compress (Slow)|Win32.Build.0 = Compress (Slow)|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Debug|Win32.ActiveCfg = Debug|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Debug|Win32.Build.0 = Debug|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Release|Win32.ActiveCfg = Release|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
ev4k/bp4k.suo Normal file

Binary file not shown.

369
ev4k/bp4k.vcproj Normal file
View File

@@ -0,0 +1,369 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="bp4k"
ProjectGUID="{213903DE-E40A-4D23-9310-E520AC2B412E}"
RootNamespace="bp4k"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)_$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Gdi32.lib user32.lib opengl32.lib winmm.lib glu32.lib"
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(ProjectDir)&quot;"
GenerateDebugInformation="true"
SubSystem="1"
EntryPointSymbol="main"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)_$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="rem minify\shader_minifier.exe &quot;mark.fs_0&quot; -o mark_0.h -v --no-renaming&#x0D;&#x0A;rem minify\shader_minifier.exe &quot;mark.fs_1&quot; -o mark_1.h -v --no-renaming&#x0D;&#x0A;rem minify\shader_minifier.exe &quot;mark.fs_2&quot; -o mark_2.h -v --no-renaming&#x0D;&#x0A;rem minify\shader_minifier.exe &quot;mark.fs_0&quot; -o mark_small.h -v&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
WholeProgramOptimization="false"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
ExceptionHandling="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="0"
DebugInformationFormat="3"
CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/CRINKLER"
AdditionalDependencies="Gdi32.lib user32.lib opengl32.lib winmm.lib libcmt.lib"
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
AdditionalLibraryDirectories="&quot;$(ProjectDir)&quot;"
GenerateManifest="false"
ManifestFile=""
GenerateDebugInformation="true"
SubSystem="2"
LinkTimeCodeGeneration="0"
EntryPointSymbol="main"
TargetMachine="1"
ErrorReporting="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Compress (Slow)|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)_$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/QIfist"
Optimization="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
WholeProgramOptimization="false"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
ExceptionHandling="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="false"
FloatingPointModel="2"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="0"
DebugInformationFormat="0"
CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/CRINKLER /COMPMODE:SLOW /ORDERTRIES:4000 /HASHTRIES:300 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS"
AdditionalDependencies="opengl32.lib winmm.lib"
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
AdditionalLibraryDirectories="&quot;$(ProjectDir)&quot;"
GenerateManifest="false"
ManifestFile=""
GenerateDebugInformation="false"
SubSystem="2"
LinkTimeCodeGeneration="0"
EntryPointSymbol="main"
TargetMachine="1"
ErrorReporting="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\Shaders.cpp"
>
</File>
<File
RelativePath=".\synth.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\glext.h"
>
</File>
<File
RelativePath=".\release.h"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""
AdditionalDependencies=""
Outputs=""
/>
</FileConfiguration>
<FileConfiguration
Name="Compress (Slow)|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""
AdditionalDependencies=""
Outputs=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Shaders.h"
>
</File>
<File
RelativePath=".\small.h"
>
</File>
<File
RelativePath=".\synth.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\4klang.obj"
>
</File>
<File
RelativePath=".\generic.vs"
>
</File>
<File
RelativePath=".\mark.fs"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

205
ev4k/bp4k.vcxproj Normal file
View File

@@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Compress (Slow)|Win32">
<Configuration>Compress (Slow)</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{213903DE-E40A-4D23-9310-E520AC2B412E}</ProjectGuid>
<RootNamespace>bp4k</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">$(SolutionDir)bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">false</GenerateManifest>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">$(ProjectName)_$(Configuration)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_$(Configuration)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_$(Configuration)</TargetName>
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir);$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CallingConvention>StdCall</CallingConvention>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_$(Configuration).exe</OutputFile>
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<EntryPointSymbol>main</EntryPointSymbol>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>do_minify.bat</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<CallingConvention>StdCall</CallingConvention>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile>
<Link>
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;libcmt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_$(Configuration).exe</OutputFile>
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ManifestFile>
</ManifestFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<LinkTimeCodeGeneration>
</LinkTimeCodeGeneration>
<EntryPointSymbol>main</EntryPointSymbol>
<TargetMachine>MachineX86</TargetMachine>
<LinkErrorReporting>
</LinkErrorReporting>
<AdditionalOptions>/CRINKLER /compmode:instant %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalOptions>/QIfist %(AdditionalOptions)</AdditionalOptions>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>false</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<CallingConvention>StdCall</CallingConvention>
</ClCompile>
<Link>
<AdditionalOptions>/CRINKLER /COMPMODE:SLOW /ORDERTRIES:4000 /HASHTRIES:300 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_$(Configuration).exe</OutputFile>
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ManifestFile>
</ManifestFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<LinkTimeCodeGeneration>
</LinkTimeCodeGeneration>
<EntryPointSymbol>main</EntryPointSymbol>
<TargetMachine>MachineX86</TargetMachine>
<LinkErrorReporting>
</LinkErrorReporting>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="release.cpp" />
<ClCompile Include="Shaders.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="glext.h" />
<CustomBuild Include="release.h">
<Message Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">
</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">
</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Outputs)</Outputs>
</CustomBuild>
<ClInclude Include="Shaders.h" />
<ClInclude Include="small.h" />
<ClInclude Include="synth.h" />
</ItemGroup>
<ItemGroup>
<Object Include="4klang.obj" />
</ItemGroup>
<ItemGroup>
<None Include="generic.vs" />
<None Include="mark.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

51
ev4k/bp4k.vcxproj.filters Normal file
View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Shaders.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="release.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="glext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Shaders.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="small.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="synth.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Object Include="4klang.obj" />
</ItemGroup>
<ItemGroup>
<None Include="generic.vs" />
<None Include="mark.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="release.h">
<Filter>Header Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

6
ev4k/bp4k.vcxproj.user Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>

5
ev4k/do_minify.bat Normal file
View File

@@ -0,0 +1,5 @@
minify\shader_minifier.exe "mark.h_0" -o mark_0.h -v --no-renaming
minify\shader_minifier.exe "mark.h_1" -o mark_1.h -v --no-renaming
minify\shader_minifier.exe "mark.h_2" -o mark_2.h -v --no-renaming
minify\shader_minifier.exe "mark.h_3" -o mark_3.h -v --no-renaming
rem minify\shader_minifier.exe "mark.fs_0" -o mark_small.h -v

1
ev4k/files.txt Normal file
View File

@@ -0,0 +1 @@
release.cpp

18
ev4k/generic.vs Normal file
View File

@@ -0,0 +1,18 @@
varying vec4 Y,Z;
void main()
{
Y = gl_Color;
Z = gl_Vertex*vec4(1.7777,1,1,1)*0.5+0.5;
gl_Position = gl_Vertex;
}
/*varying vec4 v;
varying vec2 m;
void main()
{
v = gl_Color;
m = (gl_Vertex.xy*vec2(1.7777,1.0))*0.5+0.5;
gl_Position = gl_Vertex;
}*/

7271
ev4k/glext.h Normal file

File diff suppressed because it is too large Load Diff

BIN
ev4k/link.exe Normal file

Binary file not shown.

541
ev4k/main.cpp Normal file
View File

@@ -0,0 +1,541 @@
//#define WINDOWED
//#define NOMUSICTIMING
#define MULTISHADER
#ifdef _DEBUG
#include <time.h>
#include <io.h>
#include <process.h>
#include "Shaders.h"
#include "small.h"
#include "synth.h"
#else
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include <windows.h>
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"
#include "small.h"
#include "synth.h"
#ifdef NOMUSICTIMING
#include "Mmsystem.h"
#endif
#define V_Y "Y"
#define V_Z "Z"
#ifndef ASPECT
#define ASPECT 1.78
#endif
#ifndef SCREENWIDTH
#define SCREENWIDTH 1280
#endif
#ifndef SCREENHEIGTH
#define SCREENHEIGTH 720
#endif
#pragma data_seg(".Shader0")
#include "mark_0.h"
#pragma data_seg(".Shader1")
#include "mark_1.h"
#pragma data_seg(".Shader2")
#include "mark_2.h"
#pragma data_seg(".Shader3")
#include "mark_3.h"
//#include "mark_small.h"
#define STR2(x) #x
#define STR(x) STR2(x)
#pragma data_seg(".vertexshader")
//static char* vsh = "varying vec4 Y;varying vec2 Z;void main(){Y=gl_Color;Z=(gl_Vertex.xy*vec2(Y.w,1))*.5+.5;gl_Position=gl_Vertex;}";
static char* vsh = "varying vec4 "V_Y";varying vec2 "V_Z";void main(){"V_Y"=gl_Color;"V_Z"=(gl_Vertex.xy*vec2("STR( ASPECT )",1))*.5+.5;gl_Position=gl_Vertex;}";
#endif
#ifdef _DEBUG
#define HALF_FAC 2
#pragma data_seg(".resolutionX")
static const int gi_ScreenWidth = 1280/HALF_FAC;
#pragma data_seg(".resolutionY")
static const int gi_ScreenHeight = 720/HALF_FAC;
#else
#pragma data_seg(".resolutionX")
static const int gi_ScreenWidth = SCREENWIDTH;
#pragma data_seg(".resolutionY")
static const int gi_ScreenHeight = SCREENHEIGTH ;
#endif
#ifdef _DEBUG
#pragma bss_seg(".debugnothing")
HANDLE gh_ShaderCompileEvent;
static char** gs_LastShader_;
static __time64_t gi_ShaderChangedDate;
static unsigned int gi_ShaderProgram;
static unsigned int gi_LastShaderProgram;
#pragma data_seg(".debuginfo")
static const char* gs_VertexShader = "generic.vs";
static const char* gs_ShaderFile = "mark.h";
#endif
#pragma data_seg(".pfd")
static const PIXELFORMATDESCRIPTOR pfd={
0, 1, PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 8
};
#pragma data_seg(".dms")
static DEVMODE dmScreenSettings={
"",0,0,sizeof(dmScreenSettings),0,DM_PELSWIDTH|DM_PELSHEIGHT,
0,0,0,0,0,0,0,0,0,0,0,0,0,"",0,0,gi_ScreenWidth,gi_ScreenHeight
};
#pragma code_seg(".compile")
unsigned int compileShader(const char* vsh, const char* fsh)
{
GLuint s,p;
p = ((PFNGLCREATEPROGRAMPROC)wglGetProcAddress("glCreateProgram"))();
s = ((PFNGLCREATESHADERPROC)(wglGetProcAddress("glCreateShader")))(GL_VERTEX_SHADER);
((PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource")) (s, 1, &vsh, NULL);
((PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader"))(s);
((PFNGLATTACHSHADERPROC)wglGetProcAddress("glAttachShader")) (p,s);
s = ((PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader"))(GL_FRAGMENT_SHADER);
((PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource")) (s, 1, &fsh, NULL);
((PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader"))(s);
((PFNGLATTACHSHADERPROC)wglGetProcAddress("glAttachShader")) (p,s);
((PFNGLLINKPROGRAMPROC)wglGetProcAddress("glLinkProgram"))(p);
#ifndef MULTISHADER
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(p);
#endif
return p;
}
#ifdef _DEBUG
#define CHECK_DEBUG_OUTPUT(shader) \
{\
GLint success = 0;\
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\
if (!success)\
{\
GLchar infoLog[16384];\
glGetShaderInfoLog(shader, 16384, NULL, infoLog);\
OutputDebugString(infoLog);\
}\
}
#else
#define CHECK_DEBUG_OUTPUT(shader)
#endif
#pragma code_seg(".main")
#ifdef _DEBUG
DWORD WINAPI filemon(void* args)
{
while (true)
{
_finddata_t fdata;
long hfile = _findfirst(gs_ShaderFile, &fdata);
if (hfile != -1)
{
if (fdata.time_write != gi_ShaderChangedDate)
{
gi_ShaderChangedDate = fdata.time_write;
::SetEvent(gh_ShaderCompileEvent);
std::cout << "Shader loaded." << std::endl;
}
_findclose(hfile);
}
::Sleep(100);
}
return 0;
}
#endif
#ifdef _DEBUG
#include <cmath>
float g_DebugCamPos[ 3 ]= {0,2.0f,-5.0f};
float g_DebugCamRot[ 2 ]= {0,0};
bool g_ShaderDebug= true;
int g_ShaderID= 0;
int g_SceneID= 0;
int g_MaxSceneID= 16;
float g_fSqrAnimFac= 0.0f;
float g_fSpeedFac= 8.0f;
bool g_bForceCompile= true;
void MoveCam( float& fCurTime )
{
float fSpeed= 0.125f;
bool bShift= GetAsyncKeyState( VK_SHIFT ) || GetAsyncKeyState( VK_MBUTTON ) || GetAsyncKeyState( VK_RBUTTON );
bool bStrg= GetAsyncKeyState( VK_CONTROL ) != 0;
float a= g_DebugCamRot[ 0 ];
float b= g_DebugCamRot[ 1 ];
float g_Forward[ 3 ]= {sinf( a )*cosf(b),-sinf(b), cosf( a )*cosf(b)};
float g_Right[ 3 ]= {cosf( a ),0, -sinf( a )};
if( bShift )
{
if( GetAsyncKeyState( VK_HOME ) )
{
g_DebugCamPos[ 0 ]= 0.0f;
g_DebugCamPos[ 1 ]= 2.0f;
g_DebugCamPos[ 2 ]= -5.0f;
g_DebugCamRot[ 0 ]= 0.0f;
g_DebugCamRot[ 1 ]= 0.0f;
}
if( GetAsyncKeyState( 'W' ) )
{
g_DebugCamPos[ 0 ]+= fSpeed * g_Forward[ 0 ];
g_DebugCamPos[ 1 ]+= fSpeed * g_Forward[ 1 ];
g_DebugCamPos[ 2 ]+= fSpeed * g_Forward[ 2 ];
}
if( GetAsyncKeyState( 'S' ) )
{
g_DebugCamPos[ 0 ]-= fSpeed * g_Forward[ 0 ];
g_DebugCamPos[ 1 ]-= fSpeed * g_Forward[ 1 ];
g_DebugCamPos[ 2 ]-= fSpeed * g_Forward[ 2 ];
}
if( GetAsyncKeyState( 'A' ) )
{
g_DebugCamPos[ 0 ]-= fSpeed * g_Right[ 0 ];
g_DebugCamPos[ 1 ]-= fSpeed * g_Right[ 1 ];
g_DebugCamPos[ 2 ]-= fSpeed * g_Right[ 2 ];
}
if( GetAsyncKeyState( 'D' ) )
{
g_DebugCamPos[ 0 ]+= fSpeed * g_Right[ 0 ];
g_DebugCamPos[ 1 ]+= fSpeed * g_Right[ 1 ];
g_DebugCamPos[ 2 ]+= fSpeed * g_Right[ 2 ];
}
if( GetAsyncKeyState( 'F' ) )
{
g_DebugCamPos[ 1 ]+= fSpeed;
}
if( GetAsyncKeyState( 'V' ) )
{
g_DebugCamPos[ 1 ]-= fSpeed;
}
if( bStrg )
{
if( ( GetAsyncKeyState( VK_F2 ) & 1 ) != 0)
{
g_ShaderDebug= !g_ShaderDebug;
g_bForceCompile= true;
}
if( ( GetAsyncKeyState( VK_F3 ) & 1 ) != 0)
{
g_ShaderID= (g_ShaderID + MAX_SHADER_ID - 1 ) % MAX_SHADER_ID;
g_bForceCompile= true;
}
if( ( GetAsyncKeyState( VK_F4 ) & 1 )!= 0)
{
g_ShaderID= (g_ShaderID + MAX_SHADER_ID + 1 ) % MAX_SHADER_ID;
g_bForceCompile= true;
}
if( ( GetAsyncKeyState( VK_F7 ) & 1 ) != 0)
{
g_SceneID= (g_SceneID + g_MaxSceneID - 1 ) % g_MaxSceneID;
}
if( ( GetAsyncKeyState( VK_F8 ) & 1 )!= 0)
{
g_SceneID= (g_SceneID + g_MaxSceneID + 1 ) % g_MaxSceneID;
}
if( ( GetAsyncKeyState( VK_F9 ) & 1 ) != 0)
{
g_fSqrAnimFac-= 1.0f;
}
if( ( GetAsyncKeyState( VK_F10 ) & 1 )!= 0)
{
g_fSqrAnimFac+= 1.0f;
}
}
else
{
if( ( GetAsyncKeyState( VK_F6 ) & 1 )!= 0)
{
fCurTime= 0.0f;
}
if( ( GetAsyncKeyState( VK_F7 ) & 1 )!= 0)
{
g_fSpeedFac*= 2.0f;
if( g_fSpeedFac > 32.0f )
{
g_fSpeedFac= 32.0f;
}
}
if( ( GetAsyncKeyState( VK_F8 ) & 1 ) != 0)
{
g_fSpeedFac/= 2.0f;
if( g_fSpeedFac < 2.0f )
{
g_fSpeedFac= 2.0f;
}
}
}
}
static POINT OldCurPos;
POINT CurPos;
GetCursorPos( &CurPos );
if( bShift )
{
g_DebugCamRot[ 0 ]-= 0.003f * ( OldCurPos.x - CurPos.x );
g_DebugCamRot[ 1 ]-= 0.003f * ( OldCurPos.y - CurPos.y );
g_DebugCamRot[ 1 ]= max( g_DebugCamRot[ 1 ], -1.56f );
g_DebugCamRot[ 1 ]= min( g_DebugCamRot[ 1 ], 1.56f );
}
OldCurPos= CurPos;
}
#endif
#ifdef _DEBUG
LRESULT MessageCallback(HWND ar_Handle, UINT aw_Message, WPARAM aw_Param, LPARAM al_Param)
{
return DefWindowProc(ar_Handle, aw_Message, aw_Param, al_Param);
}
#endif
int gCurScene= 0;
int gCurSceneStart= 0;
#pragma data_seg(".g_SceneLength")
int g_SceneLength[]=
{
16, 8, 8, 32,
16, 16, 32,
16, 16, 32,
16, 16, 16, 32,
0x80000000
};
#pragma data_seg(".g_SceneShader")
int g_SceneShader[]=
{
0,0,0,0,
1,1,1,
2,2,2,
3,3,3, 3
};
#pragma data_seg(".g_SceneFactor")
float g_SceneFactor[]=
{
0, 0, 0, 1.0f,
0, 0, 1.0f,
0, 0, 1.0f,
0, 1.0f, 1.0f, 2.0f,
0,
};
void _cdecl main()
{
#ifdef _DEBUG
//ChangeDisplaySettings (&dmScreenSettings,CDS_FULLSCREEN);
//HDC hDC = GetDC(CreateWindow("edit", 0, WS_POPUP | WS_VISIBLE | WS_MAXIMIZE, 0, 0, 0, 0, 0, 0, 0, 0));
//HWND hWnd = CreateWindow("MDICLIENT", "Test", WS_OVERLAPPED | WS_VISIBLE | WS_SYSMENU, 0, 0, gi_ScreenWidth, gi_ScreenHeight, 0, 0, 0, 0);
WNDCLASSEX wndclass;
wndclass.cbSize = sizeof (wndclass) ;
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass.lpfnWndProc = (WNDPROC)MessageCallback ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = NULL ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (DKGRAY_BRUSH) ;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "Window" ;
wndclass.hIconSm = LoadIcon (NULL, IDI_APPLICATION) ;
RegisterClassEx(&wndclass);
HWND hWnd = CreateWindow(
"Window", /* Classname */
"Title", /* Title Text */
WS_EX_APPWINDOW, /* default window */
10, /* Windows decides the position */
30, /* where the window ends up on the screen */
gi_ScreenWidth, /* The programs width */
gi_ScreenHeight, /* and height in pixels */
NULL, /* The window is a child-window to desktop */
NULL, /* No menu */
GetModuleHandle(NULL), //GetModuleHandle(NULL), /* Program Instance handler */
NULL /* No Window Creation data */
);
HDC hDC = GetDC(hWnd);
SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
wglMakeCurrent(hDC, wglCreateContext(hDC));
initShaders();
gh_ShaderCompileEvent = ::CreateEvent(NULL, FALSE, FALSE, TEXT("WriteEvent"));
SetThreadPriority((HANDLE)CreateThread(0, 0, &filemon, 0, 0, 0), THREAD_PRIORITY_BELOW_NORMAL);
ShowWindow (hWnd , SW_NORMAL );
::Sleep(100);
#else
#ifndef WINDOWED
ChangeDisplaySettings (&dmScreenSettings,CDS_FULLSCREEN);
HDC hDC = GetDC(CreateWindow("edit", 0, WS_POPUP | WS_VISIBLE | WS_MAXIMIZE, 0, 0, 0, 0, 0, 0, 0, 0));
#else
HDC hDC = GetDC(CreateWindow("static", "RED", WS_EX_APPWINDOW | WS_VISIBLE | WS_SYSMENU, 0, 0, gi_ScreenWidth, gi_ScreenHeight, 0, 0, 0, 0));
#endif
SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
wglMakeCurrent(hDC, wglCreateContext(hDC));
#ifdef MULTISHADER
static unsigned int shaders[4];
shaders[0]=compileShader(vsh, mark_h_0 );
shaders[1]=compileShader(vsh, mark_h_3 );
shaders[2]=compileShader(vsh, mark_h_2 );
shaders[3]=compileShader(vsh, mark_h_1 );
#else
compileShader(vsh, mark_fs_0 );
#endif
ShowCursor(FALSE);
#endif
#ifdef _DEBUG
if (::WaitForSingleObject(gh_ShaderCompileEvent, 0) == WAIT_OBJECT_0)
{
::Sleep(250);
gi_ShaderProgram = createProgram(
createVertexShader(gs_VertexShader),
createFragmentShader(gs_ShaderFile, g_ShaderID, g_ShaderDebug ));
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(gi_ShaderProgram);
PrintErrors();
}
glColor4f(0,0,0, float(gi_ScreenWidth)/gi_ScreenHeight);
glRectf(-1, -1, 1, 1);
SwapBuffers(hDC);
#endif
#ifndef _DEBUG
InitSound();
#else
LARGE_INTEGER li_OldTime = { 0 };
#endif
#ifdef NOMUSICTIMING
int iStartTick= timeGetTime();
#endif
float lf_Time= 0.0f;
do
{
#ifdef _DEBUG
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
return;
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
if (::WaitForSingleObject(gh_ShaderCompileEvent, 0) == WAIT_OBJECT_0 || g_bForceCompile)
{
::Sleep(50);
gi_ShaderProgram = createProgram(
createVertexShader(gs_VertexShader),
createFragmentShader(gs_ShaderFile, g_ShaderID, g_ShaderDebug));
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(gi_ShaderProgram);
PrintErrors();
g_bForceCompile= false;
}
#endif
int Sample= get_Sample() - gCurSceneStart;
int SceneEnd= g_SceneLength[ gCurScene ] * (44100 * 60 / 145);//samples per tick
//lf_Time = get_Time() * 71.0f / 240.0f;
#ifdef NOMUSICTIMING
lf_Time = ( timeGetTime() - iStartTick ) * 0.001f / 16.0f;
#endif
#ifdef _DEBUG
glLoadIdentity();
LARGE_INTEGER li_CurrentTime, li_CurrentFrequency;
QueryPerformanceCounter(&li_CurrentTime);
QueryPerformanceFrequency(&li_CurrentFrequency);
//lf_Time = (float)li_CurrentTime.QuadPart / (float)li_CurrentFrequency.QuadPart;
float lf_DiffTime = (float)(li_CurrentTime.QuadPart - li_OldTime.QuadPart) / (float)li_CurrentFrequency.QuadPart;
char windowText[255];
sprintf_s(
windowText,
"Shader: %d Scene: %d AnimFac: %2.2f FPS: %.2f, Render time: %.4fms",
g_ShaderID,
g_SceneID,
g_fSqrAnimFac,
1.0f / lf_DiffTime,
lf_DiffTime );
::SetWindowTextA(hWnd, windowText);
li_OldTime = li_CurrentTime;
lf_Time+= lf_DiffTime * 145.0f / 60.0f / g_fSpeedFac;
if( lf_Time > 1.0f )
{
lf_Time= 0.0f;
}
glColor4f((float)g_SceneID, lf_Time, lf_Time * lf_Time * g_fSqrAnimFac, 0.0f);
#else
#ifdef MULTISHADER
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(shaders[ g_SceneShader[ gCurScene ] ]);
#endif
lf_Time= (float)Sample / (float)SceneEnd;
glColor4f((float)gCurScene, lf_Time, lf_Time * lf_Time * g_SceneFactor[ gCurScene ], 0.0f);
#endif
#ifdef _DEBUG
MoveCam( lf_Time );
float fDebugData[ 16 ];
fDebugData[ 0 ]= g_DebugCamPos[ 0 ];
fDebugData[ 1 ]= g_DebugCamPos[ 1 ];
fDebugData[ 2 ]= g_DebugCamPos[ 2 ];
fDebugData[ 4 ]= g_DebugCamRot[ 0 ];
fDebugData[ 5 ]= g_DebugCamRot[ 1 ];
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf((GLfloat*)&fDebugData);
#endif
//if (GetAsyncKeyState(VK_SPACE))
glRects(-1, -1, 1, 1);
SwapBuffers(hDC);
#ifndef _DEBUG
if( Sample > SceneEnd )
{
gCurSceneStart+= SceneEnd;
gCurScene++;
}
#endif
}
#ifdef _DEBUG
while ( !GetAsyncKeyState(VK_ESCAPE) );
#else
while ( g_SceneLength[ gCurScene ] > 0 && !GetAsyncKeyState(VK_ESCAPE) );
#endif
ExitProcess(0);
}

514
ev4k/mark.h Normal file
View File

@@ -0,0 +1,514 @@
@D
#version 100
@@
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float CurTime, CurScene, pi=acos(-1.0), sqrtOf075= sqrt( 0.75 );
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
void repeat(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the torus/ radius of the ring
float torus(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float EndlessBar( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float noise3D( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float smoothnoise(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
noise3D( p+e.yyy),//n000,
noise3D( p+e.xyy),//n100,
noise3D( p+e.yxy),//n010,
noise3D( p+e.xxy)),//n110),
vec4(
noise3D( p+e.yyx),//n001,
noise3D( p+e.xyx),//n101,
noise3D( p+e.yxx),//n011,
noise3D( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
@0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Kugel ueber Plattform
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float f0(vec3 p)
{
return p.y - smoothnoise( p + CurTime * 3.0 ) * 0.2 + 1.0;
}
float f1(vec3 p)
{
return min( length( p+vec3(0.0,8.0,0.0))- 8.5, torus( p, 2.3)-0.5 );
}
float f2(vec3 p)
{
p.xz= rotate( p.xz, Y.z * 11.0 );
float d1= max( length( p )- 6.0, p.y );
repeat( p.xz, 5.0, pi/32.0);
p.x= abs( p.x ) - 2.;
float dist= mix( length(p.yz),length(p.xyz), step(0.0, p.x) );
return min( d1 , dist - 0.4 );
}
float f3(vec3 p)
{
p.y -= 4.0;
p.xz= rotate( p.xz, CurTime * 6.0 );
repeat( p.xz,0.0, pi/1.5);
p.yz= rotate( p.yz, pi/2.0 );
float z= torus(p, 2.4)-0.5;
return min( max( 0.5 - z , length(p) - 1.5 - Y.z * 22.0 ), z );
}
float f(vec3 p)
{
float z= min( min( f0(p), f1(p) ), f2(p) );
return max( length( p ) - 33.0, min( z, max( 0.5 - z, f3(p) ) ) );
}
@@
@1
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// riesiges Hexgitter
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float f0(vec3 p)
{
vec3 o= p;
p.x= mod( p.x + step( 2.0 * sqrtOf075, mod( p.y, 4.0 * sqrtOf075 ) ), 2.0 ) - 1.0;
p.y= mod( p.y, 2.0 * sqrtOf075 )- sqrtOf075;
//repeatHex( p.xy );
o-= p;
p.z-= (CurScene == 10.0 ? 0.0 : 44.0) + 2.0 * smoothstep( -0.3, 0.3, cos( o.x * 0.03 + cos( o.y * 0.03 ) + CurTime * 4.0 ) * cos( o.y * 0.01 + cos( o.x * 0.02 ) ) );
float z= length( p )- 1.5;
repeat( p.xy, 0.7, pi/3.0);
return max( z, p.x );
}
float f1(vec3 p)
{
return length( p+vec3(sin( CurTime* 3.0) * 22.0,CurTime * 11.0,-22.0))- 22.0;
}
float f2(vec3 p)
{
vec3 o= p;
p.x= mod( p.x + step( 2.0 * sqrtOf075, mod( p.y, 4.0 * sqrtOf075 ) ), 2.0 ) - 1.0;
p.y= mod( p.y, 2.0 * sqrtOf075 )- sqrtOf075;
//repeatHex( p.xy );
return max( abs( p.z + 1.0 ) - 0.2, sqrtOf075 - length( p.xy ) );
}
float f3(vec3 p)
{
return length( p-vec3(22.0,22.0,-14.0))- Y.z * 33.0 - 12.0;
}
float f(vec3 p)
{
float z= min( min( f0(p), f1(p) ), f2(p) );
return max(length(p) - 77.0, min( z, max( 0.5 - z, f3(p) ) ) );
}
@@
@2
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Schlange im Tunnel
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float f0(vec3 p)
{
//p.z-= 5.5;
vec3 o= p;
p.z= mod( p.z, 11.0 ) - 5.5;
o-= p;
p.xy= rotate( p.xy, o.z + smoothstep( -0.2, 0.2, cos( CurTime * 5.0 + cos( o.z * 33.0 ) ) ) );
repeat( p.xy, 4.8, pi/4.5 );
return EndlessBar( p.xz, 1.0, 0.3 );
}
float f1(vec3 p)
{
return 99.0;
}
float f2(vec3 p)
{
//p.z-= CurTime * 33.0;
p.z= mod( p.z, 7.0 ) - 3.5;
repeat( p.xy, 0.0, pi/4.0 );
return max( abs( length( p.xy ) - 9.0 ) - 0.2, 3.0 - length( p.yz ) );
}
float f3(vec3 p)
{
p.z+= CurTime * 33.0;
p.xy= rotate( p.xy, p.z * 0.2 - CurTime * 8.0 );
p.x+= 1.0;
float z= 3.5 * smoothstep( -22.0, 0.0, p.z ) - 3.0 + Y.z * 17.0;
p.z= mod( p.z, 0.2 ) - 0.1;
return torus( p.xzy, z ) - 1.0;
}
float f(vec3 p)
{
float z= min( min( f0(p), f1(p) ), f2(p) );
return max( length( p ) - 66.0, min( z, max( 0.5 - z, f3(p) ) ) );
}
@@
@3
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Wellenlinien
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float f0(vec3 p)
{
return 99.0;
}
float f1(vec3 p)
{
p.y+= cos( p.x * 0.3 + cos( p.z * 0.3 ) + CurTime * 4.0 ) * cos( p.z * 0.1 + cos( p.x * 0.2 ) ) + 8.0;
p.xz= rotate( p.xz,CurTime * 22.0 );
p.z= mod( p.z, 3.0 ) - 1.5;
return EndlessBar( p.yz, 1.0, 0.25 );
}
float f2(vec3 p)
{
p.y+= cos( p.x * 0.3 + cos( p.z * 0.3 ) + CurTime * 4.0 ) * cos( p.z * 0.1 + cos( p.x * 0.2 ) );
p.xz= rotate( p.xz,CurTime * 11.0 );
p.z= mod( p.z, 3.0 ) - 1.5;
return EndlessBar( p.yz, 0.5, 0.25 );
}
float f3(vec3 p)
{
return length( p+vec3(-11.0,-16.0,-22.0) ) - Y.z * 33.0 - 12.0;
}
float f(vec3 p)
{
float z= min( min( f0(p), f1(p) ), f2(p) );
return max( length( p ) - 66.0, min( z, max( 0.5 - z, f3(p) ) ) );
}
@@
void main()
{
CurScene= Y.x;
CurTime= Y.y;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
@0
if( CurScene == 0.0 )
{
p= vec3( 12.0, 1.0, 0.0);
rayDir.yz= rotate( rayDir.yz, 1.0 + CurTime * -1.2 );
rayDir.xz= rotate( rayDir.xz, 3.0 - CurTime * 1.5 );
}
else if( CurScene == 1.0 )
{
p= vec3( -3.0, 3.0, -16.0 + CurTime * 10.0);
rayDir.xz= rotate( rayDir.xz, CurTime * -0.6 );
}
else if( CurScene == 2.0 )
{
p= vec3( 0.0, 12.0 - CurTime * 8.0, -16.0 + CurTime * 12.0);
rayDir.yz= rotate( rayDir.yz, 0.4 + CurTime * 0.4 );
}
else if( CurScene == 3.0 )
{
p= vec3( 2.0, 2.0, -6.0 - Y.z * 22.0);
//rayDir.yz= rotate( rayDir.yz, 0.0 );
}
@@
@3
if( CurScene == 4.0 )
{
p= vec3( 0.0, -6.5 + CurTime * 33.0, 5.0);
rayDir.yz= rotate( rayDir.yz, 1.0 );
rayDir.xz= rotate( rayDir.xz, 2.0 );
}
else if( CurScene == 5.0 )
{
p= vec3( 11.0, 2.0, 22.0 - CurTime * 66.0);
//rayDir.yz= rotate( rayDir.yz, 0.8 );
rayDir.xz= rotate( rayDir.xz, 4.0 - CurTime * 5.0 );
}
else if( CurScene == 6.0 )
{
p= vec3( 0.0, 7.0 - CurTime * 11.0, 0.0 + CurTime * -11.0 );
}
@@
@2
if( CurScene == 7.0 )
{
p= vec3( -11.0, 3.0, -28.0 - CurTime * 11.0);
rayDir.yz= rotate( rayDir.yz, 0.2 );
rayDir.xz= rotate( rayDir.xz, -2.0 + CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( -1.0, 1.0, -33.0 - CurTime * 7.0);
//rayDir.yz= rotate( rayDir.yz, 0.2 );
//rayDir.xz= rotate( rayDir.xz, -2.0 + CurTime );
}
else if( CurScene == 9.0 )
{
p= vec3( Y.z * 18.0 + 3.0 * smoothstep( 0.3, 0.4, CurTime ), Y.z * 3.0 + 3.0, CurTime * -60.0 );
rayDir.yz= rotate( rayDir.yz, 0.1 );
rayDir.xz= rotate( rayDir.xz, CurTime );
}
@@
@1
if( CurScene == 10.0 )
{
p= vec3( 33.0, 33.0, -11.0 + CurTime * 5.0);
rayDir.yz= rotate( rayDir.yz, 0.8 - CurTime );
rayDir.xz= rotate( rayDir.xz, 0.5 + CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3(-11.0, -11.0, -11.0);
rayDir.yz= rotate( rayDir.yz, -CurTime * 0.7 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 12.0 )
{
p= vec3(33.0, 11.0, 33.0);
rayDir.yz= rotate( rayDir.yz, CurTime * 0.4 );
rayDir.xz= rotate( rayDir.xz, 1.2 + CurTime * 0.6);
}
else if( CurScene == 13.0 )
{
p= vec3( mix( 22.0 - 88.0 * Y.z, -44.0 * CurTime, CurTime), 22.0, 6.0 );
rayDir.yz= rotate( rayDir.yz, CurTime * 0.2 );
rayDir.xz= rotate( rayDir.xz, 3.4 + sqrt(CurTime) * 1.4 );
}
@@
@D
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 1.0);
c1 = cos(a1); s1 = sin(a1);
rayDir.y = c1 * q1.y - s1 * q1.z;
rayDir.x= q1.x;
rayDir.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=rayDir;
c1 = cos(a1); s1 = sin(a1);
rayDir.x = c1 * q1.x + s1 * q1.z;
rayDir.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
@@
rayDir = normalize(rayDir);
vec3 cRes= vec3( .0,.0,.0 );
float cFac=1.0;
float t=smoothnoise( rayDir*666.0 )*0.2,y,z,CurStep,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (CurStep=1.0;t<66.0 && CurStep>t*.003;t+=max( 0.01, CurStep+0.01) )
{
CurStep = f(p+rayDir*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= rayDir*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= f0(p);
//CurStep ab hier == Reflektion !!!
@0
vec3 c = vec3(0.05,.1,.2 ) * (t+5.0) * 0.2;
CurStep= .7;
@@
@1
vec3 c = vec3(0.8,.0,.0 );
CurStep= .15;
@@
@2
vec3 c = vec3(0.95,1.0,0.95 );
CurStep= .18;
@@
@3
vec3 c = vec3(0.05,.1,.2 );
CurStep= .7;
@@
if( z > f3(p) )
{
z= f3(p);
@0
c = vec3(1.0,0.0,0.0 );
CurStep= .15;
@@
@1
c = vec3(1.0,0.0,0.0 );
CurStep= .15;
@@
@2
c = vec3(1.0,0.0,0.0 );
CurStep= .15;
@@
@3
c = vec3(1.0,0.0,0.0 );
CurStep= .15;
@@
}
if( z > f1(p) )
{
z= f1(p);
@0
c = vec3(.1);
CurStep= .8;
@@
@1
c = vec3(0.05,.1,.2 );
CurStep= .7;
e.y= 0.3;
@@
@2
c = vec3(.1);
CurStep= .6;
@@
@3
c = vec3(.6);
CurStep= .3;
@@
}
if( z > f2(p) )
{
z= f2(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, rayDir ), -1.0, -0.05));
@0
CurStep= .2;
e.y= 8.0;
@@
@1
CurStep= .2;
e.y= 2.0;
@@
@2
CurStep= .1;
e.y= 2.0;
@@
@3
CurStep= .2;
e.y= 5.0;
@@
}
n+= (smoothnoise( p * e.y ) + smoothnoise( p * e.y * 2.0 ) + smoothnoise( p * e.y * 4.0 )) * e.x;
n= normalize(n);
rayDir= reflect( rayDir, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= rotate( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
cRes+= cFac*c;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
rayDir.yz= rotate( rayDir.yz, 0.6 );
p+= rayDir.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( rayDir.y > 0.0 )
{
repeat(rayDir.xz, 0.4, pi/8.0);
rayDir.x= abs( rayDir.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(rayDir.z),length(rayDir.xz), step(0.0, rayDir.x) ) ), 22.0 );
}
vec3 color = cRes + cFac*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*pi*2)*.125+.5);
}

514
ev4k/mark.h_0 Normal file
View File

@@ -0,0 +1,514 @@
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float j, k, g=acos(-1.0), h= sqrt( 0.75 );
vec2 r(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//s around y axis w times
void s(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the l/ radius of the ring
float l(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float i( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float u( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float w(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
u( p+e.yyy),//n000,
u( p+e.xyy),//n100,
u( p+e.yxy),//n010,
u( p+e.xxy)),//n110),
vec4(
u( p+e.yyx),//n001,
u( p+e.xyx),//n101,
u( p+e.yxx),//n011,
u( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Kugel ueber Plattform
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float A(vec3 p)
{
return p.y - w( p + j * 3.0 ) * 0.2 + 1.0;
}
float B(vec3 p)
{
return min( length( p+vec3(0.0,8.0,0.0))- 8.5, l( p, 2.3)-0.5 );
}
float C(vec3 p)
{
p.xz= r( p.xz, Y.z * 11.0 );
float d1= max( length( p )- 6.0, p.y );
s( p.xz, 5.0, g/32.0);
p.x= abs( p.x ) - 2.;
float dist= mix( length(p.yz),length(p.xyz), step(0.0, p.x) );
return min( d1 , dist - 0.4 );
}
float D(vec3 p)
{
p.y -= 4.0;
p.xz= r( p.xz, j * 6.0 );
s( p.xz,0.0, g/1.5);
p.yz= r( p.yz, g/2.0 );
float z= l(p, 2.4)-0.5;
return min( max( 0.5 - z , length(p) - 1.5 - Y.z * 22.0 ), z );
}
float f(vec3 p)
{
float z= min( min( A(p), B(p) ), C(p) );
return max( length( p ) - 33.0, min( z, max( 0.5 - z, D(p) ) ) );
}
void main()
{
k= Y.x;
j= Y.y;
// Get the look direction for the current gxel (always look forwards)
vec3 q = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
if( k == 0.0 )
{
p= vec3( 12.0, 1.0, 0.0);
q.yz= r( q.yz, 1.0 + j * -1.2 );
q.xz= r( q.xz, 3.0 - j * 1.5 );
}
else if( k == 1.0 )
{
p= vec3( -3.0, 3.0, -16.0 + j * 10.0);
q.xz= r( q.xz, j * -0.6 );
}
else if( k == 2.0 )
{
p= vec3( 0.0, 12.0 - j * 8.0, -16.0 + j * 12.0);
q.yz= r( q.yz, 0.4 + j * 0.4 );
}
else if( k == 3.0 )
{
p= vec3( 2.0, 2.0, -6.0 - Y.z * 22.0);
//q.yz= r( q.yz, 0.0 );
}
q = normalize(q);
vec3 b= vec3( .0,.0,.0 );
float a=1.0;
float t=w( q*666.0 )*0.2,y,z,d,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (d=1.0;t<66.0 && d>t*.003;t+=max( 0.01, d+0.01) )
{
d = f(p+q*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= q*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= A(p);
//d ab hier == Reflektion !!!
vec3 c = vec3(0.05,.1,.2 ) * (t+5.0) * 0.2;
d= .7;
if( z > D(p) )
{
z= D(p);
c = vec3(1.0,0.0,0.0 );
d= .15;
}
if( z > B(p) )
{
z= B(p);
c = vec3(.1);
d= .8;
}
if( z > C(p) )
{
z= C(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, q ), -1.0, -0.05));
d= .2;
e.y= 8.0;
}
n+= (w( p * e.y ) + w( p * e.y * 2.0 ) + w( p * e.y * 4.0 )) * e.x;
n= normalize(n);
q= reflect( q, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= r( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
b+= a*c;//*(1.0-Reflect);
a*= d;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
q.yz= r( q.yz, 0.6 );
p+= q.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( q.y > 0.0 )
{
s(q.xz, 0.4, g/8.0);
q.x= abs( q.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(q.z),length(q.xz), step(0.0, q.x) ) ), 22.0 );
}
vec3 color = b + a*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*g*2)*.125+.5);
}

514
ev4k/mark.h_0_dbg Normal file
View File

@@ -0,0 +1,514 @@
#version 100
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float j, k, g=acos(-1.0), h= sqrt( 0.75 );
vec2 r(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//s around y axis w times
void s(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the l/ radius of the ring
float l(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float i( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float u( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float w(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
u( p+e.yyy),//n000,
u( p+e.xyy),//n100,
u( p+e.yxy),//n010,
u( p+e.xxy)),//n110),
vec4(
u( p+e.yyx),//n001,
u( p+e.xyx),//n101,
u( p+e.yxx),//n011,
u( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Kugel ueber Plattform
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float A(vec3 p)
{
return p.y - w( p + j * 3.0 ) * 0.2 + 1.0;
}
float B(vec3 p)
{
return min( length( p+vec3(0.0,8.0,0.0))- 8.5, l( p, 2.3)-0.5 );
}
float C(vec3 p)
{
p.xz= r( p.xz, Y.z * 11.0 );
float d1= max( length( p )- 6.0, p.y );
s( p.xz, 5.0, g/32.0);
p.x= abs( p.x ) - 2.;
float dist= mix( length(p.yz),length(p.xyz), step(0.0, p.x) );
return min( d1 , dist - 0.4 );
}
float D(vec3 p)
{
p.y -= 4.0;
p.xz= r( p.xz, j * 6.0 );
s( p.xz,0.0, g/1.5);
p.yz= r( p.yz, g/2.0 );
float z= l(p, 2.4)-0.5;
return min( max( 0.5 - z , length(p) - 1.5 - Y.z * 22.0 ), z );
}
float f(vec3 p)
{
float z= min( min( A(p), B(p) ), C(p) );
return max( length( p ) - 33.0, min( z, max( 0.5 - z, D(p) ) ) );
}
void main()
{
k= Y.x;
j= Y.y;
// Get the look direction for the current gxel (always look forwards)
vec3 q = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
if( k == 0.0 )
{
p= vec3( 12.0, 1.0, 0.0);
q.yz= r( q.yz, 1.0 + j * -1.2 );
q.xz= r( q.xz, 3.0 - j * 1.5 );
}
else if( k == 1.0 )
{
p= vec3( -3.0, 3.0, -16.0 + j * 10.0);
q.xz= r( q.xz, j * -0.6 );
}
else if( k == 2.0 )
{
p= vec3( 0.0, 12.0 - j * 8.0, -16.0 + j * 12.0);
q.yz= r( q.yz, 0.4 + j * 0.4 );
}
else if( k == 3.0 )
{
p= vec3( 2.0, 2.0, -6.0 - Y.z * 22.0);
//q.yz= r( q.yz, 0.0 );
}
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 1.0);
c1 = cos(a1); s1 = sin(a1);
q.y = c1 * q1.y - s1 * q1.z;
q.x= q1.x;
q.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=q;
c1 = cos(a1); s1 = sin(a1);
q.x = c1 * q1.x + s1 * q1.z;
q.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
q = normalize(q);
vec3 b= vec3( .0,.0,.0 );
float a=1.0;
float t=w( q*666.0 )*0.2,y,z,d,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (d=1.0;t<66.0 && d>t*.003;t+=max( 0.01, d+0.01) )
{
d = f(p+q*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= q*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= A(p);
//d ab hier == Reflektion !!!
vec3 c = vec3(0.05,.1,.2 ) * (t+5.0) * 0.2;
d= .7;
if( z > D(p) )
{
z= D(p);
c = vec3(1.0,0.0,0.0 );
d= .15;
}
if( z > B(p) )
{
z= B(p);
c = vec3(.1);
d= .8;
}
if( z > C(p) )
{
z= C(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, q ), -1.0, -0.05));
d= .2;
e.y= 8.0;
}
n+= (w( p * e.y ) + w( p * e.y * 2.0 ) + w( p * e.y * 4.0 )) * e.x;
n= normalize(n);
q= reflect( q, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= r( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
b+= a*c;//*(1.0-Reflect);
a*= d;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
q.yz= r( q.yz, 0.6 );
p+= q.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( q.y > 0.0 )
{
s(q.xz, 0.4, g/8.0);
q.x= abs( q.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(q.z),length(q.xz), step(0.0, q.x) ) ), 22.0 );
}
vec3 color = b + a*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*g*2)*.125+.5);
}

514
ev4k/mark.h_1 Normal file
View File

@@ -0,0 +1,514 @@
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float j, k, g=acos(-1.0), h= sqrt( 0.75 );
vec2 r(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//s around y axis w times
void s(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the l/ radius of the ring
float l(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float i( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float u( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float w(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
u( p+e.yyy),//n000,
u( p+e.xyy),//n100,
u( p+e.yxy),//n010,
u( p+e.xxy)),//n110),
vec4(
u( p+e.yyx),//n001,
u( p+e.xyx),//n101,
u( p+e.yxx),//n011,
u( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// riesiges Hexgitter
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float A(vec3 p)
{
vec3 o= p;
p.x= mod( p.x + step( 2.0 * h, mod( p.y, 4.0 * h ) ), 2.0 ) - 1.0;
p.y= mod( p.y, 2.0 * h )- h;
//sHex( p.xy );
o-= p;
p.z-= (k == 10.0 ? 0.0 : 44.0) + 2.0 * smoothstep( -0.3, 0.3, cos( o.x * 0.03 + cos( o.y * 0.03 ) + j * 4.0 ) * cos( o.y * 0.01 + cos( o.x * 0.02 ) ) );
float z= length( p )- 1.5;
s( p.xy, 0.7, g/3.0);
return max( z, p.x );
}
float B(vec3 p)
{
return length( p+vec3(sin( j* 3.0) * 22.0,j * 11.0,-22.0))- 22.0;
}
float C(vec3 p)
{
vec3 o= p;
p.x= mod( p.x + step( 2.0 * h, mod( p.y, 4.0 * h ) ), 2.0 ) - 1.0;
p.y= mod( p.y, 2.0 * h )- h;
//sHex( p.xy );
return max( abs( p.z + 1.0 ) - 0.2, h - length( p.xy ) );
}
float D(vec3 p)
{
return length( p-vec3(22.0,22.0,-14.0))- Y.z * 33.0 - 12.0;
}
float f(vec3 p)
{
float z= min( min( A(p), B(p) ), C(p) );
return max(length(p) - 77.0, min( z, max( 0.5 - z, D(p) ) ) );
}
void main()
{
k= Y.x;
j= Y.y;
// Get the look direction for the current gxel (always look forwards)
vec3 q = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
if( k == 10.0 )
{
p= vec3( 33.0, 33.0, -11.0 + j * 5.0);
q.yz= r( q.yz, 0.8 - j );
q.xz= r( q.xz, 0.5 + j );
}
else if( k == 11.0 )
{
p= vec3(-11.0, -11.0, -11.0);
q.yz= r( q.yz, -j * 0.7 );
q.xz= r( q.xz, -j );
}
else if( k == 12.0 )
{
p= vec3(33.0, 11.0, 33.0);
q.yz= r( q.yz, j * 0.4 );
q.xz= r( q.xz, 1.2 + j * 0.6);
}
else if( k == 13.0 )
{
p= vec3( mix( 22.0 - 88.0 * Y.z, -44.0 * j, j), 22.0, 6.0 );
q.yz= r( q.yz, j * 0.2 );
q.xz= r( q.xz, 3.4 + sqrt(j) * 1.4 );
}
q = normalize(q);
vec3 b= vec3( .0,.0,.0 );
float a=1.0;
float t=w( q*666.0 )*0.2,y,z,d,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (d=1.0;t<66.0 && d>t*.003;t+=max( 0.01, d+0.01) )
{
d = f(p+q*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= q*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= A(p);
//d ab hier == Reflektion !!!
vec3 c = vec3(0.8,.0,.0 );
d= .15;
if( z > D(p) )
{
z= D(p);
c = vec3(1.0,0.0,0.0 );
d= .15;
}
if( z > B(p) )
{
z= B(p);
c = vec3(0.05,.1,.2 );
d= .7;
e.y= 0.3;
}
if( z > C(p) )
{
z= C(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, q ), -1.0, -0.05));
d= .2;
e.y= 2.0;
}
n+= (w( p * e.y ) + w( p * e.y * 2.0 ) + w( p * e.y * 4.0 )) * e.x;
n= normalize(n);
q= reflect( q, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= r( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
b+= a*c;//*(1.0-Reflect);
a*= d;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
q.yz= r( q.yz, 0.6 );
p+= q.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( q.y > 0.0 )
{
s(q.xz, 0.4, g/8.0);
q.x= abs( q.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(q.z),length(q.xz), step(0.0, q.x) ) ), 22.0 );
}
vec3 color = b + a*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*g*2)*.125+.5);
}

514
ev4k/mark.h_1_dbg Normal file
View File

@@ -0,0 +1,514 @@
#version 100
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float j, k, g=acos(-1.0), h= sqrt( 0.75 );
vec2 r(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//s around y axis w times
void s(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the l/ radius of the ring
float l(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float i( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float u( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float w(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
u( p+e.yyy),//n000,
u( p+e.xyy),//n100,
u( p+e.yxy),//n010,
u( p+e.xxy)),//n110),
vec4(
u( p+e.yyx),//n001,
u( p+e.xyx),//n101,
u( p+e.yxx),//n011,
u( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// riesiges Hexgitter
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float A(vec3 p)
{
vec3 o= p;
p.x= mod( p.x + step( 2.0 * h, mod( p.y, 4.0 * h ) ), 2.0 ) - 1.0;
p.y= mod( p.y, 2.0 * h )- h;
//sHex( p.xy );
o-= p;
p.z-= (k == 10.0 ? 0.0 : 44.0) + 2.0 * smoothstep( -0.3, 0.3, cos( o.x * 0.03 + cos( o.y * 0.03 ) + j * 4.0 ) * cos( o.y * 0.01 + cos( o.x * 0.02 ) ) );
float z= length( p )- 1.5;
s( p.xy, 0.7, g/3.0);
return max( z, p.x );
}
float B(vec3 p)
{
return length( p+vec3(sin( j* 3.0) * 22.0,j * 11.0,-22.0))- 22.0;
}
float C(vec3 p)
{
vec3 o= p;
p.x= mod( p.x + step( 2.0 * h, mod( p.y, 4.0 * h ) ), 2.0 ) - 1.0;
p.y= mod( p.y, 2.0 * h )- h;
//sHex( p.xy );
return max( abs( p.z + 1.0 ) - 0.2, h - length( p.xy ) );
}
float D(vec3 p)
{
return length( p-vec3(22.0,22.0,-14.0))- Y.z * 33.0 - 12.0;
}
float f(vec3 p)
{
float z= min( min( A(p), B(p) ), C(p) );
return max(length(p) - 77.0, min( z, max( 0.5 - z, D(p) ) ) );
}
void main()
{
k= Y.x;
j= Y.y;
// Get the look direction for the current gxel (always look forwards)
vec3 q = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
if( k == 10.0 )
{
p= vec3( 33.0, 33.0, -11.0 + j * 5.0);
q.yz= r( q.yz, 0.8 - j );
q.xz= r( q.xz, 0.5 + j );
}
else if( k == 11.0 )
{
p= vec3(-11.0, -11.0, -11.0);
q.yz= r( q.yz, -j * 0.7 );
q.xz= r( q.xz, -j );
}
else if( k == 12.0 )
{
p= vec3(33.0, 11.0, 33.0);
q.yz= r( q.yz, j * 0.4 );
q.xz= r( q.xz, 1.2 + j * 0.6);
}
else if( k == 13.0 )
{
p= vec3( mix( 22.0 - 88.0 * Y.z, -44.0 * j, j), 22.0, 6.0 );
q.yz= r( q.yz, j * 0.2 );
q.xz= r( q.xz, 3.4 + sqrt(j) * 1.4 );
}
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 1.0);
c1 = cos(a1); s1 = sin(a1);
q.y = c1 * q1.y - s1 * q1.z;
q.x= q1.x;
q.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=q;
c1 = cos(a1); s1 = sin(a1);
q.x = c1 * q1.x + s1 * q1.z;
q.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
q = normalize(q);
vec3 b= vec3( .0,.0,.0 );
float a=1.0;
float t=w( q*666.0 )*0.2,y,z,d,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (d=1.0;t<66.0 && d>t*.003;t+=max( 0.01, d+0.01) )
{
d = f(p+q*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= q*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= A(p);
//d ab hier == Reflektion !!!
vec3 c = vec3(0.8,.0,.0 );
d= .15;
if( z > D(p) )
{
z= D(p);
c = vec3(1.0,0.0,0.0 );
d= .15;
}
if( z > B(p) )
{
z= B(p);
c = vec3(0.05,.1,.2 );
d= .7;
e.y= 0.3;
}
if( z > C(p) )
{
z= C(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, q ), -1.0, -0.05));
d= .2;
e.y= 2.0;
}
n+= (w( p * e.y ) + w( p * e.y * 2.0 ) + w( p * e.y * 4.0 )) * e.x;
n= normalize(n);
q= reflect( q, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= r( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
b+= a*c;//*(1.0-Reflect);
a*= d;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
q.yz= r( q.yz, 0.6 );
p+= q.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( q.y > 0.0 )
{
s(q.xz, 0.4, g/8.0);
q.x= abs( q.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(q.z),length(q.xz), step(0.0, q.x) ) ), 22.0 );
}
vec3 color = b + a*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*g*2)*.125+.5);
}

514
ev4k/mark.h_2 Normal file
View File

@@ -0,0 +1,514 @@
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float j, k, g=acos(-1.0), h= sqrt( 0.75 );
vec2 r(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//s around y axis w times
void s(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the l/ radius of the ring
float l(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float i( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float u( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float w(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
u( p+e.yyy),//n000,
u( p+e.xyy),//n100,
u( p+e.yxy),//n010,
u( p+e.xxy)),//n110),
vec4(
u( p+e.yyx),//n001,
u( p+e.xyx),//n101,
u( p+e.yxx),//n011,
u( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Schlange im Tunnel
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float A(vec3 p)
{
//p.z-= 5.5;
vec3 o= p;
p.z= mod( p.z, 11.0 ) - 5.5;
o-= p;
p.xy= r( p.xy, o.z + smoothstep( -0.2, 0.2, cos( j * 5.0 + cos( o.z * 33.0 ) ) ) );
s( p.xy, 4.8, g/4.5 );
return i( p.xz, 1.0, 0.3 );
}
float B(vec3 p)
{
return 99.0;
}
float C(vec3 p)
{
//p.z-= j * 33.0;
p.z= mod( p.z, 7.0 ) - 3.5;
s( p.xy, 0.0, g/4.0 );
return max( abs( length( p.xy ) - 9.0 ) - 0.2, 3.0 - length( p.yz ) );
}
float D(vec3 p)
{
p.z+= j * 33.0;
p.xy= r( p.xy, p.z * 0.2 - j * 8.0 );
p.x+= 1.0;
float z= 3.5 * smoothstep( -22.0, 0.0, p.z ) - 3.0 + Y.z * 17.0;
p.z= mod( p.z, 0.2 ) - 0.1;
return l( p.xzy, z ) - 1.0;
}
float f(vec3 p)
{
float z= min( min( A(p), B(p) ), C(p) );
return max( length( p ) - 66.0, min( z, max( 0.5 - z, D(p) ) ) );
}
void main()
{
k= Y.x;
j= Y.y;
// Get the look direction for the current gxel (always look forwards)
vec3 q = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
if( k == 7.0 )
{
p= vec3( -11.0, 3.0, -28.0 - j * 11.0);
q.yz= r( q.yz, 0.2 );
q.xz= r( q.xz, -2.0 + j );
}
else if( k == 8.0 )
{
p= vec3( -1.0, 1.0, -33.0 - j * 7.0);
//q.yz= r( q.yz, 0.2 );
//q.xz= r( q.xz, -2.0 + j );
}
else if( k == 9.0 )
{
p= vec3( Y.z * 18.0 + 3.0 * smoothstep( 0.3, 0.4, j ), Y.z * 3.0 + 3.0, j * -60.0 );
q.yz= r( q.yz, 0.1 );
q.xz= r( q.xz, j );
}
q = normalize(q);
vec3 b= vec3( .0,.0,.0 );
float a=1.0;
float t=w( q*666.0 )*0.2,y,z,d,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (d=1.0;t<66.0 && d>t*.003;t+=max( 0.01, d+0.01) )
{
d = f(p+q*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= q*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= A(p);
//d ab hier == Reflektion !!!
vec3 c = vec3(0.95,1.0,0.95 );
d= .18;
if( z > D(p) )
{
z= D(p);
c = vec3(1.0,0.0,0.0 );
d= .15;
}
if( z > B(p) )
{
z= B(p);
c = vec3(.1);
d= .6;
}
if( z > C(p) )
{
z= C(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, q ), -1.0, -0.05));
d= .1;
e.y= 2.0;
}
n+= (w( p * e.y ) + w( p * e.y * 2.0 ) + w( p * e.y * 4.0 )) * e.x;
n= normalize(n);
q= reflect( q, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= r( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
b+= a*c;//*(1.0-Reflect);
a*= d;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
q.yz= r( q.yz, 0.6 );
p+= q.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( q.y > 0.0 )
{
s(q.xz, 0.4, g/8.0);
q.x= abs( q.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(q.z),length(q.xz), step(0.0, q.x) ) ), 22.0 );
}
vec3 color = b + a*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*g*2)*.125+.5);
}

514
ev4k/mark.h_2_dbg Normal file
View File

@@ -0,0 +1,514 @@
#version 100
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float j, k, g=acos(-1.0), h= sqrt( 0.75 );
vec2 r(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//s around y axis w times
void s(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the l/ radius of the ring
float l(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float i( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float u( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float w(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
u( p+e.yyy),//n000,
u( p+e.xyy),//n100,
u( p+e.yxy),//n010,
u( p+e.xxy)),//n110),
vec4(
u( p+e.yyx),//n001,
u( p+e.xyx),//n101,
u( p+e.yxx),//n011,
u( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Schlange im Tunnel
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float A(vec3 p)
{
//p.z-= 5.5;
vec3 o= p;
p.z= mod( p.z, 11.0 ) - 5.5;
o-= p;
p.xy= r( p.xy, o.z + smoothstep( -0.2, 0.2, cos( j * 5.0 + cos( o.z * 33.0 ) ) ) );
s( p.xy, 4.8, g/4.5 );
return i( p.xz, 1.0, 0.3 );
}
float B(vec3 p)
{
return 99.0;
}
float C(vec3 p)
{
//p.z-= j * 33.0;
p.z= mod( p.z, 7.0 ) - 3.5;
s( p.xy, 0.0, g/4.0 );
return max( abs( length( p.xy ) - 9.0 ) - 0.2, 3.0 - length( p.yz ) );
}
float D(vec3 p)
{
p.z+= j * 33.0;
p.xy= r( p.xy, p.z * 0.2 - j * 8.0 );
p.x+= 1.0;
float z= 3.5 * smoothstep( -22.0, 0.0, p.z ) - 3.0 + Y.z * 17.0;
p.z= mod( p.z, 0.2 ) - 0.1;
return l( p.xzy, z ) - 1.0;
}
float f(vec3 p)
{
float z= min( min( A(p), B(p) ), C(p) );
return max( length( p ) - 66.0, min( z, max( 0.5 - z, D(p) ) ) );
}
void main()
{
k= Y.x;
j= Y.y;
// Get the look direction for the current gxel (always look forwards)
vec3 q = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
if( k == 7.0 )
{
p= vec3( -11.0, 3.0, -28.0 - j * 11.0);
q.yz= r( q.yz, 0.2 );
q.xz= r( q.xz, -2.0 + j );
}
else if( k == 8.0 )
{
p= vec3( -1.0, 1.0, -33.0 - j * 7.0);
//q.yz= r( q.yz, 0.2 );
//q.xz= r( q.xz, -2.0 + j );
}
else if( k == 9.0 )
{
p= vec3( Y.z * 18.0 + 3.0 * smoothstep( 0.3, 0.4, j ), Y.z * 3.0 + 3.0, j * -60.0 );
q.yz= r( q.yz, 0.1 );
q.xz= r( q.xz, j );
}
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 1.0);
c1 = cos(a1); s1 = sin(a1);
q.y = c1 * q1.y - s1 * q1.z;
q.x= q1.x;
q.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=q;
c1 = cos(a1); s1 = sin(a1);
q.x = c1 * q1.x + s1 * q1.z;
q.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
q = normalize(q);
vec3 b= vec3( .0,.0,.0 );
float a=1.0;
float t=w( q*666.0 )*0.2,y,z,d,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (d=1.0;t<66.0 && d>t*.003;t+=max( 0.01, d+0.01) )
{
d = f(p+q*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= q*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= A(p);
//d ab hier == Reflektion !!!
vec3 c = vec3(0.95,1.0,0.95 );
d= .18;
if( z > D(p) )
{
z= D(p);
c = vec3(1.0,0.0,0.0 );
d= .15;
}
if( z > B(p) )
{
z= B(p);
c = vec3(.1);
d= .6;
}
if( z > C(p) )
{
z= C(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, q ), -1.0, -0.05));
d= .1;
e.y= 2.0;
}
n+= (w( p * e.y ) + w( p * e.y * 2.0 ) + w( p * e.y * 4.0 )) * e.x;
n= normalize(n);
q= reflect( q, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= r( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
b+= a*c;//*(1.0-Reflect);
a*= d;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
q.yz= r( q.yz, 0.6 );
p+= q.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( q.y > 0.0 )
{
s(q.xz, 0.4, g/8.0);
q.x= abs( q.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(q.z),length(q.xz), step(0.0, q.x) ) ), 22.0 );
}
vec3 color = b + a*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*g*2)*.125+.5);
}

514
ev4k/mark.h_3 Normal file
View File

@@ -0,0 +1,514 @@
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float j, k, g=acos(-1.0), h= sqrt( 0.75 );
vec2 r(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//s around y axis w times
void s(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the l/ radius of the ring
float l(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float i( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float u( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float w(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
u( p+e.yyy),//n000,
u( p+e.xyy),//n100,
u( p+e.yxy),//n010,
u( p+e.xxy)),//n110),
vec4(
u( p+e.yyx),//n001,
u( p+e.xyx),//n101,
u( p+e.yxx),//n011,
u( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Wellenlinien
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float A(vec3 p)
{
return 99.0;
}
float B(vec3 p)
{
p.y+= cos( p.x * 0.3 + cos( p.z * 0.3 ) + j * 4.0 ) * cos( p.z * 0.1 + cos( p.x * 0.2 ) ) + 8.0;
p.xz= r( p.xz,j * 22.0 );
p.z= mod( p.z, 3.0 ) - 1.5;
return i( p.yz, 1.0, 0.25 );
}
float C(vec3 p)
{
p.y+= cos( p.x * 0.3 + cos( p.z * 0.3 ) + j * 4.0 ) * cos( p.z * 0.1 + cos( p.x * 0.2 ) );
p.xz= r( p.xz,j * 11.0 );
p.z= mod( p.z, 3.0 ) - 1.5;
return i( p.yz, 0.5, 0.25 );
}
float D(vec3 p)
{
return length( p+vec3(-11.0,-16.0,-22.0) ) - Y.z * 33.0 - 12.0;
}
float f(vec3 p)
{
float z= min( min( A(p), B(p) ), C(p) );
return max( length( p ) - 66.0, min( z, max( 0.5 - z, D(p) ) ) );
}
void main()
{
k= Y.x;
j= Y.y;
// Get the look direction for the current gxel (always look forwards)
vec3 q = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
if( k == 4.0 )
{
p= vec3( 0.0, -6.5 + j * 33.0, 5.0);
q.yz= r( q.yz, 1.0 );
q.xz= r( q.xz, 2.0 );
}
else if( k == 5.0 )
{
p= vec3( 11.0, 2.0, 22.0 - j * 66.0);
//q.yz= r( q.yz, 0.8 );
q.xz= r( q.xz, 4.0 - j * 5.0 );
}
else if( k == 6.0 )
{
p= vec3( 0.0, 7.0 - j * 11.0, 0.0 + j * -11.0 );
}
q = normalize(q);
vec3 b= vec3( .0,.0,.0 );
float a=1.0;
float t=w( q*666.0 )*0.2,y,z,d,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (d=1.0;t<66.0 && d>t*.003;t+=max( 0.01, d+0.01) )
{
d = f(p+q*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= q*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= A(p);
//d ab hier == Reflektion !!!
vec3 c = vec3(0.05,.1,.2 );
d= .7;
if( z > D(p) )
{
z= D(p);
c = vec3(1.0,0.0,0.0 );
d= .15;
}
if( z > B(p) )
{
z= B(p);
c = vec3(.6);
d= .3;
}
if( z > C(p) )
{
z= C(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, q ), -1.0, -0.05));
d= .2;
e.y= 5.0;
}
n+= (w( p * e.y ) + w( p * e.y * 2.0 ) + w( p * e.y * 4.0 )) * e.x;
n= normalize(n);
q= reflect( q, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= r( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
b+= a*c;//*(1.0-Reflect);
a*= d;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
q.yz= r( q.yz, 0.6 );
p+= q.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( q.y > 0.0 )
{
s(q.xz, 0.4, g/8.0);
q.x= abs( q.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(q.z),length(q.xz), step(0.0, q.x) ) ), 22.0 );
}
vec3 color = b + a*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*g*2)*.125+.5);
}

514
ev4k/mark.h_3_dbg Normal file
View File

@@ -0,0 +1,514 @@
#version 100
// Parameters from our host
// x: Scene
// y: Zeit
// z: Quadratzeit mit Faktor
// w: Aspect ratio
varying vec4 Y,Z;
// All data of our world
float j, k, g=acos(-1.0), h= sqrt( 0.75 );
vec2 r(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//s around y axis w times
void s(inout vec2 v,float x, float y)
{
float z=mod(atan(v.y,v.x),y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
}
//radius of the l/ radius of the ring
float l(vec3 p,float f)
{
return length(vec2(length(p.xz) - f,p.y));
}
float i( vec2 p, float y, float z )
{
return length( max( abs(p) - vec2(y) + vec2(z), 0.0 ) ) - z;
}
float u( vec3 p )
{
return fract( sin( p.x * 151.0 + p.y * 33.0 + p.z ) * 11.0 );
}
float w(vec3 p)
{
vec2 e = vec2(1.0, 0.0);
vec3 o= smoothstep(0.0,1.0,fract( p ));
p= floor( p );
vec4 n= mix(
vec4(
u( p+e.yyy),//n000,
u( p+e.xyy),//n100,
u( p+e.yxy),//n010,
u( p+e.xxy)),//n110),
vec4(
u( p+e.yyx),//n001,
u( p+e.xyx),//n101,
u( p+e.yxx),//n011,
u( p+e.xxx)),//n111),
o.z);
e = mix(n.xy, n.zw, o.y);
return mix(e.x, e.y, o.x);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Wellenlinien
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
float A(vec3 p)
{
return 99.0;
}
float B(vec3 p)
{
p.y+= cos( p.x * 0.3 + cos( p.z * 0.3 ) + j * 4.0 ) * cos( p.z * 0.1 + cos( p.x * 0.2 ) ) + 8.0;
p.xz= r( p.xz,j * 22.0 );
p.z= mod( p.z, 3.0 ) - 1.5;
return i( p.yz, 1.0, 0.25 );
}
float C(vec3 p)
{
p.y+= cos( p.x * 0.3 + cos( p.z * 0.3 ) + j * 4.0 ) * cos( p.z * 0.1 + cos( p.x * 0.2 ) );
p.xz= r( p.xz,j * 11.0 );
p.z= mod( p.z, 3.0 ) - 1.5;
return i( p.yz, 0.5, 0.25 );
}
float D(vec3 p)
{
return length( p+vec3(-11.0,-16.0,-22.0) ) - Y.z * 33.0 - 12.0;
}
float f(vec3 p)
{
float z= min( min( A(p), B(p) ), C(p) );
return max( length( p ) - 66.0, min( z, max( 0.5 - z, D(p) ) ) );
}
void main()
{
k= Y.x;
j= Y.y;
// Get the look direction for the current gxel (always look forwards)
vec3 q = vec3((Z.xy - 0.5), 1.0);
//Kamera sitzt an dieser Position
vec3 p;
if( k == 4.0 )
{
p= vec3( 0.0, -6.5 + j * 33.0, 5.0);
q.yz= r( q.yz, 1.0 );
q.xz= r( q.xz, 2.0 );
}
else if( k == 5.0 )
{
p= vec3( 11.0, 2.0, 22.0 - j * 66.0);
//q.yz= r( q.yz, 0.8 );
q.xz= r( q.xz, 4.0 - j * 5.0 );
}
else if( k == 6.0 )
{
p= vec3( 0.0, 7.0 - j * 11.0, 0.0 + j * -11.0 );
}
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 1.0);
c1 = cos(a1); s1 = sin(a1);
q.y = c1 * q1.y - s1 * q1.z;
q.x= q1.x;
q.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=q;
c1 = cos(a1); s1 = sin(a1);
q.x = c1 * q1.x + s1 * q1.z;
q.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
q = normalize(q);
vec3 b= vec3( .0,.0,.0 );
float a=1.0;
float t=w( q*666.0 )*0.2,y,z,d,m=0;
while (m++<2.0)
{
//bis zu einer Oberflaeche steppen
for (d=1.0;t<66.0 && d>t*.003;t+=max( 0.01, d+0.01) )
{
d = f(p+q*t);
}
if( t > 66.0 )
{
break;
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p+= q*t;
//vec3 n = normal(p);
vec2 e = vec2(0.04, 0.0);
vec3 n= vec3( f(p + e.xyy) - f(p - e.xyy), f(p + e.yxy) - f(p - e.yxy), f(p + e.yyx) - f(p - e.yyx) );
n= normalize(n);
z= A(p);
//d ab hier == Reflektion !!!
vec3 c = vec3(0.05,.1,.2 );
d= .7;
if( z > D(p) )
{
z= D(p);
c = vec3(1.0,0.0,0.0 );
d= .15;
}
if( z > B(p) )
{
z= B(p);
c = vec3(.6);
d= .3;
}
if( z > C(p) )
{
z= C(p);
c = vec3(0.0,0.6,0.8 ) * (0.9 - 0.15 / clamp(dot( n, q ), -1.0, -0.05));
d= .2;
e.y= 5.0;
}
n+= (w( p * e.y ) + w( p * e.y * 2.0 ) + w( p * e.y * 4.0 )) * e.x;
n= normalize(n);
q= reflect( q, n );
y= 6.0;
for (z=1.0;y>0.;y--)
{
z-=(y*.5-f(p+n*y*.5))/exp2(y);
}
c*= z;
//lambertlight
n.yz= r( n.yz, 0.6 );
c*= .4 + .3 * ( 1.0 - abs( n.y - .9 ) );
b+= a*c;//*(1.0-Reflect);
a*= d;// Reflect * (1.0-t/tmax);
t= 0.3;
}
p=vec3(0.8);
q.yz= r( q.yz, 0.6 );
p+= q.y * 0.2;
if( m < 2 )
{
p*= vec3( 0.95, 1.1, 1.2);
}
if( q.y > 0.0 )
{
s(q.xz, 0.4, g/8.0);
q.x= abs( q.x ) - .2;
p+= pow( smoothstep(.2, .0, mix( abs(q.z),length(q.xz), step(0.0, q.x) ) ), 22.0 );
}
vec3 color = b + a*p;
gl_FragColor.xyz = length(color) * (cos((Z.y + color)*g*2)*.125+.5);
}

136
ev4k/mark_0.h Normal file
View File

@@ -0,0 +1,136 @@
/* File generated with Shader Minifier 1.0.3
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_0_H_
# define MARK_0_H_
const char *mark_h_0 = ""
"varying vec4 Y,Z;"
"float j,k,g=acos(-1.),h=sqrt(.75);"
"vec2 r(vec2 v,float y)"
"{"
"return cos(y)*v+sin(y)*vec2(-v.y,v.x);"
"}"
"void s(inout vec2 v,float x,float y)"
"{"
"float z=mod(atan(v.y,v.x),y)-y*.5;"
"v=length(v)*vec2(cos(z),sin(z));"
"v.x-=x;"
"}"
"float l(vec3 p,float f)"
"{"
"return length(vec2(length(p.xz)-f,p.y));"
"}"
"float i(vec2 p,float y,float z)"
"{"
"return length(max(abs(p)-vec2(y)+vec2(z),0.))-z;"
"}"
"float u(vec3 p)"
"{"
"return fract(sin(p.x*151.+p.y*33.+p.z)*11.);"
"}"
"float w(vec3 p)"
"{"
"vec2 e=vec2(1.,0.);"
"vec3 o=smoothstep(0.,1.,fract(p));"
"p=floor(p);"
"vec4 n=mix(vec4(u(p+e.yyy),u(p+e.xyy),u(p+e.yxy),u(p+e.xxy)),vec4(u(p+e.yyx),u(p+e.xyx),u(p+e.yxx),u(p+e.xxx)),o.z);"
"e=mix(n.xy,n.zw,o.y);"
"return mix(e.x,e.y,o.x);"
"}"
"float A(vec3 p)"
"{"
"return p.y-w(p+j*3.)*.2+1.;"
"}"
"float B(vec3 p)"
"{"
"return min(length(p+vec3(0.,8.,0.))-8.5,l(p,2.3)-.5);"
"}"
"float C(vec3 p)"
"{"
"p.xz=r(p.xz,Y.z*11.);"
"float d1=max(length(p)-6.,p.y);"
"s(p.xz,5.,g/32.);"
"p.x=abs(p.x)-2.;"
"float dist=mix(length(p.yz),length(p.xyz),step(0.,p.x));"
"return min(d1,dist-.4);"
"}"
"float D(vec3 p)"
"{"
"p.y-=4.;"
"p.xz=r(p.xz,j*6.);"
"s(p.xz,0.,g/1.5);"
"p.yz=r(p.yz,g/2.);"
"float z=l(p,2.4)-.5;"
"return min(max(.5-z,length(p)-1.5-Y.z*22.),z);"
"}"
"float f(vec3 p)"
"{"
"float z=min(min(A(p),B(p)),C(p));"
"return max(length(p)-33.,min(z,max(.5-z,D(p))));"
"}"
"void main()"
"{"
"k=Y.x;"
"j=Y.y;"
"vec3 q=vec3(Z.xy-.5,1.),p;"
"if(k==0.)"
"p=vec3(12.,1.,0.),q.yz=r(q.yz,1.+j*-1.2),q.xz=r(q.xz,3.-j*1.5);"
"else"
" if(k==1.)"
"p=vec3(-3.,3.,-16.+j*10.),q.xz=r(q.xz,j*-.6);"
"else"
" if(k==2.)"
"p=vec3(0.,12.-j*8.,-16.+j*12.),q.yz=r(q.yz,.4+j*.4);"
"else"
" if(k==3.)"
"p=vec3(2.,2.,-6.-Y.z*22.);"
"q=normalize(q);"
"vec3 b=vec3(0.,0.,0.);"
"float a=1.,t=w(q*666.)*.2,y,z,d,m=0;"
"while(m++<2.)"
"{"
"for(d=1.;t<66.&&d>t*.003;t+=max(.01,d+.01))"
"d=f(p+q*t);"
"if(t>66.)"
"{"
"break;"
"}"
"p+=q*t;"
"vec2 e=vec2(.04,0.);"
"vec3 n=vec3(f(p+e.xyy)-f(p-e.xyy),f(p+e.yxy)-f(p-e.yxy),f(p+e.yyx)-f(p-e.yyx));"
"n=normalize(n);"
"z=A(p);"
"vec3 c=vec3(.05,.1,.2)*(t+5.)*.2;"
"d=.7;"
"if(z>D(p))"
"z=D(p),c=vec3(1.,0.,0.),d=.15;"
"if(z>B(p))"
"z=B(p),c=vec3(.1),d=.8;"
"if(z>C(p))"
"z=C(p),c=vec3(0.,.6,.8)*(.9-.15/clamp(dot(n,q),-1.,-.05)),d=.2,e.y=8.;"
"n+=(w(p*e.y)+w(p*e.y*2.)+w(p*e.y*4.))*e.x;"
"n=normalize(n);"
"q=reflect(q,n);"
"y=6.;"
"for(z=1.;y>0.;y--)"
"z-=(y*.5-f(p+n*y*.5))/exp2(y);"
"c*=z;"
"n.yz=r(n.yz,.6);"
"c*=.4+.3*(1.-abs(n.y-.9));"
"b+=a*c;"
"a*=d;"
"t=.3;"
"}"
"p=vec3(.8);"
"q.yz=r(q.yz,.6);"
"p+=q.y*.2;"
"if(m<2)"
"p*=vec3(.95,1.1,1.2);"
"if(q.y>0.)"
"s(q.xz,.4,g/8.),q.x=abs(q.x)-.2,p+=pow(smoothstep(.2,0.,mix(abs(q.z),length(q.xz),step(0.,q.x))),22.);"
"vec3 color=b+a*p;"
"gl_FragColor.xyz=length(color)*(cos((Z.y+color)*g*2)*.125+.5);"
"}";
#endif // MARK_0_H_

136
ev4k/mark_1.h Normal file
View File

@@ -0,0 +1,136 @@
/* File generated with Shader Minifier 1.0.3
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_1_H_
# define MARK_1_H_
const char *mark_h_1 = ""
"varying vec4 Y,Z;"
"float j,k,g=acos(-1.),h=sqrt(.75);"
"vec2 r(vec2 v,float y)"
"{"
"return cos(y)*v+sin(y)*vec2(-v.y,v.x);"
"}"
"void s(inout vec2 v,float x,float y)"
"{"
"float z=mod(atan(v.y,v.x),y)-y*.5;"
"v=length(v)*vec2(cos(z),sin(z));"
"v.x-=x;"
"}"
"float l(vec3 p,float f)"
"{"
"return length(vec2(length(p.xz)-f,p.y));"
"}"
"float i(vec2 p,float y,float z)"
"{"
"return length(max(abs(p)-vec2(y)+vec2(z),0.))-z;"
"}"
"float u(vec3 p)"
"{"
"return fract(sin(p.x*151.+p.y*33.+p.z)*11.);"
"}"
"float w(vec3 p)"
"{"
"vec2 e=vec2(1.,0.);"
"vec3 o=smoothstep(0.,1.,fract(p));"
"p=floor(p);"
"vec4 n=mix(vec4(u(p+e.yyy),u(p+e.xyy),u(p+e.yxy),u(p+e.xxy)),vec4(u(p+e.yyx),u(p+e.xyx),u(p+e.yxx),u(p+e.xxx)),o.z);"
"e=mix(n.xy,n.zw,o.y);"
"return mix(e.x,e.y,o.x);"
"}"
"float A(vec3 p)"
"{"
"vec3 o=p;"
"p.x=mod(p.x+step(2.*h,mod(p.y,4.*h)),2.)-1.;"
"p.y=mod(p.y,2.*h)-h;"
"o-=p;"
"p.z-=(k==10.?0.:44.)+2.*smoothstep(-.3,.3,cos(o.x*.03+cos(o.y*.03)+j*4.)*cos(o.y*.01+cos(o.x*.02)));"
"float z=length(p)-1.5;"
"s(p.xy,.7,g/3.);"
"return max(z,p.x);"
"}"
"float B(vec3 p)"
"{"
"return length(p+vec3(sin(j*3.)*22.,j*11.,-22.))-22.;"
"}"
"float C(vec3 p)"
"{"
"vec3 o=p;"
"p.x=mod(p.x+step(2.*h,mod(p.y,4.*h)),2.)-1.;"
"p.y=mod(p.y,2.*h)-h;"
"return max(abs(p.z+1.)-.2,h-length(p.xy));"
"}"
"float D(vec3 p)"
"{"
"return length(p-vec3(22.,22.,-14.))-Y.z*33.-12.;"
"}"
"float f(vec3 p)"
"{"
"float z=min(min(A(p),B(p)),C(p));"
"return max(length(p)-77.,min(z,max(.5-z,D(p))));"
"}"
"void main()"
"{"
"k=Y.x;"
"j=Y.y;"
"vec3 q=vec3(Z.xy-.5,1.),p;"
"if(k==10.)"
"p=vec3(33.,33.,-11.+j*5.),q.yz=r(q.yz,.8-j),q.xz=r(q.xz,.5+j);"
"else"
" if(k==11.)"
"p=vec3(-11.,-11.,-11.),q.yz=r(q.yz,-j*.7),q.xz=r(q.xz,-j);"
"else"
" if(k==12.)"
"p=vec3(33.,11.,33.),q.yz=r(q.yz,j*.4),q.xz=r(q.xz,1.2+j*.6);"
"else"
" if(k==13.)"
"p=vec3(mix(22.-88.*Y.z,-44.*j,j),22.,6.),q.yz=r(q.yz,j*.2),q.xz=r(q.xz,3.4+sqrt(j)*1.4);"
"q=normalize(q);"
"vec3 b=vec3(0.,0.,0.);"
"float a=1.,t=w(q*666.)*.2,y,z,d,m=0;"
"while(m++<2.)"
"{"
"for(d=1.;t<66.&&d>t*.003;t+=max(.01,d+.01))"
"d=f(p+q*t);"
"if(t>66.)"
"{"
"break;"
"}"
"p+=q*t;"
"vec2 e=vec2(.04,0.);"
"vec3 n=vec3(f(p+e.xyy)-f(p-e.xyy),f(p+e.yxy)-f(p-e.yxy),f(p+e.yyx)-f(p-e.yyx));"
"n=normalize(n);"
"z=A(p);"
"vec3 c=vec3(.8,0.,0.);"
"d=.15;"
"if(z>D(p))"
"z=D(p),c=vec3(1.,0.,0.),d=.15;"
"if(z>B(p))"
"z=B(p),c=vec3(.05,.1,.2),d=.7,e.y=.3;"
"if(z>C(p))"
"z=C(p),c=vec3(0.,.6,.8)*(.9-.15/clamp(dot(n,q),-1.,-.05)),d=.2,e.y=2.;"
"n+=(w(p*e.y)+w(p*e.y*2.)+w(p*e.y*4.))*e.x;"
"n=normalize(n);"
"q=reflect(q,n);"
"y=6.;"
"for(z=1.;y>0.;y--)"
"z-=(y*.5-f(p+n*y*.5))/exp2(y);"
"c*=z;"
"n.yz=r(n.yz,.6);"
"c*=.4+.3*(1.-abs(n.y-.9));"
"b+=a*c;"
"a*=d;"
"t=.3;"
"}"
"p=vec3(.8);"
"q.yz=r(q.yz,.6);"
"p+=q.y*.2;"
"if(m<2)"
"p*=vec3(.95,1.1,1.2);"
"if(q.y>0.)"
"s(q.xz,.4,g/8.),q.x=abs(q.x)-.2,p+=pow(smoothstep(.2,0.,mix(abs(q.z),length(q.xz),step(0.,q.x))),22.);"
"vec3 color=b+a*p;"
"gl_FragColor.xyz=length(color)*(cos((Z.y+color)*g*2)*.125+.5);"
"}";
#endif // MARK_1_H_

133
ev4k/mark_2.h Normal file
View File

@@ -0,0 +1,133 @@
/* File generated with Shader Minifier 1.0.3
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_2_H_
# define MARK_2_H_
const char *mark_h_2 = ""
"varying vec4 Y,Z;"
"float j,k,g=acos(-1.),h=sqrt(.75);"
"vec2 r(vec2 v,float y)"
"{"
"return cos(y)*v+sin(y)*vec2(-v.y,v.x);"
"}"
"void s(inout vec2 v,float x,float y)"
"{"
"float z=mod(atan(v.y,v.x),y)-y*.5;"
"v=length(v)*vec2(cos(z),sin(z));"
"v.x-=x;"
"}"
"float l(vec3 p,float f)"
"{"
"return length(vec2(length(p.xz)-f,p.y));"
"}"
"float i(vec2 p,float y,float z)"
"{"
"return length(max(abs(p)-vec2(y)+vec2(z),0.))-z;"
"}"
"float u(vec3 p)"
"{"
"return fract(sin(p.x*151.+p.y*33.+p.z)*11.);"
"}"
"float w(vec3 p)"
"{"
"vec2 e=vec2(1.,0.);"
"vec3 o=smoothstep(0.,1.,fract(p));"
"p=floor(p);"
"vec4 n=mix(vec4(u(p+e.yyy),u(p+e.xyy),u(p+e.yxy),u(p+e.xxy)),vec4(u(p+e.yyx),u(p+e.xyx),u(p+e.yxx),u(p+e.xxx)),o.z);"
"e=mix(n.xy,n.zw,o.y);"
"return mix(e.x,e.y,o.x);"
"}"
"float A(vec3 p)"
"{"
"vec3 o=p;"
"p.z=mod(p.z,11.)-5.5;"
"o-=p;"
"p.xy=r(p.xy,o.z+smoothstep(-.2,.2,cos(j*5.+cos(o.z*33.))));"
"s(p.xy,4.8,g/4.5);"
"return i(p.xz,1.,.3);"
"}"
"float B(vec3 p)"
"{"
"return 99.;"
"}"
"float C(vec3 p)"
"{"
"return p.z=mod(p.z,7.)-3.5,s(p.xy,0.,g/4.),max(abs(length(p.xy)-9.)-.2,3.-length(p.yz));"
"}"
"float D(vec3 p)"
"{"
"p.z+=j*33.;"
"p.xy=r(p.xy,p.z*.2-j*8.);"
"p.x+=1.;"
"float z=3.5*smoothstep(-22.,0.,p.z)-3.+Y.z*17.;"
"p.z=mod(p.z,.2)-.1;"
"return l(p.xzy,z)-1.;"
"}"
"float f(vec3 p)"
"{"
"float z=min(min(A(p),B(p)),C(p));"
"return max(length(p)-66.,min(z,max(.5-z,D(p))));"
"}"
"void main()"
"{"
"k=Y.x;"
"j=Y.y;"
"vec3 q=vec3(Z.xy-.5,1.),p;"
"if(k==7.)"
"p=vec3(-11.,3.,-28.-j*11.),q.yz=r(q.yz,.2),q.xz=r(q.xz,-2.+j);"
"else"
" if(k==8.)"
"p=vec3(-1.,1.,-33.-j*7.);"
"else"
" if(k==9.)"
"p=vec3(Y.z*18.+3.*smoothstep(.3,.4,j),Y.z*3.+3.,j*-60.),q.yz=r(q.yz,.1),q.xz=r(q.xz,j);"
"q=normalize(q);"
"vec3 b=vec3(0.,0.,0.);"
"float a=1.,t=w(q*666.)*.2,y,z,d,m=0;"
"while(m++<2.)"
"{"
"for(d=1.;t<66.&&d>t*.003;t+=max(.01,d+.01))"
"d=f(p+q*t);"
"if(t>66.)"
"{"
"break;"
"}"
"p+=q*t;"
"vec2 e=vec2(.04,0.);"
"vec3 n=vec3(f(p+e.xyy)-f(p-e.xyy),f(p+e.yxy)-f(p-e.yxy),f(p+e.yyx)-f(p-e.yyx));"
"n=normalize(n);"
"z=A(p);"
"vec3 c=vec3(.95,1.,.95);"
"d=.18;"
"if(z>D(p))"
"z=D(p),c=vec3(1.,0.,0.),d=.15;"
"if(z>B(p))"
"z=B(p),c=vec3(.1),d=.6;"
"if(z>C(p))"
"z=C(p),c=vec3(0.,.6,.8)*(.9-.15/clamp(dot(n,q),-1.,-.05)),d=.1,e.y=2.;"
"n+=(w(p*e.y)+w(p*e.y*2.)+w(p*e.y*4.))*e.x;"
"n=normalize(n);"
"q=reflect(q,n);"
"y=6.;"
"for(z=1.;y>0.;y--)"
"z-=(y*.5-f(p+n*y*.5))/exp2(y);"
"c*=z;"
"n.yz=r(n.yz,.6);"
"c*=.4+.3*(1.-abs(n.y-.9));"
"b+=a*c;"
"a*=d;"
"t=.3;"
"}"
"p=vec3(.8);"
"q.yz=r(q.yz,.6);"
"p+=q.y*.2;"
"if(m<2)"
"p*=vec3(.95,1.1,1.2);"
"if(q.y>0.)"
"s(q.xz,.4,g/8.),q.x=abs(q.x)-.2,p+=pow(smoothstep(.2,0.,mix(abs(q.z),length(q.xz),step(0.,q.x))),22.);"
"vec3 color=b+a*p;"
"gl_FragColor.xyz=length(color)*(cos((Z.y+color)*g*2)*.125+.5);"
"}";
#endif // MARK_2_H_

123
ev4k/mark_3.h Normal file
View File

@@ -0,0 +1,123 @@
/* File generated with Shader Minifier 1.0.3
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_3_H_
# define MARK_3_H_
const char *mark_h_3 = ""
"varying vec4 Y,Z;"
"float j,k,g=acos(-1.),h=sqrt(.75);"
"vec2 r(vec2 v,float y)"
"{"
"return cos(y)*v+sin(y)*vec2(-v.y,v.x);"
"}"
"void s(inout vec2 v,float x,float y)"
"{"
"float z=mod(atan(v.y,v.x),y)-y*.5;"
"v=length(v)*vec2(cos(z),sin(z));"
"v.x-=x;"
"}"
"float l(vec3 p,float f)"
"{"
"return length(vec2(length(p.xz)-f,p.y));"
"}"
"float i(vec2 p,float y,float z)"
"{"
"return length(max(abs(p)-vec2(y)+vec2(z),0.))-z;"
"}"
"float u(vec3 p)"
"{"
"return fract(sin(p.x*151.+p.y*33.+p.z)*11.);"
"}"
"float w(vec3 p)"
"{"
"vec2 e=vec2(1.,0.);"
"vec3 o=smoothstep(0.,1.,fract(p));"
"p=floor(p);"
"vec4 n=mix(vec4(u(p+e.yyy),u(p+e.xyy),u(p+e.yxy),u(p+e.xxy)),vec4(u(p+e.yyx),u(p+e.xyx),u(p+e.yxx),u(p+e.xxx)),o.z);"
"e=mix(n.xy,n.zw,o.y);"
"return mix(e.x,e.y,o.x);"
"}"
"float A(vec3 p)"
"{"
"return 99.;"
"}"
"float B(vec3 p)"
"{"
"return p.y+=cos(p.x*.3+cos(p.z*.3)+j*4.)*cos(p.z*.1+cos(p.x*.2))+8.,p.xz=r(p.xz,j*22.),p.z=mod(p.z,3.)-1.5,i(p.yz,1.,.25);"
"}"
"float C(vec3 p)"
"{"
"return p.y+=cos(p.x*.3+cos(p.z*.3)+j*4.)*cos(p.z*.1+cos(p.x*.2)),p.xz=r(p.xz,j*11.),p.z=mod(p.z,3.)-1.5,i(p.yz,.5,.25);"
"}"
"float D(vec3 p)"
"{"
"return length(p+vec3(-11.,-16.,-22.))-Y.z*33.-12.;"
"}"
"float f(vec3 p)"
"{"
"float z=min(min(A(p),B(p)),C(p));"
"return max(length(p)-66.,min(z,max(.5-z,D(p))));"
"}"
"void main()"
"{"
"k=Y.x;"
"j=Y.y;"
"vec3 q=vec3(Z.xy-.5,1.),p;"
"if(k==4.)"
"p=vec3(0.,-6.5+j*33.,5.),q.yz=r(q.yz,1.),q.xz=r(q.xz,2.);"
"else"
" if(k==5.)"
"p=vec3(11.,2.,22.-j*66.),q.xz=r(q.xz,4.-j*5.);"
"else"
" if(k==6.)"
"p=vec3(0.,7.-j*11.,j*-11.);"
"q=normalize(q);"
"vec3 b=vec3(0.,0.,0.);"
"float a=1.,t=w(q*666.)*.2,y,z,d,m=0;"
"while(m++<2.)"
"{"
"for(d=1.;t<66.&&d>t*.003;t+=max(.01,d+.01))"
"d=f(p+q*t);"
"if(t>66.)"
"{"
"break;"
"}"
"p+=q*t;"
"vec2 e=vec2(.04,0.);"
"vec3 n=vec3(f(p+e.xyy)-f(p-e.xyy),f(p+e.yxy)-f(p-e.yxy),f(p+e.yyx)-f(p-e.yyx));"
"n=normalize(n);"
"z=A(p);"
"vec3 c=vec3(.05,.1,.2);"
"d=.7;"
"if(z>D(p))"
"z=D(p),c=vec3(1.,0.,0.),d=.15;"
"if(z>B(p))"
"z=B(p),c=vec3(.6),d=.3;"
"if(z>C(p))"
"z=C(p),c=vec3(0.,.6,.8)*(.9-.15/clamp(dot(n,q),-1.,-.05)),d=.2,e.y=5.;"
"n+=(w(p*e.y)+w(p*e.y*2.)+w(p*e.y*4.))*e.x;"
"n=normalize(n);"
"q=reflect(q,n);"
"y=6.;"
"for(z=1.;y>0.;y--)"
"z-=(y*.5-f(p+n*y*.5))/exp2(y);"
"c*=z;"
"n.yz=r(n.yz,.6);"
"c*=.4+.3*(1.-abs(n.y-.9));"
"b+=a*c;"
"a*=d;"
"t=.3;"
"}"
"p=vec3(.8);"
"q.yz=r(q.yz,.6);"
"p+=q.y*.2;"
"if(m<2)"
"p*=vec3(.95,1.1,1.2);"
"if(q.y>0.)"
"s(q.xz,.4,g/8.),q.x=abs(q.x)-.2,p+=pow(smoothstep(.2,0.,mix(abs(q.z),length(q.xz),step(0.,q.x))),22.);"
"vec3 color=b+a*p;"
"gl_FragColor.xyz=length(color)*(cos((Z.y+color)*g*2)*.125+.5);"
"}";
#endif // MARK_3_H_

116
ev4k/mark_small.h Normal file
View File

@@ -0,0 +1,116 @@
/* File generated with Shader Minifier 1.0.3
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_SMALL_H_
# define MARK_SMALL_H_
# define V_Y "v"
# define V_Z "m"
const char *mark_fs_0 = ""
"varying vec4 v;"
"varying vec2 m;"
"float z=6.28319;"
"vec2 n(vec2 v,float m)"
"{"
"return cos(m)*v+sin(m)*vec2(-v.y,v.x);"
"}"
"void n(inout vec2 v,float m,float l)"
"{"
"float z=mod(atan(v.y,v.x),l)-l*.5;"
"v=length(v)*vec2(cos(z),sin(z));"
"v.x-=m;"
"}"
"float f(vec3 v,float z)"
"{"
"return length(vec2(length(v.xz)-z,v.y));"
"}"
"float f(vec3 v)"
"{"
"return v.y+.6;"
"}"
"float n(vec3 v)"
"{"
"return min(length(v+vec3(0,8.,0))-8.5,f(v,2.3)-.5);"
"}"
"float s(vec3 v)"
"{"
"float m=max(length(v)-6.,v.y);"
"n(v.xz,5.,z/64.);"
"v.x=abs(v.x)-2.;"
"float l=mix(length(v.yz),length(v.xyz),step(0.,v.x));"
"return min(m,l-.4);"
"}"
"float h(vec3 m)"
"{"
"m.y-=4.;"
"m.xz=n(m.xz,v.y*6.);"
"n(m.xz,0.,z/3.);"
"m.yz=n(m.yz,z/4.);"
"float l=f(m,2.4)-.5;"
"return min(max(.5-l,length(m)-1.5),l);"
"}"
"float l(vec3 v)"
"{"
"return min(min(min(f(v),n(v)),s(v)),h(v));"
"}"
"void main()"
"{"
"vec3 y=vec3(m.xy-.5,1),x=vec3(-30.-v.y*5.,3.,-16.+v.y*24.);"
"y.xz=n(y.xz,v.y*-2.5);"
"y=normalize(y);"
"vec3 i=vec3(0.,0.,0.);"
"float a=1.,r=0.,e=99.,c;"
"while(a>.1)"
"{"
"for(c=1.;r<e&&c>.005;r+=c)"
"c=l(x+y*r);"
"if(r<e)"
"{"
"x+=y*r;"
"vec3 t=vec3(.04,0.,0.),w=vec3(l(x+t.xyy)-l(x-t.xyy),l(x+t.yxy)-l(x-t.yxy),l(x+t.yyx)-l(x-t.yyx));"
"w=normalize(w);"
"y=reflect(y,w);"
"r=.1;"
"float p=999.;"
"vec3 o=vec3(.3,.2,.1);"
"float g=.125;"
"if(p>f(x))"
"p=f(x);"
"if(p>n(x))"
"p=n(x),o=vec3(.1,.1,.1),g=.8;"
"if(p>s(x))"
"p=s(x),o=vec3(.4,.3,.03),g=.2;"
"if(p>h(x))"
"p=h(x),o=vec3(.7,0.,0.),g=.3;"
"p=1.;"
"for(float u=.2;u<12.;u=u*1.1+.125)"
"p+=min(l(x+vec3(0.,1.,-.5)*u),0.);"
"o*=clamp(p,.2,1.);"
"float u=10.;"
"for(p=1.;u>0.;u--)"
"p-=(u*.4-l(x+w*u*.4))/exp2(u);"
"o*=p;"
"w.yz=n(w.yz,.6);"
"o*=.4+.3*(1.-abs(w.y-.9));"
"i+=a*o;"
"a*=g;"
"}"
"else"
"{"
"y.yz=n(y.yz,.6);"
"float u=.4+.4*y.y;"
"if(y.y>0.)"
"{"
"n(y.xz,.2,z/16.);"
"y.x=abs(y.x)-.08;"
"float o=mix(abs(y.z),length(y.xz),step(0.,y.x));"
"u+=pow(smoothstep(.2,0.,o),40.);"
"}"
"i+=a*u.xxx;"
"a=0.;"
"}"
"}"
"gl_FragColor.xyz=i;"
"}";
#endif // MARK_SMALL_H_

Binary file not shown.

22
ev4k/musik/4klang.h Normal file
View File

@@ -0,0 +1,22 @@
// some useful song defines for 4klang
#define SAMPLE_RATE 44100
#define BPM 145.065796
#define MAX_INSTRUMENTS 10
#define MAX_PATTERNS 148
#define PATTERN_SIZE_SHIFT 3
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
#define SAMPLES_PER_TICK 4559
#define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
#define POLYPHONY 2
#define FLOAT_32BIT
#define SAMPLE_TYPE float
#define WINDOWS_OBJECT
// declaration of the external synth render function, you'll always need that
extern "C" void __stdcall _4klang_render(void*);
// declaration of the external envelope buffer. access only if you're song was exported with that option
extern "C" float _4klang_envelope_buffer;
// declaration of the external note buffer. access only if you're song was exported with that option
extern "C" int _4klang_note_buffer;

BIN
ev4k/musik/4klang.obj Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

295
ev4k/release.cpp Normal file
View File

@@ -0,0 +1,295 @@
#ifndef _DEBUG
#define WINDOWED
//#define NOMUSICTIMING
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"
#include "small.h"
#include "synth.h"
#ifndef ASPECT
#define ASPECT 1.78
#endif
#ifndef SCREENWIDTH
#define SCREENWIDTH 640
#endif
#ifndef SCREENHEIGTH
#define SCREENHEIGTH 360
#endif
#define STR2(x) #x
#define STR(x) STR2(x)
#pragma data_seg(".Shader0")
#include "mark_0.h"
#pragma data_seg(".Shader1")
#include "mark_1.h"
#pragma data_seg(".Shader2")
#include "mark_2.h"
#pragma data_seg(".Shader3")
#include "mark_3.h"
#pragma data_seg(".vertexshader")
static char* vsh = "varying vec4 Y,Z;void main(){Y=gl_Color;Z=gl_Vertex*vec4("STR( ASPECT )",1,1,1)*.5+.5;gl_Position=gl_Vertex;}";
#pragma data_seg(".pfd")
static const PIXELFORMATDESCRIPTOR pfd={
0, 1, PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 8
};
#pragma data_seg(".dms")
static DEVMODE dmScreenSettings={
"",0,0,sizeof(dmScreenSettings),0,DM_PELSWIDTH|DM_PELSHEIGHT,
0,0,0,0,0,0,0,0,0,0,0,0,0,"",0,0,SCREENWIDTH,SCREENHEIGTH
};
#pragma data_seg(".strings")
static const char* glCreateProgram = "glCreateProgram";
#pragma data_seg(".strings9")
static const char* glCreateShader = "glCreateShader";
#pragma data_seg(".strings8")
static const char* glShaderSource = "glShaderSource";
#pragma data_seg(".strings7")
static const char* glCompileShader = "glCompileShader";
#pragma data_seg(".strings6")
static const char* glAttachShader = "glAttachShader";
#pragma data_seg(".strings5")
static const char* glLinkProgram = "glLinkProgram";
#pragma data_seg(".strings4")
static const char* glUseProgram = "glUseProgram";
#pragma data_seg(".strings3")
static const char* stredit = "edit";
#pragma data_seg(".strings2")
static const char* strstatic = "static";
#pragma data_seg(".strings1")
static const char* strRED = "RED";
#pragma code_seg(".compile")
unsigned int compileShader(const char* vsh, const char* fsh)
{
_asm
{
xor edi, edi
push glCreateProgram
call dword ptr [wglGetProcAddress]
call eax
mov esi, eax
lea ebx,[vsh]
push GL_VERTEX_SHADER
push glCreateShader
call dword ptr [wglGetProcAddress]
call eax
push eax
push esi
push glAttachShader
push eax
push glCompileShader
push edi
push ebx
push 1
push eax
push glShaderSource
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
lea ebx,[fsh]
push GL_FRAGMENT_SHADER
push glCreateShader
call dword ptr [wglGetProcAddress]
call eax
push eax
push esi
push glAttachShader
push eax
push glCompileShader
push edi
push ebx
push 1
push eax
push glShaderSource
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
push esi
push glLinkProgram
call dword ptr [wglGetProcAddress]
call eax
mov eax, esi
}
}
#pragma bss_seg(".introbss")
static unsigned char gCurScene;
static int gCurSceneStart;
static unsigned int shaders[4];
#pragma data_seg(".g_SceneLength")
unsigned char g_SceneLength[]=
{
16, 8, 8, 32,
16, 16, 32,
16, 16, 32,
16, 16, 16, 32,
0
};
#pragma data_seg(".g_SceneShader")
unsigned char g_SceneShader[]=
{
0,0,0,0,
1,1,1,
2,2,2,
3,3,3,3
};
#pragma data_seg(".g_SceneFactor")
float g_SceneFactor[]=
{
0, 0, 0, 1.0f,
0, 0, 1.0f,
0, 0, 1.0f,
0, 1.0f, 1.0f, 2.0f
};
#pragma code_seg(".main")
void _cdecl main()
{
_asm
{
xor edi, edi
}
HDC hDC;
#ifndef WINDOWED
_asm
{
push CDS_FULLSCREEN
push offset dmScreenSettings
call dword ptr [ChangeDisplaySettingsA]
push edi
push edi
push edi
push edi
push edi
push edi
push edi
push edi
push WS_POPUP | WS_VISIBLE | WS_MAXIMIZE
push edi
push stredit
push edi
call dword ptr [CreateWindowExA]
push eax
call dword ptr [GetDC]
mov dword ptr [hDC],eax
}
#else
_asm
{
push edi
push edi
push edi
push edi
push SCREENHEIGTH
push SCREENWIDTH
push edi
push edi
push WS_EX_APPWINDOW | WS_VISIBLE | WS_SYSMENU
push strRED
push strstatic
push edi
call dword ptr [CreateWindowExA]
push eax
call dword ptr [GetDC]
mov dword ptr [hDC],eax
}
#endif
_asm
{
push offset pfd
push offset pfd
push dword ptr [hDC]
call dword ptr [ChoosePixelFormat]
push eax
push dword ptr [hDC]
call dword ptr [SetPixelFormat]
push dword ptr [hDC]
call dword ptr [wglCreateContext]
push eax
push dword ptr [hDC]
call dword ptr [wglMakeCurrent]
}
_asm
{
push mark_h_1
push vsh
push mark_h_2
push vsh
push mark_h_3
push vsh
push mark_h_0
push vsh
call dword ptr [compileShader]
mov dword ptr shaders[0],eax
call dword ptr [compileShader]
mov dword ptr shaders[4],eax
call dword ptr [compileShader]
mov dword ptr shaders[8],eax
call dword ptr [compileShader]
mov dword ptr shaders[12],eax
}
_asm
{
push edi
call dword ptr [ShowCursor]
call dword ptr [InitSound]
}
float lf_Time= 0.0f;
do
{
int Sample= get_Sample() - gCurSceneStart;
int SceneEnd= g_SceneLength[ gCurScene ] * (44100 * 60 / 145);//samples per tick
((PFNGLUSEPROGRAMPROC)wglGetProcAddress(glUseProgram))(shaders[ g_SceneShader[ gCurScene ] ]);
lf_Time = (float)Sample / (float)SceneEnd;
glColor3f((float)gCurScene, lf_Time, lf_Time * lf_Time * g_SceneFactor[ gCurScene ]);
glRects(-1, -1, 1, 1);
SwapBuffers(hDC);
if (Sample > SceneEnd)
{
gCurSceneStart+= SceneEnd;
gCurScene++;
}
}
while (g_SceneLength[gCurScene] > 0 && !GetAsyncKeyState(VK_ESCAPE));
ExitProcess(0);
}
#endif

191
ev4k/release.h Normal file
View File

@@ -0,0 +1,191 @@
#pragma once
#pragma data_seg(".shaders")
static char* fsh =
"#define ve return\n" // Line 1
"#define ec float\n" // Line 1
"varying vec4 Y;" // Line 6
"varying vec2 Z;" // Line 9
"vec4 R(vec3 n,vec3 m,int k);" // Line 12
"vec3 T(vec4 j,vec3 l,vec3 m);" // Line 13
"vec3 f,b,a,h,e,d,X;" // Line 17
"ec g,W,c,V,U;ec A(vec2 j){" // Line 18
"int i=int(j.x*40+j.y*6400);" // Line 24
"i=(i<<13)^i;" // Line 25
"ve 1-ec((i*(i*i*15731+789221)+1376312589)&0x7fffffff)/1073741824;}ec B(vec2 k){" // Line 26
"k=mod(k,1000.);" // Line 33
"vec2 i=fract(k);" // Line 34
"k-=i;" // Line 35
"vec2 j=i*i*(3.-2.*i);" // Line 36
"ve mix(" // Line 37
"mix(A(k+vec2(0,0)),A(k+vec2(1,0)),j.x)," // Line 38
"mix(A(k+vec2(0,1)),A(k+vec2(1,1)),j.x),j.y);}ec C(ec i){" // Line 39
"ve i*.5+.5;}ec D(ec k,ec l,ec j){" // Line 46
"ec i=(" // Line 53
"C(sin(c*2*(k+l+Y.y*j)))+" // Line 54
"C(sin(c*(l-k-Y.y*j)))+" // Line 55
"C(sin(c*(l+Y.y*j)))+" // Line 56
"C(sin(c*3*(k-Y.y*j))))*.3;" // Line 57
"ve pow(i,2.);}vec3 E(vec3 j){" // Line 58
"int i=int(mod(gl_FragCoord.x,3.));" // Line 65
"if(i==0)j*=X.xyz;" // Line 66
"if(i==1)j*=X.yzx;" // Line 67
"if(i==2)j*=X.zxy;" // Line 68
"ve mix(j,vec3(C(B(Z*333+A(vec2(Y.y))*33333))),Y.x*.3+.03);}vec3 F(vec3 i){" // Line 69
"vec2 j=Z*2-1;" // Line 76
"ec k=j.x*(j.y+3);" // Line 77
"ve i+a*" // Line 78
"D(k+50*e.x,k+50*e.z,1.5)*" // Line 79
"(C(j.y))*min(-e.y*30,.3);}ec G(vec2 i){" // Line 80
"ve (-.035+pow((D(i.x*10,i.y*10,.0)*2-1),2.)*.05)" // Line 87
"-(i.x-.1)*.2;}vec3 H(vec3 i){" // Line 88
"ve normalize(vec3(" // Line 95
"G(i.xz-vec2(U,0))-G(i.xz+vec2(U,0))," // Line 96
"2*U," // Line 97
"G(i.xz-vec2(0,U))-G(i.xz+vec2(0,U))));}vec3 I(vec3 i,vec3 j){" // Line 98
"ve (.3+.7*max(dot(j,b),.0))*a*i;}vec3 J(vec3 i){" // Line 105
"ve normalize(vec3(" // Line 112
"D(i.x*160-cos(i.z*10)*12,i.z*140,4.)," // Line 113
"8," // Line 114
"D(i.z*160-sin(i.x*10)*12,i.x*140,4.))*2-1);}vec3 K(vec3 k,vec3 l){" // Line 115
"vec3 j=H(k);" // Line 122
"vec3 i=mix(" // Line 123
"vec3(.66,.55,.4)" // Line 125
"-.2*B(abs(k.xz*150))" // Line 128
"-.2*B(abs(k.yy+.002*B(abs(k.xz*150)))*3000)," // Line 131
"vec3(.1,.3,0)*(B(k.xz*7000.)*.4+.5)," // Line 134
"clamp(j.y*(D(k.x*111,k.z*111,.0)*.5-k.y*40),.0,1.));" // Line 137
"if(k.y<=0)" // Line 140
"i+=5*J(.8*k).x*min(.3,-k.y*8);" // Line 141
"ve I(i,j);}vec3 L(vec3 j,vec3 i){" // Line 144
"ve j.y<=-V*V?" // Line 151
"h:" // Line 152
"mix(vec3(-.5,-.25,0),vec3(2),1-(i.y*.5+.5));}vec3 M(vec3 k,vec3 j){" // Line 153
"vec3 m=J(k);" // Line 162
"vec4 l=R(k,refract(j,m,.9),2);" // Line 166
"ec i=clamp(pow(1.03*(1-length(l.xyz-k)),16.),.0,1.);" // Line 169
"ve mix(" // Line 172
"e.y<0?L(k,j):h," // Line 173
"mix(" // Line 174
"T(R(k,reflect(j,m),2),k,j)," // Line 175
"T(l,k,j)," // Line 176
"clamp(-d.y+i,.0,1.))," // Line 177
"l.w==3.?.5:pow(i,.5));}vec3 N(vec3 k,vec3 l){" // Line 178
"vec3 j,i;" // Line 186
"j=normalize(k-f);" // Line 189
"vec2 m=.5+.5*vec2(atan(j.z,j.x),acos(j.y))/c;" // Line 192
"m.x-=Y.y;" // Line 195
"i=mix(vec3(1),vec3(1,0,0),mod(step(fract(m.x*6),.5)+step(fract(m.y*6),.5),2.));" // Line 198
"ve I(i,j)" // Line 200
"+pow(max(dot(j,normalize(b-l)),.0),33.)*a;}ec O(vec3 n,vec3 m,ec l){" // Line 201
"ec i,j,k,p;" // Line 209
"i=0;" // Line 210
"vec3 o=n;" // Line 211
"for(ec q=0;q<l;q+=i)" // Line 214
"{" // Line 215
"o+=m*i;" // Line 217
"p=o.y;" // Line 218
"ec r=G(o.xz);" // Line 221
"if(p<=r)" // Line 223
"{" // Line 224
"ve q-i+i*(j-k)/(p-r+j-k);}" // Line 227
"j=r;" // Line 232
"k=p;" // Line 233
"i=.002+(q/W);}" // Line 237
"ve 9.;}ec P(vec3 m,vec3 l){" // Line 241
"vec3 k=m-f;" // Line 248
"ec i,j;" // Line 249
"i=dot(k,l);" // Line 250
"if(i>0)" // Line 251
"ve 9.;" // Line 252
"j=i*i-dot(k,k)+g*g;" // Line 253
"if(j>0)" // Line 254
"{" // Line 255
"ve -i-sqrt(j);}" // Line 256
"ve 9.;}ec Q(vec3 j,vec3 i){" // Line 258
"ec k=-j.y/i.y;" // Line 265
"ve k>=V?k:9.;}vec4 R(vec3 n,vec3 m,int k){" // Line 266
"ec p,i,o,l;" // Line 278
"p=k!=2?Q(n,m):9.;" // Line 281
"i=k!=3?P(n,m):9.;" // Line 282
"o=k!=1?O(n,m,min(.5,.002+min(p,i))):9.;" // Line 283
"W/=20;" // Line 286
"l=min(o,min(p,min(i,9.)));" // Line 289
"if(l==9)" // Line 292
"ve vec4(0);" // Line 293
"vec3 j=n+m*l;" // Line 296
"if(l==o)" // Line 299
"ve vec4(j,1);" // Line 300
"if(l==p)" // Line 301
"ve vec4(j,2);" // Line 302
"if(l==i)" // Line 303
"ve vec4(j,3);}vec3 S(vec4 j,vec3 l,vec3 m){" // Line 304
"vec3 k=l.y<V?h:L(e,m);" // Line 315
"ec i=clamp(length(j.xyz-l)*(e.y<=0?4:2),.0,1.);" // Line 318
"if(j.w==1)" // Line 322
"ve mix(K(j.xyz,m),k,i);" // Line 323
"if(j.w==2)" // Line 324
"ve mix(M(j.xyz,m),k,i);" // Line 325
"if(j.w==3)" // Line 326
"ve mix(" // Line 327
"mix(N(j.xyz,m),T(R(j.xyz,reflect(m,normalize(j.xyz-f)),3),j.xyz,m),.5)" // Line 329
",k,i);" // Line 330
"ve L(l,m);}vec3 T(vec4 j,vec3 l,vec3 m){" // Line 332
"vec3 k=l.y<V?h:L(e,m);" // Line 341
"ec i=clamp(length(j.xyz-l)*(e.y<=0?4:2),.0,1.);" // Line 344
"if(j.w==1)" // Line 347
"ve mix(K(j.xyz,m),k,i);" // Line 348
"if(j.w==2)" // Line 349
"ve mix(h,k,i);" // Line 350
"if(j.w==3)" // Line 351
"ve mix(N(j.xyz,m),k,i);" // Line 352
"ve k;}void main(){" // Line 354
"W=100;" // Line 368
"c=3.1416;" // Line 371
"X=vec3(1.2,.9,.9);" // Line 372
"V=.0001;" // Line 373
"U=.01;" // Line 374
"ec k=10;" // Line 377
"int j=int(Y.y);" // Line 380
"d=vec3((Z.xy-.5),1);" // Line 383
"if(j>22&&j<27)" // Line 386
"{" // Line 387
"k=min(1.,sin((Y.y-23)*c*.25)*12);" // Line 388
"e=vec3(.12,.005,Y.y*.08);" // Line 389
"d=vec3(gl_ModelViewMatrix*vec4(d,1));" // Line 390
"d.y+=.1*cos(Y.y*4);}" // Line 391
"else if(j>14&&j<23)" // Line 394
"{" // Line 395
"k=min(1.,sin((Y.y-15)*c*.125)*24);" // Line 396
"d+=vec3(0,.1*cos(Y.y*4),0);" // Line 397
"e=vec3(.08,.01*sin(Y.y*4)+.002,Y.y*.11);}" // Line 398
"else " // Line 402
"{" // Line 403
"e=vec3(.1,.004,.0)+vec3(.1,.005,20)" // Line 405
"*vec3(A(vec2(j,k++)),A(vec2(j,k++)),A(vec2(j,k++)));" // Line 406
"e=mix(" // Line 409
"e+vec3(.008)*vec3(A(vec2(j,k++)),A(vec2(j,k++)),A(vec2(j,k++)))," // Line 410
"e+vec3(.008)*vec3(A(vec2(j,k++)),A(vec2(j,k++)),A(vec2(j,k++)))," // Line 411
"Y.y-j);" // Line 413
"e.y+=G(e.xz)+.02;" // Line 416
"e+=.02*H(e);" // Line 419
"k=min(1.,step(-28.,-Y.y)*sin((Y.y-j)*c)*3);}" // Line 422
"d=normalize(d);" // Line 425
"if(j>22&&j<27)" // Line 429
"f=e+.1*vec3(gl_ModelViewMatrix*vec4(0,0,1,1));" // Line 430
"else " // Line 432
"f=e+.02*vec3(sin(Y.y),0,5+cos(Y.y));" // Line 433
"f.y+=.01+G(f.xz);" // Line 435
"g=j<14?.0:U*.5+U*Y.z;" // Line 436
"f+=2*g*H(f);" // Line 437
"b=vec3(.58,.58,-.58);" // Line 440
"a=vec3(1.2);" // Line 441
"h=vec3(.3,.33,.4);" // Line 442
"if(e.y<=0)" // Line 445
"{" // Line 446
"W*=.75;" // Line 448
"a*=.8;}" // Line 451
"vec3 i=S(R(e,d,0),e,d);" // Line 455
"if(e.y<=0)" // Line 459
"i=F(i);" // Line 460
"gl_FragColor.xyz=E(step(2.,Y.y)*k*i);}";

View File

@@ -0,0 +1 @@
link.exe /CRINKLER /COMPMODE:FAST /ORDERTRIES:10000 /HASHTRIES:768 /UNSAFEIMPORT /TRUNCATEFLOATS:16 /HASHSIZE:256 /RANGE:opengl32 /OUT:%1 /SUBSYSTEM:WINDOWS /ENTRY:"main" "release.obj" "..\4klang.obj" opengl32.lib winmm.lib kernel32.lib user32.lib gdi32.lib

30
ev4k/release/bf-red.nfo Normal file
View File

@@ -0,0 +1,30 @@
R.aymarching
E.xperimental
D.emonstration
code :-: TGGC, xTr1m, Hel
sfx :-: xTr1m, LPChip
gfx :-: TGGC, GRAPHICNOISE
packer :-: crinkler by Mentor/TBC and Blueberry/Loonies
Shader Minifier by Ctrl-Alt-Test
synthesizer :-: 4klang by Gopher & pOWL of Alcatraz.
greets Alcatraz, ASD, Calodox, Conspiracy, Fairlight,
Farbrausch, Fuzzion, Kakiarts, Loonies,
Nuance, Panda Cube, RGBA, Speckdrumm, Still,
TBC, TBL, Titan, Traction, Youth Uprising
atla, BlueCobold, mcdeck, matt|6s, pro, rapso,
rip, TomasRiker
anyone else from #gamedev.ger, #sppro and #cpp
And we like to thank TBC/Loonies/Alcatraz/Ctrl-Alt-Test for making their
fantastic tools available to the public. Also the information shared about
raymarching by various sceners, especially iq, las and all the contributors
to Shadertoy helped a lot.

75
ev4k/release/compile.bat Normal file
View File

@@ -0,0 +1,75 @@
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=960 /DSCREENHEIGTH=510 /DASPECT="1.8" /DWINDOWED
cd release
call !link_file red_960x510_window.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=800 /DSCREENHEIGTH=600 /DASPECT="1.3" /DWINDOWED
cd release
call !link_file red_800x600_window.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=640 /DSCREENHEIGTH=480 /DASPECT="1.3"
cd release
call !link_file red_640x480.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=640 /DSCREENHEIGTH=400 /DASPECT="1.6"
cd release
call !link_file red_640x400.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=800 /DSCREENHEIGTH=600 /DASPECT="1.3"
cd release
call !link_file red_800x600.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1024 /DSCREENHEIGTH=768 /DASPECT="1.3"
cd release
call !link_file red_1024x768.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1280 /DSCREENHEIGTH=800 /DASPECT="1.6"
cd release
call !link_file red_1280x800.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1280 /DSCREENHEIGTH=720 /DASPECT="1.8" /DWIDESCREEN
cd release
call !link_file red_1280x720.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1280 /DSCREENHEIGTH=1024 /DASPECT="1.25"
cd release
call !link_file red_1280x1024.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1400 /DSCREENHEIGTH=1050 /DASPECT="1.3"
cd release
call !link_file red_1400x1050.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1600 /DSCREENHEIGTH=1200 /DASPECT="1.3"
cd release
call !link_file red_1600x1200.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1600 /DSCREENHEIGTH=900 /DASPECT="1.8"
cd release
call !link_file red_1600x900.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1680 /DSCREENHEIGTH=1050 /DASPECT="1.6" /DWIDESCREEN
cd release
call !link_file red_1680x1050.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1920 /DSCREENHEIGTH=1080 /DASPECT="1.8" /DWIDESCREEN
cd release
call !link_file red_1920x1080.exe
cd ..
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1920 /DSCREENHEIGTH=1200 /DASPECT="1.6" /DWIDESCREEN
cd release
call !link_file red_1920x1200.exe

BIN
ev4k/release/link.exe Normal file

Binary file not shown.

163
ev4k/shader_code.h Normal file
View File

@@ -0,0 +1,163 @@
/* File generated with Shader Minifier 1.0.3
* http://www.ctrl-alt-test.fr
*/
#ifndef SHADER_CODE_H_
# define SHADER_CODE_H_
# define V_Y "v"
# define V_Z "m"
const char *mark_fs = ""
"varying vec4 v;"
"varying vec2 m;"
"vec3 f,z;"
"float x=6.28319;"
"vec2 n(vec2 f,float v)"
"{"
"return cos(v)*f+sin(v)*vec2(-f.y,f.x);"
"}"
"void i(inout vec3 v,float f)"
"{"
"float z=mod(atan(v.z,v.x),f)-f*.5;"
"v.xz=length(v.xz)*vec2(cos(z),sin(z));"
"}"
"float i(vec3 v,float f,float z)"
"{"
"return length(vec2(length(v.xz)-f,v.y))-z;"
"}"
"float s(vec3 v,float z)"
"{"
"return length(v)-z;"
"}"
"float i(vec3 v)"
"{"
"return v.y+.6;"
"}"
"float n(vec3 v)"
"{"
"return min(s(v+vec3(0,8.,0),8.5),i(v,2.3,.5));"
"}"
"float s(vec3 v)"
"{"
"float z=max(s(v,6.),v.y);"
"i(v,x/64.);"
"v.x=abs(v.x-5.)-2.;"
"float f=mix(length(v.yz),length(v.xyz),step(0.,v.x));"
"return min(z,f-.4);"
"}"
"float l(vec3 f)"
"{"
"return f.y-=4.,f.xz=n(f.xz,v.y*6.),i(f,x/12.),f.yz=n(f.yz,x/4.),min(i(f,2.,.15),s(f,1.5));"
"}"
"float h(vec3 v)"
"{"
"return min(min(min(i(v),n(v)),s(v)),l(v));"
"}"
"int g(vec3 v)"
"{"
"float z=1000.;"
"int f;"
"if(i(v)<z)"
"z=i(v),f=0;"
"if(n(v)<z)"
"z=n(v),f=1;"
"if(s(v)<z)"
"z=s(v),f=2;"
"if(l(v)<z)"
"z=l(v),f=3;"
"return f;"
"}"
"vec3 p(vec3 v)"
"{"
"vec3 z=vec3(.04,0.,0.),f;"
"f.x=h(v+z.xyy)-h(v-z.xyy);"
"f.y=h(v+z.yxy)-h(v-z.yxy);"
"f.z=h(v+z.yyx)-h(v-z.yyx);"
"return normalize(f);"
"}"
"float e(vec3 v)"
"{"
"float z=1.;"
"for(float f=.2;f<12.;f=f*1.1+.125)"
"z+=min(h(v+vec3(0.,1.,0.)*f),0.);"
"return clamp(z,.2,1.);"
"}"
"float e(vec3 v,vec3 f,float z,float i)"
"{"
"float x,y=sign(z);"
"for(x=y*.5+.5;i>0.;i--)"
"x-=(i*z-h(v+f*i*z*y))/exp2(i);"
"return x;"
"}"
"vec3 t(vec3 v)"
"{"
"float z=.3+.3*dot(v,vec3(0.,1.,0.));"
"i(v,x/16.);"
"v.x=abs(v.x-.2)-.08;"
"float f=mix(abs(v.z),length(v.xz),step(0.,v.x));"
"z+=pow(smoothstep(.1,0.,f),15.);"
"return vec3(z);"
"}"
"float c(vec3 v)"
"{"
"float z=abs(v.y-.9);"
"return.4+.3*(1-z);"
"}"
"void main()"
"{"
"int x=int(v.y);"
"float y=mod(v.y,1.);"
"z=vec3(m.xy-.5,1);"
"f=vec3(-30.-y*5.,3.,-16.+y*24.);"
"z.xz=n(z.xz,y*-2.5);"
"if(false)"
"{"
"f.x=gl_ModelViewMatrix[0][0];"
"f.y=gl_ModelViewMatrix[0][1];"
"f.z=gl_ModelViewMatrix[0][2];"
"float i=gl_ModelViewMatrix[1][1],s,r;"
"vec3 l=vec3(m.xy-.5,1);"
"s=cos(i);"
"r=sin(i);"
"z.y=s*l.y-r*l.z;"
"z.x=l.x;"
"z.z=r*l.y+s*l.z;"
"i=gl_ModelViewMatrix[1][0];"
"l=z;"
"s=cos(i);"
"r=sin(i);"
"z.x=s*l.x+r*l.z;"
"z.z=-r*l.x+s*l.z;"
"}"
"z=normalize(z);"
"vec3 i=vec3(0.,0.,0.);"
"float s=1.,l=0.,r=256.,a;"
"while(s>.1)"
"{"
"for(a=1.;l<r&&a>.05;l+=a)"
"a=h(f+z*l);"
"if(l<r)"
"{"
"f+=z*l;"
"vec3 o=p(f);"
"z=reflect(z,o);"
"l=.1;"
"vec3 d=vec3(.3,.2,.1);"
"float u=.125;"
"int M=g(f);"
"if(M==1)"
"d=vec3(.1,.1,.1),u=.8;"
"if(M==2)"
"d=vec3(.4,.3,.03),u=.2;"
"if(M==3)"
"d=vec3(.7,0.,0.),u=.2;"
"d*=c(o)*e(f)*e(f,o,.4,10.);"
"i+=s*d;"
"s*=u;"
"}"
"else"
" i+=s*t(z),s=0.;"
"}"
"gl_FragColor.xyz=i;"
"}";
#endif // SHADER_CODE_H_

BIN
ev4k/shader_minifier.exe Normal file

Binary file not shown.

127
ev4k/small.h Normal file
View File

@@ -0,0 +1,127 @@
#pragma once
#pragma code_seg("sm0")
DWORD x_Ftol(float af_Value)
{
DWORD ldw_RetVal;
__asm fld af_Value
__asm fistp ldw_RetVal
return ldw_RetVal;
}
#pragma code_seg("sm1")
__forceinline float x_Frac(float af_Value)
{
return af_Value - x_Ftol(af_Value);
}
#pragma code_seg("sm2")
__forceinline float x_Abs(float af_Value)
{
__asm fld af_Value
__asm fabs
}
#pragma code_seg("sm3")
float x_Sin(float af_Value)
{
__asm fld af_Value
__asm fsin
}
#pragma code_seg("sm4")
float x_Sign(float af_Value)
{
if (af_Value != 0)
return af_Value / x_Abs(af_Value);
return 1.0f;
}
#pragma code_seg("sm5")
float x_Sqrt(float af_Value)
{
__asm fld af_Value
__asm fsqrt
}
#pragma code_seg("sm7")
__forceinline void x_MemCopy(void* av_Dest_, const void* av_Src_, size_t ai_Size)
{
__asm mov esi, av_Src_
__asm mov edi, av_Dest_
__asm mov ecx, ai_Size
__asm rep movsb
}
#pragma code_seg("sm8")
float x_Fmod(float x, float y)
{
__asm fld y
__asm fld x
__asm fprem
__asm fxch
__asm fstp x
}
#pragma data_seg("smA")
static unsigned long seed=0x12345678;
#pragma code_seg("sm9")
__forceinline void x_Randomize(unsigned long x)
{
seed = x;
}
#pragma code_seg("smB")
float x_Rand()
{
seed = seed * 0x76364873 + 1234567;
return (float)(seed & 0x7FFFFFFF) * (const float)(2.0f / (float)0x7FFFFFFF) - 1.0f;
}
#pragma code_seg("smS")
__forceinline size_t x_Strlen(const char* as_String)
{
size_t li_Length = 0;
while (*as_String++) ++li_Length;
return li_Length;
}
#pragma code_seg("smP")
float x_Pow(float x, float y){
float r;
__asm{
fld y
fld x
fyl2x
fld1
fld st(1)
fprem
f2xm1
faddp st(1),st
fscale
fxch st(1)
fstp st(0)
fstp r
}
return r;
}
extern "C"
{
int _fltused = 1;
}

24
ev4k/switches.txt Normal file
View File

@@ -0,0 +1,24 @@
/O1
/Oi
/Os
/D "WIN32"
/D "NDEBUG"
/D "_WINDOWS"
/FD
/MT
/GS-
/GR-
/Fp".\Release/cmath.pch"
/FAs
/Fa".\Release/"
/Fo".\Release/"
/Fd".\Release/"
/FR".\Release\\"
/W0
/nologo
/c
/Zi
/Gz
/TP
/errorReport:prompt
/I"E:\SDKs\Microsoft Platform SDK\Include"

77
ev4k/synth.cpp Normal file
View File

@@ -0,0 +1,77 @@
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include "windows.h"
#include "mmsystem.h"
#include "mmreg.h"
#define USE_SOUND_THREAD
#define SAMPLE_RATE 44100
#define MAX_SAMPLES SAMPLE_RATE*2*60*4
#pragma bss_seg(".synthbss")
static float lpSoundBuffer[MAX_SAMPLES];
static HWAVEOUT hWaveOut;
#pragma data_seg(".wavefmt")
WAVEFORMATEX WaveFMT =
{
WAVE_FORMAT_IEEE_FLOAT,
2, // channels
SAMPLE_RATE, // samples per sec
SAMPLE_RATE*4*2, // bytes per sec
8, // block alignment;
32, // bits per sample
0 // extension not needed
};
#pragma data_seg(".wavehdr")
WAVEHDR WaveHDR =
{
(LPSTR)lpSoundBuffer,
MAX_SAMPLES*4,
0,
0,
0,
0,
0,
0
};
#pragma data_seg(".mmtime")
MMTIME MMTime =
{
TIME_SAMPLES,
0
};
extern "C" void _4klang_render(float*);
#ifdef USE_SOUND_THREAD
#pragma code_seg(".sndthrd")
DWORD WINAPI SoundThread( LPVOID lpParam )
{
_4klang_render(lpSoundBuffer);
return 0;
}
#endif
#pragma code_seg(".initsnd")
extern "C" void InitSound()
{
#ifdef USE_SOUND_THREAD
CreateThread(0, 0, SoundThread, 0, 0, 0);
#else
_4klang_render(lpSoundBuffer);
#endif
waveOutOpen ( &hWaveOut, WAVE_MAPPER, &WaveFMT, NULL, 0, CALLBACK_NULL );
waveOutPrepareHeader( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
waveOutWrite ( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
}
#pragma code_seg(".sample")
extern "C" int get_Sample()
{
waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME));
return (MMTime.u.sample);
}

82
ev4k/synth.h Normal file
View File

@@ -0,0 +1,82 @@
#pragma once
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include "windows.h"
#include "mmsystem.h"
#include "mmreg.h"
#define USE_SOUND_THREAD
#define SAMPLE_RATE 44100
#define MAX_SAMPLES SAMPLE_RATE*2*60*4
#pragma bss_seg(".synthbss")
static float lpSoundBuffer[MAX_SAMPLES];
static HWAVEOUT hWaveOut;
#pragma data_seg(".wavefmt")
WAVEFORMATEX WaveFMT =
{
WAVE_FORMAT_IEEE_FLOAT,
2, // channels
SAMPLE_RATE, // samples per sec
SAMPLE_RATE*4*2, // bytes per sec
8, // block alignment;
32, // bits per sample
0 // extension not needed
};
#pragma data_seg(".wavehdr")
WAVEHDR WaveHDR =
{
(LPSTR)lpSoundBuffer,
MAX_SAMPLES*4,
0,
0,
0,
0,
0,
0
};
#pragma data_seg(".mmtime")
MMTIME MMTime =
{
TIME_SAMPLES,
0
};
extern "C"
{
void _4klang_render(float*);
#ifdef USE_SOUND_THREAD
#pragma code_seg(".sndthrd")
DWORD WINAPI SoundThread( LPVOID lpParam )
{
_4klang_render(lpSoundBuffer);
return 0;
}
#endif
#pragma code_seg(".initsnd")
__forceinline void InitSound()
{
#ifdef USE_SOUND_THREAD
CreateThread(0, 0, SoundThread, 0, 0, 0);
#else
_4klang_render(lpSoundBuffer);
#endif
waveOutOpen ( &hWaveOut, WAVE_MAPPER, &WaveFMT, NULL, 0, CALLBACK_NULL );
waveOutPrepareHeader( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
waveOutWrite ( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
}
#pragma code_seg(".sample")
__forceinline int get_Sample()
{
waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME));
return (MMTime.u.sample);
}
}