port from perforce
This commit is contained in:
22
ev12-4k/4klang.h
Normal file
22
ev12-4k/4klang.h
Normal file
@@ -0,0 +1,22 @@
|
||||
// some useful song defines for 4klang
|
||||
#define SAMPLE_RATE 44100
|
||||
#define BPM 135.110291
|
||||
#define MAX_INSTRUMENTS 8
|
||||
#define MAX_PATTERNS 131
|
||||
#define PATTERN_SIZE_SHIFT 3
|
||||
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
|
||||
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
#define SAMPLES_PER_TICK 4896
|
||||
#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
ev12-4k/4klang.obj
Normal file
BIN
ev12-4k/4klang.obj
Normal file
Binary file not shown.
23
ev12-4k/Blue/BLUE.txt
Normal file
23
ev12-4k/Blue/BLUE.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
Enlighten
|
||||
|
||||
|
||||
code :-: TGGC & xtr1m
|
||||
|
||||
sfx :-: xtr1m
|
||||
|
||||
gfx :-: TGGC & GRAPHICNOISE
|
||||
|
||||
tools :-: crinkler by Mentor/TBC and Blueberry/Loonies
|
||||
:-: 4klang by Gopher & pOWL of Alcatraz.
|
||||
:-: Shader Minifier by Control-Alt-Test
|
||||
|
||||
|
||||
greets ASD, bluflame, Calodox, Conspiracy, Fairlight,
|
||||
Farbrausch, Fuzzion, Kakiarts, Loonies,
|
||||
Nuance, Panda Cube, RGBA, Speckdrumm, Still,
|
||||
TBC, TBL, Titan, Traction
|
||||
atla, BlueCobold, mcdeck, matt|6s, pro, rapso,
|
||||
rip, TomasRiker, xardias
|
||||
anyone else from #gamedev.ger, #sppro and #cpp
|
||||
|
||||
|
||||
BIN
ev12-4k/GlU32.Lib
Normal file
BIN
ev12-4k/GlU32.Lib
Normal file
Binary file not shown.
BIN
ev12-4k/OpenGL32.Lib
Normal file
BIN
ev12-4k/OpenGL32.Lib
Normal file
Binary file not shown.
370
ev12-4k/Shaders.cpp
Normal file
370
ev12-4k/Shaders.cpp
Normal file
@@ -0,0 +1,370 @@
|
||||
//#define DEBUG_COMPRESSED_SHADER
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#include "Shaders.h"
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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( "CurStep","d", strNewData);
|
||||
strNewData= ReplaceString( "rotate","r", strNewData);
|
||||
strNewData= ReplaceString( "repeatHex","sh", strNewData);
|
||||
strNewData= ReplaceString( "repeat","s", strNewData);
|
||||
strNewData= ReplaceString( "pi2","P", strNewData);
|
||||
strNewData= ReplaceString( "sqrtOf075","Q", strNewData);
|
||||
strNewData= ReplaceString( "EndlessBar","O", strNewData);
|
||||
strNewData= ReplaceString( "CurTime","R", strNewData);
|
||||
strNewData= ReplaceString( "CurScene","S", strNewData);
|
||||
strNewData= ReplaceString( "torus","T", strNewData);
|
||||
strNewData= ReplaceString( "noise3D","N", strNewData);
|
||||
strNewData= ReplaceString( "smoothnoise","M", 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
|
||||
|
||||
//#include "mark_small.h";
|
||||
|
||||
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);
|
||||
|
||||
/*const char* ShaderSource1[]=
|
||||
{
|
||||
mark_fs_0,
|
||||
mark_fs_p1_0,
|
||||
mark_fs_p2,
|
||||
mark_fs_p3_0,
|
||||
mark_fs_p4,
|
||||
mark_fs_p5_0,
|
||||
mark_fs_p6,
|
||||
};
|
||||
glShaderSource(lh_Shader, 7, ShaderSource1, NULL);*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
void printShaderInfoLog(GLhandleARB ah_Shader)
|
||||
{
|
||||
int li_InfologLength = 0;
|
||||
int li_CharsWritten = 0;
|
||||
static char ls_InfoLog[8192];
|
||||
((PFNGLGETSHADERIVPROC)wglGetProcAddress("glGetShaderiv"))(ah_Shader, GL_INFO_LOG_LENGTH, &li_InfologLength);
|
||||
|
||||
if (li_InfologLength > 0)
|
||||
{
|
||||
((PFNGLGETSHADERINFOLOGPROC)wglGetProcAddress("glGetShaderInfoLog"))(ah_Shader, li_InfologLength, &li_CharsWritten, ls_InfoLog);
|
||||
OutputDebugString(ls_InfoLog);
|
||||
OutputDebugString("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void printProgramInfoLog(GLhandleARB ah_Program)
|
||||
{
|
||||
int li_InfologLength = 0;
|
||||
int li_CharsWritten = 0;
|
||||
static char ls_InfoLog[8192];
|
||||
((PFNGLGETPROGRAMIVPROC)wglGetProcAddress("glGetProgramiv"))(ah_Program, GL_INFO_LOG_LENGTH, &li_InfologLength);
|
||||
|
||||
if (li_InfologLength > 0)
|
||||
{
|
||||
((PFNGLGETPROGRAMINFOLOGPROC)wglGetProcAddress("glGetProgramInfoLog"))(ah_Program, li_InfologLength, &li_CharsWritten, ls_InfoLog);
|
||||
OutputDebugString(ls_InfoLog);
|
||||
OutputDebugString("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
20
ev12-4k/Shaders.h
Normal file
20
ev12-4k/Shaders.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#define MAX_SHADER_ID 4
|
||||
|
||||
#include <windows.h>
|
||||
#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();
|
||||
23
ev12-4k/bp4k.sln
Normal file
23
ev12-4k/bp4k.sln
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bp4k", "bp4k.vcproj", "{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
|
||||
26
ev12-4k/bp4k.v11.sln
Normal file
26
ev12-4k/bp4k.v11.sln
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2012
|
||||
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
|
||||
Compress (fast)|Win32 = Compress (fast)|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}.Compress (fast)|Win32.ActiveCfg = Compress (fast)|Win32
|
||||
{213903DE-E40A-4D23-9310-E520AC2B412E}.Compress (fast)|Win32.Build.0 = Compress (fast)|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
|
||||
436
ev12-4k/bp4k.vcproj
Normal file
436
ev12-4k/bp4k.vcproj
Normal file
@@ -0,0 +1,436 @@
|
||||
<?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=""$(ProjectDir)""
|
||||
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 "mark.fs_0" -o mark_0.h -v --no-renaming
rem minify\shader_minifier.exe "mark.fs_1" -o mark_1.h -v --no-renaming
rem minify\shader_minifier.exe "mark.fs_2" -o mark_2.h -v --no-renaming
rem minify\shader_minifier.exe "mark.fs_0" -o mark_small.h -v
"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UseUnicodeResponseFiles="false"
|
||||
AdditionalOptions="/QIfist"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
FloatingPointModel="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="0"
|
||||
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=""$(ProjectDir)""
|
||||
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=""$(ProjectDir)""
|
||||
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"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\main.Debug.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\main.Release.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Shaders.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\synth.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</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=".\mark_small.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>
|
||||
274
ev12-4k/bp4k.vcxproj
Normal file
274
ev12-4k/bp4k.vcxproj
Normal file
@@ -0,0 +1,274 @@
|
||||
<?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 (fast)|Win32">
|
||||
<Configuration>Compress (fast)</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<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">
|
||||
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress (fast)|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<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)'=='Compress (fast)|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>11.0.50522.1</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<ExecutablePath>$(SolutionDir)\obj;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress (fast)|Win32'">
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<ExecutablePath>$(SolutionDir)\obj;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EntryPointSymbol>
|
||||
</EntryPointSymbol>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>rem minify\shader_minifier.exe "mark.fs_0" -o mark_0.h -v --no-renaming
|
||||
rem minify\shader_minifier.exe "mark.fs_1" -o mark_1.h -v --no-renaming
|
||||
rem minify\shader_minifier.exe "mark.fs_2" -o mark_2.h -v --no-renaming
|
||||
rem minify\shader_minifier.exe "mark.fs_0" -o mark_small.h -v
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;SOFTDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling />
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/CRINKLER %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;libcmt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ManifestFile />
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<LinkTimeCodeGeneration />
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<LinkErrorReporting />
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">
|
||||
<PreBuildEvent>
|
||||
<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 />
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat />
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/CRINKLER /COMPMODE:SLOW /ORDERTRIES:2000 /HASHTRIES:150 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ManifestFile />
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<LinkTimeCodeGeneration />
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<LinkErrorReporting />
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Compress (fast)|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:FAST /UNSAFEIMPORT /ORDERTRIES:1000 /TRUNCATEFLOATS:24 /HASHSIZE:200 /HASHTRIES:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<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=".\main.Debug.cpp" />
|
||||
<ClCompile Include=".\Shaders.cpp" />
|
||||
<ClCompile Include="main.Release.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include=".\glext.h" />
|
||||
<ClInclude Include="4klang.h" />
|
||||
<ClInclude Include="mark_small.h" />
|
||||
<CustomBuild Include=".\release.h">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">
|
||||
</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Compress (fast)|Win32'">
|
||||
</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">
|
||||
</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Compress (fast)|Win32'">
|
||||
</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</Command>
|
||||
</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" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
1
ev12-4k/do_minify.bat
Normal file
1
ev12-4k/do_minify.bat
Normal file
@@ -0,0 +1 @@
|
||||
minify\shader_minifier.exe "mark.fs_0" -o mark_small.h -v --no-sequence
|
||||
BIN
ev12-4k/ev12.4kp
Normal file
BIN
ev12-4k/ev12.4kp
Normal file
Binary file not shown.
BIN
ev12-4k/ev12.it
Normal file
BIN
ev12-4k/ev12.it
Normal file
Binary file not shown.
2
ev12-4k/files.txt
Normal file
2
ev12-4k/files.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
main.cpp
|
||||
synth.cpp
|
||||
18
ev12-4k/generic.vs
Normal file
18
ev12-4k/generic.vs
Normal file
@@ -0,0 +1,18 @@
|
||||
varying vec2 Y,Z;
|
||||
|
||||
void main()
|
||||
{
|
||||
Y = gl_Color.xy;
|
||||
Z = (gl_Vertex.xy*vec2(1.7777,1.0))*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
ev12-4k/glext.h
Normal file
7271
ev12-4k/glext.h
Normal file
File diff suppressed because it is too large
Load Diff
401
ev12-4k/main.Debug.cpp
Normal file
401
ev12-4k/main.Debug.cpp
Normal file
@@ -0,0 +1,401 @@
|
||||
#ifdef _DEBUG
|
||||
|
||||
#define MULTISHADER
|
||||
#define LOCALMUSIC
|
||||
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <process.h>
|
||||
#include "Shaders.h"
|
||||
#include "small.h"
|
||||
#include "synth.h"
|
||||
|
||||
#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;
|
||||
|
||||
#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.fs";
|
||||
|
||||
#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")
|
||||
__forceinline 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;
|
||||
}
|
||||
|
||||
__forceinline unsigned int compileShaderMultiple(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, 7, fsh, NULL);
|
||||
((PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader"))(s);
|
||||
((PFNGLATTACHSHADERPROC)wglGetProcAddress("glAttachShader")) (p,s);
|
||||
((PFNGLLINKPROGRAMPROC)wglGetProcAddress("glLinkProgram"))(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
#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);\
|
||||
}\
|
||||
}
|
||||
|
||||
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);
|
||||
OutputDebugString("Shader loaded.\n");
|
||||
}
|
||||
_findclose(hfile);
|
||||
}
|
||||
::Sleep(100);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <cmath>
|
||||
|
||||
float g_DebugCamPos[ 3 ]= {0,2.0f,-48.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= 12.0f;
|
||||
|
||||
bool g_bForceCompile= true;
|
||||
|
||||
void MoveCam( float& fCurTime )
|
||||
{
|
||||
float fSpeed= 0.125f*3.0f;
|
||||
|
||||
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 ]= -48.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;
|
||||
|
||||
}
|
||||
|
||||
LRESULT MessageCallback(HWND ar_Handle, UINT aw_Message, WPARAM aw_Param, LPARAM al_Param)
|
||||
{
|
||||
return DefWindowProc(ar_Handle, aw_Message, aw_Param, al_Param);
|
||||
}
|
||||
|
||||
#pragma bss_seg(".main_bss")
|
||||
int gCurScene= 0;
|
||||
|
||||
#pragma data_seg(".main_glob")
|
||||
const int g_SceneLength= 16;
|
||||
const int g_MagicConstant=313600;
|
||||
|
||||
#pragma code_seg(".main")
|
||||
void _cdecl main()
|
||||
{
|
||||
//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);
|
||||
|
||||
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);
|
||||
|
||||
LARGE_INTEGER li_OldTime = { 0 };
|
||||
|
||||
float lf_Time= 0.0f;
|
||||
do
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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 * 135.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);
|
||||
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);
|
||||
|
||||
glRects(-1, -1, 1, 1);
|
||||
SwapBuffers(hDC);
|
||||
}
|
||||
while ( !GetAsyncKeyState(VK_ESCAPE) );
|
||||
ExitProcess(0);
|
||||
}
|
||||
#endif
|
||||
309
ev12-4k/main.Release.cpp
Normal file
309
ev12-4k/main.Release.cpp
Normal file
@@ -0,0 +1,309 @@
|
||||
#ifndef _DEBUG
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_EXTRA_LEAN
|
||||
#define USE_SOUND_THREAD
|
||||
|
||||
#ifndef ASPECT
|
||||
#define ASPECT 1.77
|
||||
#define SCREENWIDTH 640
|
||||
#define SCREENHEIGHT 360
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include "glext.h"
|
||||
#include "small.h"
|
||||
#include "mmsystem.h"
|
||||
#include "mmreg.h"
|
||||
#include "4klang.h"
|
||||
#include "mark_small.h"
|
||||
|
||||
#pragma bss_seg(".bss")
|
||||
unsigned int shaders[4];
|
||||
SAMPLE_TYPE lpSoundBuffer[MAX_SAMPLES*2];
|
||||
HWAVEOUT hWaveOut;
|
||||
HDC hDC;
|
||||
|
||||
#pragma data_seg(".wavefmt")
|
||||
WAVEFORMATEX WaveFMT =
|
||||
{
|
||||
#ifdef FLOAT_32BIT
|
||||
WAVE_FORMAT_IEEE_FLOAT,
|
||||
#else
|
||||
WAVE_FORMAT_PCM,
|
||||
#endif
|
||||
2, // channels
|
||||
SAMPLE_RATE, // samples per sec
|
||||
SAMPLE_RATE*sizeof(SAMPLE_TYPE)*2, // bytes per sec
|
||||
sizeof(SAMPLE_TYPE)*2, // block alignment;
|
||||
sizeof(SAMPLE_TYPE)*8, // bits per sample
|
||||
0 // extension not needed
|
||||
};
|
||||
|
||||
#pragma data_seg(".wavehdr")
|
||||
WAVEHDR WaveHDR =
|
||||
{
|
||||
(LPSTR)lpSoundBuffer,
|
||||
MAX_SAMPLES*sizeof(SAMPLE_TYPE)*2, // MAX_SAMPLES*sizeof(float)*2(stereo)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
#pragma data_seg(".mmtime")
|
||||
MMTIME MMTime =
|
||||
{
|
||||
TIME_SAMPLES,
|
||||
0
|
||||
};
|
||||
|
||||
#define STR2(x) #x
|
||||
#define STR(x) STR2(x)
|
||||
|
||||
#pragma data_seg(".vertexshader")
|
||||
static char* vsh = "varying vec2 "I_Y","I_Z";void main(){"I_Y"=gl_Color.xy;"I_Z"=(gl_Vertex.xy*vec2("STR( ASPECT )",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,SCREENHEIGHT
|
||||
};
|
||||
|
||||
#pragma data_seg(".glLinkProgram")
|
||||
static const char* glLinkProgram = "glLinkProgram";
|
||||
#pragma data_seg(".glAttachShader")
|
||||
static const char* glAttachShader = "glAttachShader";
|
||||
#pragma data_seg(".glCompileShader")
|
||||
static const char* glCompileShader = "glCompileShader";
|
||||
#pragma data_seg(".glShaderSource")
|
||||
static const char* glShaderSource = "glShaderSource";
|
||||
#pragma data_seg(".glCreateShader")
|
||||
static const char* glCreateShader = "glCreateShader";
|
||||
#pragma data_seg(".glCreateProgram")
|
||||
static const char* glCreateProgram = "glCreateProgram";
|
||||
#pragma data_seg(".glUseProgram")
|
||||
static const char* glUseProgram = "glUseProgram";
|
||||
#pragma data_seg(".edit")
|
||||
static const char* windowClass = "edit";
|
||||
|
||||
#pragma data_seg(".magicInt")
|
||||
static const int g_MagicConstant = 313600 * 4;
|
||||
#pragma data_seg(".magicFloat")
|
||||
static const float magicFloat = 313600.0f;
|
||||
|
||||
#pragma code_seg(".main")
|
||||
void _cdecl main()
|
||||
{
|
||||
unsigned int p,f,v,fsh;
|
||||
__asm
|
||||
{
|
||||
xor esi, esi
|
||||
|
||||
// CreateWindowEx:
|
||||
push esi
|
||||
push esi
|
||||
push esi
|
||||
push esi
|
||||
push esi
|
||||
push esi
|
||||
push SCREENHEIGHT
|
||||
push SCREENWIDTH
|
||||
push esi
|
||||
push esi
|
||||
push WS_OVERLAPPEDWINDOW | WS_VISIBLE
|
||||
push esi
|
||||
push windowClass;
|
||||
push esi
|
||||
|
||||
// ChangeDisplaySettings:
|
||||
//push CDS_FULLSCREEN
|
||||
//push offset dmScreenSettings
|
||||
|
||||
//call dword ptr [ChangeDisplaySettings]
|
||||
call dword ptr [CreateWindowExA]
|
||||
push eax
|
||||
call dword ptr [GetDC]
|
||||
mov dword ptr [hDC], eax
|
||||
|
||||
// waveOutOpen
|
||||
push esi
|
||||
push esi
|
||||
push esi
|
||||
push offset WaveFMT
|
||||
push 0FFFFFFFFh
|
||||
push offset hWaveOut
|
||||
|
||||
// Sleep
|
||||
push 4096
|
||||
|
||||
// CreateThread
|
||||
push esi
|
||||
push esi
|
||||
push offset lpSoundBuffer
|
||||
push _4klang_render
|
||||
push esi
|
||||
push esi
|
||||
|
||||
// PixelFormat
|
||||
push dword ptr [hDC]
|
||||
push offset pfd
|
||||
push offset pfd
|
||||
push dword ptr [hDC]
|
||||
call dword ptr [ChoosePixelFormat]
|
||||
push eax
|
||||
push dword ptr [hDC]
|
||||
call dword ptr [SetPixelFormat]
|
||||
call dword ptr [wglCreateContext]
|
||||
push eax
|
||||
push dword ptr [hDC]
|
||||
call dword ptr [wglMakeCurrent]
|
||||
push dword ptr [hDC]
|
||||
call dword ptr [SwapBuffers]
|
||||
|
||||
mov ebx, offset shaders
|
||||
mov eax, offset ShaderSources
|
||||
mov fsh, eax
|
||||
call dword ptr [compileShader]
|
||||
call dword ptr [compileShader]
|
||||
call dword ptr [compileShader]
|
||||
call dword ptr [compileShader]
|
||||
|
||||
call dword ptr [CreateThread]
|
||||
call dword ptr [Sleep]
|
||||
call dword ptr [waveOutOpen]
|
||||
|
||||
push 20h
|
||||
push offset WaveHDR
|
||||
push dword ptr [hWaveOut]
|
||||
push 20h
|
||||
push offset WaveHDR
|
||||
push dword ptr [hWaveOut]
|
||||
call dword ptr [waveOutPrepareHeader]
|
||||
call dword ptr [waveOutWrite]
|
||||
|
||||
schleife:
|
||||
|
||||
push 12
|
||||
push offset MMTime
|
||||
push hWaveOut
|
||||
call dword ptr [waveOutGetPosition]
|
||||
|
||||
xor edx, edx
|
||||
mov eax, dword ptr [MMTime+4]
|
||||
div g_MagicConstant
|
||||
push dword ptr shaders[eax * 4]
|
||||
shr eax, 2
|
||||
test ax,ax
|
||||
jne exit
|
||||
push dword ptr [glUseProgram]
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
|
||||
fild dword ptr [MMTime+4]
|
||||
|
||||
sub esp, 0Ch
|
||||
fdiv dword ptr [magicFloat]
|
||||
fstp dword ptr [esp]
|
||||
call dword ptr [glColor3f]
|
||||
|
||||
push dword ptr [hDC]
|
||||
push 1
|
||||
push esi
|
||||
push esi
|
||||
push esi
|
||||
push esi
|
||||
push 1
|
||||
push 1
|
||||
push -1
|
||||
push -1
|
||||
call dword ptr [glRects]
|
||||
call dword ptr [PeekMessageA]
|
||||
call dword ptr [SwapBuffers]
|
||||
|
||||
push VK_ESCAPE
|
||||
call dword ptr [GetAsyncKeyState]
|
||||
test ax,ax
|
||||
jne exit
|
||||
|
||||
jmp schleife
|
||||
|
||||
exit:
|
||||
call dword ptr [ExitProcess]
|
||||
|
||||
compileShader:
|
||||
push GL_FRAGMENT_SHADER
|
||||
push glCreateShader
|
||||
push GL_VERTEX_SHADER
|
||||
push glCreateShader
|
||||
push glCreateProgram
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
mov p, eax
|
||||
mov dword ptr[ebx], eax
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
mov v, eax
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
mov f, eax
|
||||
|
||||
push p
|
||||
push glLinkProgram
|
||||
|
||||
push f
|
||||
push p
|
||||
push glAttachShader
|
||||
|
||||
push v
|
||||
push p
|
||||
push glAttachShader
|
||||
|
||||
push f
|
||||
push glCompileShader
|
||||
|
||||
push v
|
||||
push glCompileShader
|
||||
|
||||
push esi
|
||||
push fsh
|
||||
push 7
|
||||
push f
|
||||
push glShaderSource
|
||||
|
||||
push esi
|
||||
push offset vsh
|
||||
push 1
|
||||
push v
|
||||
push glShaderSource
|
||||
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
call dword ptr [wglGetProcAddress]
|
||||
call eax
|
||||
|
||||
add ebx, 4
|
||||
add dword ptr [fsh], 28
|
||||
ret
|
||||
}
|
||||
}
|
||||
#endif
|
||||
645
ev12-4k/main.cpp
Normal file
645
ev12-4k/main.cpp
Normal file
@@ -0,0 +1,645 @@
|
||||
//#define NOMUSICTIMING
|
||||
#define MULTISHADER
|
||||
#define LOCALMUSIC
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
#include <stdio.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"
|
||||
#ifdef LOCALMUSIC
|
||||
|
||||
#include "mmsystem.h"
|
||||
#include "mmreg.h"
|
||||
#include "4klang.h"
|
||||
|
||||
#define USE_SOUND_THREAD
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// sound
|
||||
////////////////////////////////////////////////
|
||||
#define SAMPLE_RATE 44100
|
||||
#define MAX_SAMPLES SAMPLE_RATE*2*60*4
|
||||
|
||||
#pragma bss_seg(".synthnothing")
|
||||
static float lpSoundBuffer[MAX_SAMPLES];
|
||||
static HWAVEOUT hWaveOut;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// initialized data
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
#ifdef USE_SOUND_THREAD
|
||||
#pragma code_seg(".sndthrd")
|
||||
DWORD WINAPI SoundThread( LPVOID lpParam )
|
||||
{
|
||||
_4klang_render(lpSoundBuffer);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include "synth.h"
|
||||
#endif
|
||||
|
||||
#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 800
|
||||
#endif
|
||||
|
||||
#ifndef SCREENHEIGHT
|
||||
#define SCREENHEIGHT 600
|
||||
#endif
|
||||
|
||||
//#define WINDOWED
|
||||
|
||||
#pragma data_seg(".Shader0")
|
||||
#include "mark_small.h"
|
||||
|
||||
#define STR2(x) #x
|
||||
#define STR(x) STR2(x)
|
||||
|
||||
#pragma data_seg(".vertexshader")
|
||||
//static char* vsh = "out vec4 Y;out 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 vec2 "I_Y","I_Z";void main(){"I_Y"=gl_Color.xy;"I_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 = SCREENHEIGHT ;
|
||||
#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.fs";
|
||||
#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")
|
||||
__forceinline 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;
|
||||
}
|
||||
|
||||
__forceinline unsigned int compileShaderMultiple(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, 7, 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);
|
||||
OutputDebugString("Shader loaded.\n");
|
||||
}
|
||||
_findclose(hfile);
|
||||
}
|
||||
::Sleep(100);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#include <cmath>
|
||||
|
||||
float g_DebugCamPos[ 3 ]= {0,2.0f,-48.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= 12.0f;
|
||||
|
||||
bool g_bForceCompile= true;
|
||||
|
||||
void MoveCam( float& fCurTime )
|
||||
{
|
||||
float fSpeed= 0.125f*3.0f;
|
||||
|
||||
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 ]= -48.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
|
||||
|
||||
#pragma data_seg(".main_glob")
|
||||
//int gCurScene= 0;
|
||||
|
||||
const int g_SceneLength= 16;
|
||||
|
||||
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 LOCALMUSIC
|
||||
#ifdef USE_SOUND_THREAD
|
||||
CreateThread(0, 0, SoundThread, 0, 0, 0);
|
||||
#else
|
||||
_4klang_render(lpSoundBuffer);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MULTISHADER
|
||||
unsigned int shaders[4];
|
||||
|
||||
/*shaders[0]=compileShader(vsh, mark_fs_0 );
|
||||
mark_fs_0[6]++;
|
||||
shaders[1]=compileShader(vsh, mark_fs_0 );
|
||||
mark_fs_0[6]++;
|
||||
shaders[2]=compileShader(vsh, mark_fs_0 );
|
||||
mark_fs_0[6]++;
|
||||
shaders[3]=compileShader(vsh, mark_fs_0 );*/
|
||||
|
||||
|
||||
shaders[0]=compileShaderMultiple(vsh, ShaderSource1 );
|
||||
shaders[1]=compileShaderMultiple(vsh, ShaderSource2 );
|
||||
shaders[2]=compileShaderMultiple(vsh, ShaderSource3 );
|
||||
shaders[3]=compileShaderMultiple(vsh, ShaderSource4 );
|
||||
|
||||
|
||||
#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
|
||||
|
||||
SwapBuffers(hDC);
|
||||
Sleep(13000);
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifdef LOCALMUSIC
|
||||
waveOutOpen ( &hWaveOut, WAVE_MAPPER, &WaveFMT, NULL, 0, CALLBACK_NULL );
|
||||
waveOutPrepareHeader( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
|
||||
waveOutWrite ( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
|
||||
#else
|
||||
InitSound();
|
||||
#endif
|
||||
#else
|
||||
LARGE_INTEGER li_OldTime = { 0 };
|
||||
#endif
|
||||
#ifdef NOMUSICTIMING
|
||||
int iStartTick= timeGetTime();
|
||||
#endif
|
||||
|
||||
int Sample;
|
||||
#ifdef _DEBUG
|
||||
float lf_Time= 0.0f;
|
||||
#endif
|
||||
do
|
||||
{
|
||||
SwapBuffers(hDC);
|
||||
#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
|
||||
|
||||
#ifndef LOCALMUSIC
|
||||
int Sample= get_Sample() - gCurSceneStart;
|
||||
const int SceneEnd= g_SceneLength * (44100 * 60 / float(BPM));//samples per tick
|
||||
#endif
|
||||
|
||||
//lf_Time = get_Time() * 71.0f / 240.0f;
|
||||
#ifdef NOMUSICTIMING
|
||||
lf_Time = ( timeGetTime() - iStartTick ) * 0.001f / 16.0f;
|
||||
#endif
|
||||
|
||||
glLoadIdentity();
|
||||
|
||||
#ifdef _DEBUG
|
||||
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 * 135.0f / 60.0f / g_fSpeedFac;
|
||||
if( lf_Time > 1.0f )
|
||||
{
|
||||
lf_Time= 0.0f;
|
||||
if( g_ShaderID == 1 )
|
||||
{
|
||||
g_SceneID= (g_SceneID+1)%16;
|
||||
}
|
||||
}
|
||||
float fValue= g_SceneID + lf_Time;
|
||||
glColor3f(fValue, fValue, fValue);
|
||||
#else
|
||||
#ifdef LOCALMUSIC
|
||||
waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME));
|
||||
Sample= MMTime.u.sample;
|
||||
float lf_Time= (float)(Sample)/(float)313600;
|
||||
#else
|
||||
lf_Time= (float)Sample / (float)SceneEnd;
|
||||
#endif
|
||||
|
||||
#ifdef MULTISHADER
|
||||
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(shaders[ Sample/(4*313600) ]);
|
||||
#endif
|
||||
|
||||
glColor3f(lf_Time, lf_Time, lf_Time);
|
||||
#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
|
||||
|
||||
glRects(-1, -1, 1, 1);
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifdef LOCALMUSIC
|
||||
#else
|
||||
if( Sample > SceneEnd )
|
||||
{
|
||||
gCurSceneStart+= SceneEnd;
|
||||
gCurScene++;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
while ( !GetAsyncKeyState(VK_ESCAPE) );
|
||||
#else
|
||||
while ( Sample < (313600*16) && !GetAsyncKeyState(VK_ESCAPE) );
|
||||
#endif
|
||||
ExitProcess(0);
|
||||
}
|
||||
698
ev12-4k/mark.fs
Normal file
698
ev12-4k/mark.fs
Normal file
@@ -0,0 +1,698 @@
|
||||
int w= 1;
|
||||
|
||||
@D
|
||||
//#version 420
|
||||
@@
|
||||
|
||||
// Parameters from our host
|
||||
// x: Scene
|
||||
// y: Zeit
|
||||
// z: Quadratzeit mit Faktor
|
||||
// w: Aspect ratio
|
||||
in vec2 Y,Z;
|
||||
|
||||
// All data of our world
|
||||
float L, cFac, CurTime, CurStep, pi= acos(-1.0);
|
||||
vec2 CurNormal;
|
||||
varying out vec3 cRes;
|
||||
vec3 CurColor,p,FogColor= vec3( 0.9, 0.9, 1.0 );
|
||||
|
||||
vec2 rotate(vec2 v,float y)
|
||||
{
|
||||
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
|
||||
}
|
||||
|
||||
//repeat around y axis w times
|
||||
//void rp(inout vec3 p, float trans, float w)
|
||||
float repeatr(inout vec2 v,float x, float y)
|
||||
{
|
||||
float a= atan(v.y,v.x);
|
||||
float z=mod(a,y)-y*.5;
|
||||
v=(length(v))*vec2(cos(z),sin(z));
|
||||
v.x-=x;
|
||||
return z-a;
|
||||
}
|
||||
|
||||
void repeat( inout float w, float y )
|
||||
{
|
||||
w= mod( w - y*.5, y ) - y*.5;
|
||||
}
|
||||
|
||||
void repeate( inout float w, float y, float z )
|
||||
{
|
||||
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
|
||||
}
|
||||
|
||||
float row( float w, float y)
|
||||
{
|
||||
return floor( ( w - y*.5 )/ y );
|
||||
}
|
||||
|
||||
//radius of the torus/ radius of the ring
|
||||
float torus(vec3 p,float f)
|
||||
{
|
||||
return length(vec2(length(p.xz) - f,p.y));
|
||||
}
|
||||
|
||||
/*float signedDistToBox( vec3 p, vec3 b )
|
||||
{
|
||||
vec3 di = abs(p) - b;
|
||||
float mc = maxcomp(di);
|
||||
return mc<0.0 ? mc : length(max(di,0.0));
|
||||
}*/
|
||||
|
||||
/*float CBox( in vec3 p, in vec3 box, float rad )
|
||||
{
|
||||
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
|
||||
}*/
|
||||
|
||||
/*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);
|
||||
}
|
||||
|
||||
float plasm(float x, float a, float b,float c)
|
||||
{
|
||||
return sin(x+a+c*sin(x+b));
|
||||
}
|
||||
|
||||
/*float base(vec3 z)
|
||||
{
|
||||
vec3 y=z;
|
||||
y.y+=0.8+sin(CurTime);
|
||||
return min(
|
||||
(y.y < 0.0 ? length(y):length(y.xz))-0.6,
|
||||
max(
|
||||
-length(z.xz)+0.8,
|
||||
min(
|
||||
-z.y,
|
||||
max(
|
||||
length(z.xz)-1.0,
|
||||
-0.2-z.y))));
|
||||
}*/
|
||||
|
||||
float f0(vec3 p)
|
||||
{
|
||||
return 250.0;
|
||||
}
|
||||
float f1(vec3 p)
|
||||
{
|
||||
float d= 999.0;
|
||||
float a= atan(p.x,p.z)+CurTime;
|
||||
p.x= length(p.xz) - 94.0;
|
||||
for( float b= 0.0; b < 3.0; b++ )
|
||||
{
|
||||
vec3 o=p;
|
||||
o.x+= 5.0*sin( (a+b*2.0*pi)*16.0/3.0 );
|
||||
o.y+= 5.0*sin( (a+b*2.0*pi)*8.0/3.0 );
|
||||
d= min( d, length(o.xy) - 2.0 );
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
float f2(vec3 p)
|
||||
{
|
||||
repeatr( p.zx, 96.0, pi/90.0);
|
||||
repeatr( p.yz, 11.0, pi/9.0);
|
||||
return max(
|
||||
-length(p.xz)+0.8,
|
||||
min(
|
||||
-p.y,
|
||||
max(
|
||||
length(p.xz)-1.0,
|
||||
-0.2-p.y)));
|
||||
|
||||
}
|
||||
|
||||
float f3(vec3 p)
|
||||
{
|
||||
float b= repeatr( p.zx, 96.0, pi/90.0);
|
||||
float a= repeatr( p.yz, 11.0, pi/9.0);
|
||||
p.y+= 0.5*plasm( 2.0*CurTime*pi,
|
||||
b,
|
||||
a,
|
||||
1.3);
|
||||
return (p.y < 0.0 ? length(p):length(p.xz))-0.6;
|
||||
}
|
||||
|
||||
float f4(vec3 p)
|
||||
{
|
||||
float s= plasm(
|
||||
0.2*p.y,
|
||||
row(p.x, 8.0),
|
||||
row(p.z, 8.0),
|
||||
1.0);
|
||||
repeat(p.x, 8.0 );
|
||||
repeat(p.z, 8.0 );
|
||||
|
||||
|
||||
vec2 y= abs(abs(rotate(p.xz,s)) - 0.4);
|
||||
repeat(p.y,0.5);
|
||||
return max( max(y.x,y.y)-0.3, 0.1 - max( abs(p.y),min(y.x,y.y)));
|
||||
}
|
||||
|
||||
float f5(vec3 p)
|
||||
{
|
||||
float s= plasm(
|
||||
2.0*CurTime*pi,
|
||||
row(p.x, 8.0),
|
||||
row(p.z, 8.0),
|
||||
1.0);
|
||||
repeate(p.x, 8.0, 16.0 );
|
||||
repeate(p.z, 8.0, 48.0 );
|
||||
vec3 o= p;
|
||||
p.y-=s;
|
||||
repeat(p.y, 12.0 );
|
||||
|
||||
p.y= abs(p.y) - 4.0;
|
||||
repeat(o.y, 5.0);
|
||||
return min(torus(p, 2.0)-0.5, max( length( o ) - 1.5, abs( o.y ) - 0.5 ));
|
||||
|
||||
}
|
||||
|
||||
float f6(vec3 p)
|
||||
{
|
||||
float s= plasm(
|
||||
2.0*CurTime*pi,
|
||||
row(p.x, 8.0),
|
||||
row(p.z, 8.0),
|
||||
1.0);
|
||||
repeate(p.x, 8.0, 16.0 );
|
||||
repeate(p.z, 8.0, 48.0 );
|
||||
vec3 o= p;
|
||||
p.y-=s;
|
||||
repeat(p.y, 12.0 );
|
||||
|
||||
float f= max( abs(p.y)-4.0, abs(2.0-length(p.xz))-0.25);
|
||||
repeat( p.y, 1.0 );
|
||||
return max( f,-abs(p.y) + 0.4 );
|
||||
}
|
||||
|
||||
float f7(vec3 p )
|
||||
{
|
||||
return 18.0 + p.y;
|
||||
}
|
||||
|
||||
float f8(vec3 p)
|
||||
{
|
||||
repeatr( p.zx, 8.0, pi/8.0);
|
||||
repeat(p.y, 7.0 );
|
||||
float s= length( p ) - 9.0;
|
||||
repeate(p.y, 2.2, 2.2 );
|
||||
p.x= abs( p.x ) - 2.0;
|
||||
return max( s,(p.x > 0.0 ? length(p.xy):abs(p.y))-1.0 );
|
||||
}
|
||||
|
||||
float f9(vec3 p)
|
||||
{
|
||||
repeatr( p.zx, 8.0, pi/8.0);
|
||||
return p.z-8.0;
|
||||
}
|
||||
|
||||
float f10(vec3 p)
|
||||
{
|
||||
p.x= abs( p.x );
|
||||
repeat( p.z, 6.0 );
|
||||
float s= min( 28.5 - p.x, max( 24.0 - p.x, abs(p.z) - 2.0 ));
|
||||
p.yz= rotate( p.yz, pi/4.0);
|
||||
repeat( p.x, 3.0 );
|
||||
repeat( p.y, 3.0 );
|
||||
repeat( p.z, 3.0 );
|
||||
return max( s, 1.0 - length( p ) );
|
||||
}
|
||||
|
||||
float f11(vec3 p)
|
||||
{
|
||||
p.x+= 29.0;
|
||||
//p.x+= 32.0 * (CurTime+1.0)*(cos(4.0*row(p.y, 20.0)));
|
||||
p.xz= rotate( p.xz, (CurTime+1.0)*(cos(4.0*row(p.y, 20.0))));
|
||||
repeat( p.y, 20.0 );
|
||||
repeatr( p.xz, .0, pi/5.0);
|
||||
|
||||
return max( length( length( p.xz )-51.0)-0.25, max( length(p.y)-5.0, length(p.z)-10.0 ));
|
||||
|
||||
/*p.x+= 20.0;
|
||||
//p.x+= 32.0 * (CurTime+1.0)*(cos(4.0*row(p.y, 20.0)));
|
||||
p.xz= rotate( p.xz, (CurTime+1.0)*(cos(4.0*row(p.y, 20.0))));
|
||||
repeat( p.y, 20.0 );
|
||||
repeatr( p.xz, 40.0, pi/5.0);
|
||||
vec3 v= abs(p)-vec3(0.25,5.0,10.0);
|
||||
return max( v.x, max( v.y, v.z ));*/
|
||||
|
||||
|
||||
/*p.z+= 32.0 * (CurTime+1.0)*(cos(4.0*row(p.y, 20.0)));
|
||||
repeat( p.y, 20.0 );
|
||||
repeat( p.z, 28.0 );
|
||||
p.x-=21.0;
|
||||
vec3 v= abs(p)-vec3(0.25,5.0,10.0);
|
||||
return max( v.z, max( v.y, v.x ));*/
|
||||
// repeate( p.x, 4.0, 8.0 );
|
||||
// return min( torus(p.xzy, 1.5) - 0.4, max( v.x, max( v.y, v.z )));
|
||||
}
|
||||
|
||||
float f12(vec3 p)
|
||||
{
|
||||
float l= sin( 999.0*repeatr( p.xz, 61.0, pi/32.0) );
|
||||
p.y+=64.0*l*CurTime;
|
||||
l= l + 2.0;
|
||||
repeat( p.y, l*2.0+5.0);
|
||||
l= max( length(p.x)-0.5 ,max(length(p.y)-l, length(p.z )-1.0 ) );
|
||||
|
||||
p.yz= rotate( p.yz, pi/4.0);
|
||||
p.x+= 0.5;
|
||||
repeat( p.y, 0.5 );
|
||||
repeat( p.z, 0.5 );
|
||||
return max( l, 0.2 - length( p ) );
|
||||
|
||||
//return 36.0 - length( length( p.xz ) - 40.0 );
|
||||
}
|
||||
|
||||
float f13(vec3 p)
|
||||
{
|
||||
float l= sin( (999.0* repeatr( p.xz, 64.0, pi/22.0)) );
|
||||
p.y+=32.0*l*CurTime;
|
||||
l= l + 6.0;
|
||||
repeat( p.y, l*2.0+1.0);
|
||||
l= max( -p.x ,max(length(p.y)-l, length(p.z )-4.0 ) );
|
||||
|
||||
p.yz= rotate( p.yz, pi/4.0);
|
||||
repeat( p.y, 3.0 );
|
||||
repeat( p.z, 3.0 );
|
||||
return min( 5.0-p.x, max( l, 1.0 - length( p ) ) );
|
||||
}
|
||||
|
||||
float f14(vec3 p)
|
||||
{
|
||||
p.y-= CurTime * 260.0;
|
||||
p.xz= rotate( p.xz, CurTime*2.0);
|
||||
repeatr( p.zx, 39.0, pi/6.0);
|
||||
repeat( p.y, 260.0 );
|
||||
p.yz= rotate( p.yz, 0.5);
|
||||
return max( max(length(p.y)- 36.0, length(p.x )-5.0 ), p.z);
|
||||
}
|
||||
|
||||
float f15(vec3 p)
|
||||
{
|
||||
p.y-= CurTime * 260.0;
|
||||
p.xz= rotate( p.xz, CurTime*2.0);
|
||||
repeatr( p.zx, 40.0, pi/6.0);
|
||||
repeat( p.y, 260.0 );
|
||||
p.yz= rotate( p.yz, 0.5);
|
||||
return max( max(length(p.y)- 35.0, length(p.x )-4.0 ), p.z);
|
||||
|
||||
}
|
||||
|
||||
float f(vec3 p)
|
||||
{
|
||||
if( w == 1 )
|
||||
return min( min( f1(p), f2(p) ), f3(p) );
|
||||
else if ( w == 2 )
|
||||
return min(min(min(f4(p),f5(p)),f6(p)),f7(p));
|
||||
else if ( w == 3 )
|
||||
return min(min(min(f8(p),f9(p)),f10(p)),f11(p));
|
||||
else if ( w == 0 )
|
||||
return min(min(min(f12(p),f13(p)),f14(p)),f15(p));
|
||||
}
|
||||
|
||||
|
||||
void ToRes(vec3 Color, float Factor)
|
||||
{
|
||||
cRes+= Color * cFac;
|
||||
cFac*= Factor;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
CurTime= fract(Y.x);
|
||||
int CurScene= int(Y.x), m=2;
|
||||
// Get the look direction for the current pixel (always look forwards)
|
||||
vec3 rayDir = vec3((Z.xy - 0.5), 0.8);
|
||||
|
||||
if(CurScene--==0)
|
||||
{
|
||||
p= vec3(2.0, 220.0*CurTime, 58.0);
|
||||
rayDir.yz= rotate( rayDir.yz, -1.0-CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3(0.0, 130.0*CurTime-90.0, 10.0);
|
||||
rayDir.yz= rotate( rayDir.yz, 1.0*CurTime );
|
||||
rayDir.xz= rotate( rayDir.xz, 2.0*CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3(0.0, 400.0*CurTime-30.0, -58.0);
|
||||
rayDir.yz= rotate( rayDir.yz, 1.0 );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3(0.0, 20.0, -62.0);
|
||||
rayDir.yz= rotate( rayDir.yz, -1.2*CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( 0.0, -8.0, 90.0);
|
||||
rayDir.yz= rotate( rayDir.yz, -2.0*CurTime );
|
||||
rayDir.xz= rotate( rayDir.xz, 3.6 );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( 90.0, -8.0, 0.0);
|
||||
rayDir.xz= rotate( rayDir.xz, -CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( 105.0, 0.0, 0.0);
|
||||
rayDir.xz= rotate( rayDir.xz, CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( 0.0, 0.0, 105.0);
|
||||
rayDir.xz= rotate( rayDir.xz, 3.6+CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( 6.0, 5.0, 12.0 *CurTime);
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( 4.0, -16.0, -6.0 - CurTime * 22.0);
|
||||
rayDir.xz= rotate( rayDir.xz, 1.0 );
|
||||
rayDir.yz= rotate( rayDir.yz, -0.3 );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( 3.0, -15.0+40.0*CurTime, 17.0 );
|
||||
rayDir.yz= rotate( rayDir.yz, 1.0-CurTime );
|
||||
rayDir.xz= rotate( rayDir.xz, 2.0+CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( -2.0, 7.0, 20.0);
|
||||
rayDir.xz= rotate( rayDir.xz, 2.2+CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( 19.0, 140.0*CurTime-120.0, 0.0 );
|
||||
rayDir.yz= rotate( rayDir.yz, -1.5 );
|
||||
rayDir.xz= rotate( rayDir.xz, 1.0+1.0*CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3( -20.0, 20.0, -30.0 );
|
||||
rayDir.yz= rotate( rayDir.yz, -0.5 );
|
||||
rayDir.xz= rotate( rayDir.xz, -0.5-0.5*CurTime );
|
||||
}
|
||||
else if(CurScene--==0)
|
||||
{
|
||||
p= vec3(5.0, 15.0*CurTime+70.0, -30.0);
|
||||
rayDir.yz= rotate( rayDir.yz, 0.9 );
|
||||
}
|
||||
else
|
||||
{
|
||||
p= vec3(-12.0, 6.0, -55.0);
|
||||
rayDir.yz= rotate( rayDir.yz, -1.5*CurTime );
|
||||
}
|
||||
|
||||
@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), 0.7);
|
||||
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);
|
||||
|
||||
cRes= vec3( .0 );
|
||||
cFac=1.0;
|
||||
|
||||
//float t=smoothnoise( rayDir*666.0 )*0.1,y,z;
|
||||
float t=0.0,nextT=0.0;
|
||||
while (m--==0&&t<250.0)
|
||||
{
|
||||
t= nextT;
|
||||
nextT=0.5;
|
||||
//bis zu einer Oberflaeche steppen
|
||||
//for (CurStep=1.0;t<250.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep) )
|
||||
for (CurStep=1.0;t<250.0 && CurStep>t*.002;t+=CurStep )
|
||||
{
|
||||
CurStep = f(p+rayDir*t);
|
||||
}
|
||||
|
||||
//Startpunkt und Richtung fuer reflektierten Strahl;
|
||||
p+= rayDir*t;
|
||||
|
||||
CurNormal = vec2(0.1, 0.0);
|
||||
vec3 n= vec3(
|
||||
f(p + CurNormal.xyy) - f(p - CurNormal.xyy),
|
||||
f(p + CurNormal.yxy) - f(p - CurNormal.yxy),
|
||||
f(p + CurNormal.yyx) - f(p - CurNormal.yyx) );
|
||||
n= normalize(n);
|
||||
|
||||
//CurStep ab hier == Reflektion !!!
|
||||
|
||||
//////////////////////////////////////
|
||||
///material Anfang
|
||||
|
||||
CurColor = vec3(.1);
|
||||
CurStep= .8;
|
||||
CurNormal.y= 0.5;
|
||||
|
||||
if( w == 1 )
|
||||
{
|
||||
L= f1(p);
|
||||
CurColor = vec3(0.0,0.6,0.7 );
|
||||
CurStep= 0.4;
|
||||
|
||||
if( L > f0(p) )
|
||||
{
|
||||
L= f0(p);
|
||||
CurColor = vec3(0.6,0.9,1.25 );
|
||||
CurStep= .1;
|
||||
nextT=250.0;
|
||||
}
|
||||
if( L > f3(p) )
|
||||
{
|
||||
L= f3(p);
|
||||
CurColor = vec3(1.0,0.5,0.0 );
|
||||
CurStep= 0.1;
|
||||
nextT=250.0;
|
||||
}
|
||||
|
||||
if( L > f2(p) )
|
||||
{
|
||||
L= f2(p);
|
||||
|
||||
CurColor = vec3(1.0);
|
||||
CurStep= .0;
|
||||
nextT=250.0;
|
||||
}
|
||||
}
|
||||
else if( w == 2 )
|
||||
{
|
||||
CurNormal.y= 1.5;
|
||||
L= f5(p);
|
||||
|
||||
if( L > f4(p) )
|
||||
{
|
||||
L= f4(p);
|
||||
CurColor = vec3(0.6,0.9,1.25 );
|
||||
CurStep= .1;
|
||||
nextT=250.0;
|
||||
}
|
||||
|
||||
if( L > f6(p) )
|
||||
{
|
||||
L= f6(p);
|
||||
CurColor = vec3(1.0,0.5,0.0 );
|
||||
CurStep= 0.1;
|
||||
nextT=250.0;
|
||||
}
|
||||
|
||||
if( L > f7(p) )
|
||||
{
|
||||
L= f7(p);
|
||||
|
||||
CurColor = vec3(1.0);
|
||||
CurStep= .0;
|
||||
nextT=250.0;
|
||||
}
|
||||
}
|
||||
else if( w == 3 )
|
||||
{
|
||||
L= f8(p);
|
||||
|
||||
|
||||
if( L > f9(p) )
|
||||
{
|
||||
L= f9(p);
|
||||
CurColor = vec3(0.6,0.9,1.25 );//*0.8;
|
||||
CurStep= .0;
|
||||
nextT=250.0;
|
||||
}
|
||||
|
||||
if( L > f11(p) )
|
||||
{
|
||||
L= f11(p);
|
||||
CurColor = vec3(1.0,0.5,0.0 );
|
||||
CurStep= 0.1;
|
||||
nextT=250.0;
|
||||
}
|
||||
if( L > f10(p) )
|
||||
{
|
||||
L= f10(p);
|
||||
|
||||
CurColor = vec3(1.0);
|
||||
CurStep= .0;
|
||||
nextT=250.0;
|
||||
}
|
||||
}
|
||||
else if( w == 0 )
|
||||
{
|
||||
CurNormal.y= 0.02;
|
||||
L= f15(p);
|
||||
if( L > f14(p) )
|
||||
{
|
||||
L= f14(p);
|
||||
CurColor = vec3(0.6,0.9,1.25 );
|
||||
CurStep= .0;
|
||||
nextT=250.0;
|
||||
}
|
||||
if( L > f12(p) )
|
||||
{
|
||||
L= f12(p);
|
||||
CurColor = vec3(1.0,0.5,0.0 );
|
||||
CurStep= 0.1;
|
||||
nextT=250.0;
|
||||
}
|
||||
if( L > f13(p) )
|
||||
{
|
||||
L= f13(p);
|
||||
CurColor = vec3(1.0);
|
||||
CurStep= .0;
|
||||
nextT=250.0;
|
||||
}
|
||||
}
|
||||
|
||||
///material Ende
|
||||
//////////////////////////////////////
|
||||
|
||||
//n.x+= (smoothnoise( p * CurNormal.y ) + smoothnoise( p * CurNormal.y * 2.0 ) + smoothnoise( p * CurNormal.y * 4.0 )) * CurNormal.x;
|
||||
//n.y+= (smoothnoise( p * CurNormal.y ) + smoothnoise( p * CurNormal.y * 2.0 ) + smoothnoise( p * CurNormal.y * 4.0 )) * CurNormal.x;
|
||||
//n.z+= (smoothnoise( p * CurNormal.y ) + smoothnoise( p * CurNormal.y * 2.0 ) + smoothnoise( p * CurNormal.y * 4.0 )) * CurNormal.x;
|
||||
n+= (smoothnoise( p * CurNormal.y ) + smoothnoise( p * CurNormal.y * 2.0 ) + smoothnoise( p * CurNormal.y * 4.0 )) * CurNormal.x;
|
||||
n= normalize(n);
|
||||
|
||||
|
||||
float Ambient= 0.3;
|
||||
for( int i= 0; i < 4; ++i )
|
||||
{
|
||||
vec3 LightPos;
|
||||
|
||||
if( w == 1 )
|
||||
{
|
||||
LightPos= vec3(0.0,4.3,102.3);
|
||||
LightPos.xz= rotate( LightPos.xz, i*0.2-2.0*CurTime );
|
||||
}
|
||||
else if( w == 2 )
|
||||
{
|
||||
LightPos= vec3(0.0,10.0*sin( i+2.0*CurTime),12.0);
|
||||
LightPos.xz= rotate( LightPos.xz, i*3.0 );
|
||||
}
|
||||
else if( w == 3 )
|
||||
{
|
||||
LightPos= vec3(0.0,250.0*CurTime-i*50.0,20.0);
|
||||
LightPos.xz= rotate( LightPos.xz, cos(i)*20.0*CurTime );
|
||||
}
|
||||
else if( w == 0 )
|
||||
{
|
||||
LightPos= vec3(0.0,200.0*sin( i+2.0*CurTime),58.0);
|
||||
LightPos.xz= rotate( LightPos.xz, cos(i)*20.0*CurTime );
|
||||
}
|
||||
|
||||
vec3 LightDist= p-clamp(dot(p-LightPos,rayDir)/t,0.0,1.0)*rayDir*t;
|
||||
|
||||
L= smoothstep(2.0, 0.0, length(LightDist-LightPos));
|
||||
ToRes(vec3(3.0, 2.5, 2.0)*L,1.0-L);
|
||||
|
||||
LightPos-=p;
|
||||
Ambient+= 0.4 * ( dot(normalize(LightPos),n))*smoothstep(80.0, 0.0, length(LightPos));
|
||||
}
|
||||
L= smoothstep( 0.0,220.0*smoothstep(0.0,0.5,Y.x), t );
|
||||
ToRes(FogColor*L,1.0-L);
|
||||
|
||||
rayDir= reflect( rayDir, n );
|
||||
|
||||
CurColor*= Ambient;
|
||||
Ambient= 1.0;
|
||||
for (L= 6.0;L>0.;L--)
|
||||
{
|
||||
Ambient-=(L*.5-f(p+n*L*.5))/exp2(L);
|
||||
}
|
||||
CurColor*= Ambient;
|
||||
ToRes(CurColor,CurStep);
|
||||
}
|
||||
cRes*=smoothstep(16.0,15.65,Y.x);
|
||||
|
||||
//gl_FragColor.xyz = cRes;// + cFac*FogColor;
|
||||
|
||||
|
||||
// z= 0.85;
|
||||
|
||||
// rayDir.yz= rotate( rayDir.yz, 0.6 );
|
||||
// z+= rayDir.y * 0.2;
|
||||
|
||||
// if( rayDir.y > 0.0 )
|
||||
// {
|
||||
// repeatr(rayDir.xz, 0.4, pi/8.0);
|
||||
// rayDir.x= abs( rayDir.x ) - .2;
|
||||
// z+= pow( smoothstep(.2, .0, mix( abs(rayDir.z),length(rayDir.xz), step(0.0, rayDir.x) ) ), 22.0 );
|
||||
// }
|
||||
// gl_FragColor.xyz = cRes + cFac*z;
|
||||
}
|
||||
469
ev12-4k/mark_small.h
Normal file
469
ev12-4k/mark_small.h
Normal file
@@ -0,0 +1,469 @@
|
||||
/* File generated with Shader Minifier 1.1.1
|
||||
* http://www.ctrl-alt-test.fr
|
||||
*/
|
||||
#ifndef MARK_SMALL_H_
|
||||
# define MARK_SMALL_H_
|
||||
# define I_Y "m"
|
||||
# define I_Z "v"
|
||||
# define V_CRES "e"
|
||||
|
||||
#pragma data_seg(".shader0")
|
||||
char mark_fs[]= ""
|
||||
"in vec2 m,v;"
|
||||
"float y,x,l,f,s=acos(-1.);"
|
||||
"vec2 i;"
|
||||
"varying out vec3 e;"
|
||||
"vec3 r,a,c=vec3(.9,.9,1.);"
|
||||
"vec2 n(vec2 l,float a)"
|
||||
"{"
|
||||
"return cos(a)*l+sin(a)*vec2(-l.y,l.x);"
|
||||
"}"
|
||||
"float n(inout vec2 z,float v,float l)"
|
||||
"{"
|
||||
"float y=atan(z.y,z.x),a=mod(y,l)-l*.5;"
|
||||
"z=length(z)*vec2(cos(a),sin(a));"
|
||||
"z.x-=v;"
|
||||
"return a-y;"
|
||||
"}"
|
||||
"void h(inout float z,float l)"
|
||||
"{"
|
||||
"z=mod(z-l*.5,l)-l*.5;"
|
||||
"}"
|
||||
"void h(inout float z,float l,float y)"
|
||||
"{"
|
||||
"z=max(abs(z)-y,mod(z-l*.5,l)-l*.5);"
|
||||
"}"
|
||||
"float t(float z,float l)"
|
||||
"{"
|
||||
"return floor((z-l*.5)/l);"
|
||||
"}"
|
||||
"float p(vec3 z,float y)"
|
||||
"{"
|
||||
"return length(vec2(length(z.xz)-y,z.y));"
|
||||
"}"
|
||||
"float h(vec3 a)"
|
||||
"{"
|
||||
"return fract(sin(a.x*151.+a.y*33.+a.z)*11.);"
|
||||
"}"
|
||||
"float n(vec3 a)"
|
||||
"{"
|
||||
"vec2 z=vec2(1.,0.);"
|
||||
"vec3 i=smoothstep(0.,1.,fract(a));"
|
||||
"a=floor(a);"
|
||||
"vec4 m=mix(vec4(h(a+z.yyy),h(a+z.xyy),h(a+z.yxy),h(a+z.xxy)),vec4(h(a+z.yyx),h(a+z.xyx),h(a+z.yxx),h(a+z.xxx)),i.z);"
|
||||
"z=mix(m.xy,m.zw,i.y);"
|
||||
"return mix(z.x,z.y,i.x);"
|
||||
"}"
|
||||
"float h(float z,float y,float a,float l)"
|
||||
"{"
|
||||
"return sin(z+y+l*sin(z+a));"
|
||||
"}";
|
||||
|
||||
#pragma data_seg(".shader1")
|
||||
char mark_fs_func_1[]= ""
|
||||
"float p(vec3 a)"
|
||||
"{"
|
||||
"return 250.;"
|
||||
"}"
|
||||
"float t(vec3 a)"
|
||||
"{"
|
||||
"float z=999.,y=atan(a.x,a.z)+l;"
|
||||
"a.x=length(a.xz)-94.;"
|
||||
"for(float r=0.;r<3.;r++)"
|
||||
"{"
|
||||
"vec3 i=a;"
|
||||
"i.x+=5.*sin((y+r*2.*s)*16./3.);"
|
||||
"i.y+=5.*sin((y+r*2.*s)*8./3.);"
|
||||
"z=min(z,length(i.xy)-2.);"
|
||||
"}"
|
||||
"return z;"
|
||||
"}"
|
||||
"float d(vec3 a)"
|
||||
"{"
|
||||
"n(a.zx,96.,s/90.);"
|
||||
"n(a.yz,11.,s/9.);"
|
||||
"return max(-length(a.xz)+.8,min(-a.y,max(length(a.xz)-1.,-.2-a.y)));"
|
||||
"}"
|
||||
"float o(vec3 a)"
|
||||
"{"
|
||||
"float z=n(a.zx,96.,s/90.),y=n(a.yz,11.,s/9.);"
|
||||
"a.y+=.5*h(2.*l*s,z,y,1.3);"
|
||||
"return(a.y<0.?length(a):length(a.xz))-.6;"
|
||||
"}";
|
||||
|
||||
#pragma data_seg(".shader2")
|
||||
char mark_fs_func_2[]= ""
|
||||
"float p(vec3 a)"
|
||||
"{"
|
||||
"float z=h(.2*a.y,t(a.x,8.),t(a.z,8.),1.);"
|
||||
"h(a.x,8.);"
|
||||
"h(a.z,8.);"
|
||||
"vec2 i=abs(abs(n(a.xz,z))-.4);"
|
||||
"h(a.y,.5);"
|
||||
"return max(max(i.x,i.y)-.3,.1-max(abs(a.y),min(i.x,i.y)));"
|
||||
"}"
|
||||
"float t(vec3 a)"
|
||||
"{"
|
||||
"float z=h(2.*l*s,t(a.x,8.),t(a.z,8.),1.);"
|
||||
"h(a.x,8.,16.);"
|
||||
"h(a.z,8.,48.);"
|
||||
"vec3 y=a;"
|
||||
"a.y-=z;"
|
||||
"h(a.y,12.);"
|
||||
"a.y=abs(a.y)-4.;"
|
||||
"h(y.y,5.);"
|
||||
"return min(p(a,2.)-.5,max(length(y)-1.5,abs(y.y)-.5));"
|
||||
"}"
|
||||
"float o(vec3 a)"
|
||||
"{"
|
||||
"float z=h(2.*l*s,t(a.x,8.),t(a.z,8.),1.);"
|
||||
"h(a.x,8.,16.);"
|
||||
"h(a.z,8.,48.);"
|
||||
"vec3 y=a;"
|
||||
"a.y-=z;"
|
||||
"h(a.y,12.);"
|
||||
"float i=max(abs(a.y)-4.,abs(2.-length(a.xz))-.25);"
|
||||
"h(a.y,1.);"
|
||||
"return max(i,-abs(a.y)+.4);"
|
||||
"}"
|
||||
"float d(vec3 a)"
|
||||
"{"
|
||||
"return 18.+a.y;"
|
||||
"}";
|
||||
|
||||
#pragma data_seg(".shader3")
|
||||
char mark_fs_func_3[]= ""
|
||||
"float t(vec3 a)"
|
||||
"{"
|
||||
"n(a.zx,8.,s/8.);"
|
||||
"h(a.y,7.);"
|
||||
"float z=length(a)-9.;"
|
||||
"h(a.y,2.2,2.2);"
|
||||
"a.x=abs(a.x)-2.;"
|
||||
"return max(z,(a.x>0.?length(a.xy):abs(a.y))-1.);"
|
||||
"}"
|
||||
"float p(vec3 a)"
|
||||
"{"
|
||||
"n(a.zx,8.,s/8.);"
|
||||
"return a.z-8.;"
|
||||
"}"
|
||||
"float d(vec3 a)"
|
||||
"{"
|
||||
"a.x=abs(a.x);"
|
||||
"h(a.z,6.);"
|
||||
"float z=min(28.5-a.x,max(24.-a.x,abs(a.z)-2.));"
|
||||
"a.yz=n(a.yz,s/4.);"
|
||||
"h(a.x,3.);"
|
||||
"h(a.y,3.);"
|
||||
"h(a.z,3.);"
|
||||
"return max(z,1.-length(a));"
|
||||
"}"
|
||||
"float o(vec3 a)"
|
||||
"{"
|
||||
"a.x+=29.;"
|
||||
"a.xz=n(a.xz,(l+1.)*cos(4.*t(a.y,20.)));"
|
||||
"h(a.y,20.);"
|
||||
"n(a.xz,0.,s/5.);"
|
||||
"return max(length(length(a.xz)-51.)-.25,max(length(a.y)-5.,length(a.z)-10.));"
|
||||
"}";
|
||||
|
||||
#pragma data_seg(".shader4")
|
||||
char mark_fs_func_0[]= ""
|
||||
"float o(vec3 a)"
|
||||
"{"
|
||||
"float z=sin(999.*n(a.xz,61.,s/32.));"
|
||||
"a.y+=64.*z*l;"
|
||||
"z=z+2.;"
|
||||
"h(a.y,z*2.+5.);"
|
||||
"z=max(length(a.x)-.5,max(length(a.y)-z,length(a.z)-1.));"
|
||||
"a.yz=n(a.yz,s/4.);"
|
||||
"a.x+=.5;"
|
||||
"h(a.y,.5);"
|
||||
"h(a.z,.5);"
|
||||
"return max(z,.2-length(a));"
|
||||
"}"
|
||||
"float d(vec3 a)"
|
||||
"{"
|
||||
"float z=sin(999.*n(a.xz,64.,s/22.));"
|
||||
"a.y+=32.*z*l;"
|
||||
"z=z+6.;"
|
||||
"h(a.y,z*2.+1.);"
|
||||
"z=max(-a.x,max(length(a.y)-z,length(a.z)-4.));"
|
||||
"a.yz=n(a.yz,s/4.);"
|
||||
"h(a.y,3.);"
|
||||
"h(a.z,3.);"
|
||||
"return min(5.-a.x,max(z,1.-length(a)));"
|
||||
"}"
|
||||
"float p(vec3 a)"
|
||||
"{"
|
||||
"a.y-=l*260.;"
|
||||
"a.xz=n(a.xz,l*2.);"
|
||||
"n(a.zx,39.,s/6.);"
|
||||
"h(a.y,260.);"
|
||||
"a.yz=n(a.yz,.5);"
|
||||
"return max(max(length(a.y)-36.,length(a.x)-5.),a.z);"
|
||||
"}"
|
||||
"float t(vec3 a)"
|
||||
"{"
|
||||
"a.y-=l*260.;"
|
||||
"a.xz=n(a.xz,l*2.);"
|
||||
"n(a.zx,40.,s/6.);"
|
||||
"h(a.y,260.);"
|
||||
"a.yz=n(a.yz,.5);"
|
||||
"return max(max(length(a.y)-35.,length(a.x)-4.),a.z);"
|
||||
"}";
|
||||
|
||||
#pragma data_seg(".shader5")
|
||||
char mark_fs_main[]= ""
|
||||
"float R(vec3 a)"
|
||||
"{"
|
||||
"return min(min(min(p(a),t(a)),d(a)),o(a));"
|
||||
"}"
|
||||
"void R(vec3 z,float a)"
|
||||
"{"
|
||||
"e+=z*x;"
|
||||
"x*=a;"
|
||||
"}"
|
||||
"void main()"
|
||||
"{"
|
||||
"l=fract(m.x);"
|
||||
"int s=int(m.x),h=2;"
|
||||
"vec3 Q=vec3(v.xy-.5,.8);"
|
||||
"if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(2.,220.*l,58.);"
|
||||
"Q.yz=n(Q.yz,-1.-l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(0.,130.*l-90.,10.);"
|
||||
"Q.yz=n(Q.yz,l);"
|
||||
"Q.xz=n(Q.xz,2.*l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(0.,400.*l-30.,-58.);"
|
||||
"Q.yz=n(Q.yz,1.);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(0.,20.,-62.);"
|
||||
"Q.yz=n(Q.yz,-1.2*l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(0.,-8.,90.);"
|
||||
"Q.yz=n(Q.yz,-2.*l);"
|
||||
"Q.xz=n(Q.xz,3.6);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(90.,-8.,0.);"
|
||||
"Q.xz=n(Q.xz,-l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(105.,0.,0.);"
|
||||
"Q.xz=n(Q.xz,l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(0.,0.,105.);"
|
||||
"Q.xz=n(Q.xz,3.6+l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(6.,5.,12.*l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(4.,-16.,-6.-l*22.);"
|
||||
"Q.xz=n(Q.xz,1.);"
|
||||
"Q.yz=n(Q.yz,-.3);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(3.,-15.+40.*l,17.);"
|
||||
"Q.yz=n(Q.yz,1.-l);"
|
||||
"Q.xz=n(Q.xz,2.+l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(-2.,7.,20.);"
|
||||
"Q.xz=n(Q.xz,2.2+l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(19.,140.*l-120.,0.);"
|
||||
"Q.yz=n(Q.yz,-1.5);"
|
||||
"Q.xz=n(Q.xz,1.+l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(-20.,20.,-30.);"
|
||||
"Q.yz=n(Q.yz,-.5);"
|
||||
"Q.xz=n(Q.xz,-.5-.5*l);"
|
||||
"}"
|
||||
"else"
|
||||
" if(s--<=0)"
|
||||
"{"
|
||||
"a=vec3(5.,15.*l+70.,-30.);"
|
||||
"Q.yz=n(Q.yz,.9);"
|
||||
"}"
|
||||
"else"
|
||||
"{"
|
||||
"a=vec3(-12.,6.,-55.);"
|
||||
"Q.yz=n(Q.yz,-1.5*l);"
|
||||
"}"
|
||||
"Q=normalize(Q);"
|
||||
"e=vec3(0.);"
|
||||
"x=1.;"
|
||||
"float P=0.,O=0.;"
|
||||
"while(h-->0&&P<250.)"
|
||||
"{"
|
||||
"P=O;"
|
||||
"O=.5;"
|
||||
"for(f=1.;P<250.&&f>P*.002;P+=f)"
|
||||
"{"
|
||||
"f=R(a+Q*P);"
|
||||
"}"
|
||||
"a+=Q*P;"
|
||||
"i=vec2(.1,0.);"
|
||||
"vec3 N=vec3(R(a+i.xyy)-R(a-i.xyy),R(a+i.yxy)-R(a-i.yxy),R(a+i.yyx)-R(a-i.yyx));"
|
||||
"N=normalize(N);"
|
||||
"r=vec3(.5);"
|
||||
"f=.8;"
|
||||
"i.y=.5;";
|
||||
|
||||
#pragma data_seg(".shader6")
|
||||
char mark_fs_col_1[]= ""
|
||||
"r=vec3(0.,.6,.7);"
|
||||
"f=.4;";
|
||||
#pragma data_seg(".shader7")
|
||||
char mark_fs_col_2[]= ""
|
||||
"i.y=1.5;";
|
||||
#pragma data_seg(".shader8")
|
||||
char mark_fs_col_3[]= "";
|
||||
char mark_fs_col_0[]= ""
|
||||
"i.y=.02;";
|
||||
|
||||
#pragma data_seg(".shader9")
|
||||
char mark_fs_col_shared[]= ""
|
||||
"y=t(a);"
|
||||
"if(y>p(a))"
|
||||
"{"
|
||||
"y=p(a);"
|
||||
"r=vec3(.6,.9,1.25);"
|
||||
"f=.1;i.y=.5;"
|
||||
"O=250.;"
|
||||
"}"
|
||||
"if(y>o(a))"
|
||||
"{"
|
||||
"y=o(a);"
|
||||
"r=vec3(1.,.5,0.);"
|
||||
"f=.1;"
|
||||
"O=250.;"
|
||||
"}"
|
||||
"if(y>d(a))"
|
||||
"{"
|
||||
"y=d(a);"
|
||||
"r=vec3(1.);"
|
||||
"f=0.05;"
|
||||
"O=250.;"
|
||||
"}"
|
||||
"N+=(n(a*i.y)+n(a*i.y*2.)+n(a*i.y*4.))*i.x;"
|
||||
"N=normalize(N);"
|
||||
"float M=.3;"
|
||||
"for(int L=0;L<4;++L)"
|
||||
"{";
|
||||
|
||||
#pragma data_seg(".shader10")
|
||||
char mark_fs_light_1[]= ""
|
||||
"vec3 K=vec3(0.,4.3,102.3);"
|
||||
"K.xz=n(K.xz,L*.2-2.*l);";
|
||||
|
||||
#pragma data_seg(".shader11")
|
||||
char mark_fs_light_2[]= ""
|
||||
"vec3 K=vec3(0.,10.*sin(L+2.*l),12.);"
|
||||
"K.xz=n(K.xz,L*3.);";
|
||||
|
||||
#pragma data_seg(".shader12")
|
||||
char mark_fs_light_3[]= ""
|
||||
"vec3 K=vec3(0.,250.*l-L*50.,20.);"
|
||||
"K.xz=n(K.xz,cos(L)*20.*l);";
|
||||
|
||||
#pragma data_seg(".shader13")
|
||||
char mark_fs_light_0[]= ""
|
||||
"vec3 K=vec3(0.,200.*sin(L+2.*l),58.);"
|
||||
"K.xz=n(K.xz,cos(L)*20.*l);";
|
||||
|
||||
#pragma data_seg(".shader14")
|
||||
char mark_fs_light_shared[]= ""
|
||||
"vec3 J=a-clamp(dot(a-K,Q)/P,0.,1.)*Q*P;"
|
||||
"y=smoothstep(pow(2.,1.+.3/(x+.04)),0.,length(J-K));"
|
||||
"R(vec3(3.,2.5,2.)*y,1.-y);"
|
||||
"K-=a;"
|
||||
"M+=.4*dot(normalize(K),N)*smoothstep(80.,0.,length(K));"
|
||||
"}"
|
||||
"y=smoothstep(0.,220.*smoothstep(0.,.5,m.x),P);"
|
||||
"R(c*y,1.-y);"
|
||||
"Q=reflect(Q,N);"
|
||||
"r*=M;"
|
||||
"M=1.;"
|
||||
"for(y=6.;y>0.;y--)"
|
||||
"{"
|
||||
"M-=(y*.5-R(a+N*y*.5))/exp2(y);"
|
||||
"}"
|
||||
"r*=M;"
|
||||
"R(r,f);"
|
||||
"}"
|
||||
"e*=smoothstep(16.,15.65,m.x);"
|
||||
"}";
|
||||
|
||||
#pragma data_seg(".srcs")
|
||||
const char* ShaderSources[]=
|
||||
{
|
||||
mark_fs,
|
||||
mark_fs_func_0,
|
||||
mark_fs_main,
|
||||
mark_fs_col_0,
|
||||
mark_fs_col_shared,
|
||||
mark_fs_light_0,
|
||||
mark_fs_light_shared,
|
||||
mark_fs,
|
||||
mark_fs_func_1,
|
||||
mark_fs_main,
|
||||
mark_fs_col_1,
|
||||
mark_fs_col_shared,
|
||||
mark_fs_light_1,
|
||||
mark_fs_light_shared,
|
||||
mark_fs,
|
||||
mark_fs_func_2,
|
||||
mark_fs_main,
|
||||
mark_fs_col_2,
|
||||
mark_fs_col_shared,
|
||||
mark_fs_light_2,
|
||||
mark_fs_light_shared,
|
||||
mark_fs,
|
||||
mark_fs_func_3,
|
||||
mark_fs_main,
|
||||
mark_fs_col_3,
|
||||
mark_fs_col_shared,
|
||||
mark_fs_light_3,
|
||||
mark_fs_light_shared,
|
||||
};
|
||||
|
||||
#endif // MARK_SMALL_H_
|
||||
BIN
ev12-4k/minify/shader_minifier.exe
Normal file
BIN
ev12-4k/minify/shader_minifier.exe
Normal file
Binary file not shown.
1
ev12-4k/obj/!link_file.bat
Normal file
1
ev12-4k/obj/!link_file.bat
Normal file
@@ -0,0 +1 @@
|
||||
link.exe /CRINKLER /compmode:fast /ordertries:64 /hashtries:64 /hashsize:256 /REPORT:out.html /LIBPATH:"e:\Programme\Microsoft Visual Studio 8\VC\lib";"e:\sdks\dxsdk_apr2005\Lib\x86";"e:\sdks\Microsoft Platform SDK\Lib" /OUT:%1 /SUBSYSTEM:WINDOWS /ENTRY:"main" "bp4k_Release\main.obj" "..\4klang.obj" opengl32.lib winmm.lib kernel32.lib user32.lib gdi32.lib
|
||||
1
ev12-4k/obj/!link_file_hard.bat
Normal file
1
ev12-4k/obj/!link_file_hard.bat
Normal file
@@ -0,0 +1 @@
|
||||
link.exe /CRINKLER /compmode:slow /ordertries:6000 /hashtries:1024 /hashsize:512 /REPORT:out.html /LIBPATH:"e:\Programme\Microsoft Visual Studio 8\VC\lib";"e:\sdks\dxsdk_apr2005\Lib\x86";"e:\sdks\Microsoft Platform SDK\Lib" /OUT:%1 /SUBSYSTEM:WINDOWS /ENTRY:"main" "bp4k_Release\main.obj" "..\4klang.obj" opengl32.lib winmm.lib kernel32.lib user32.lib gdi32.lib
|
||||
63
ev12-4k/obj/compile.bat
Normal file
63
ev12-4k/obj/compile.bat
Normal file
@@ -0,0 +1,63 @@
|
||||
call "E:\Programme\MSVSExpress8\VC\bin\vcvars32.bat"
|
||||
call "C:\Programme\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=960 /DSCREENHEIGTH=510 /DASPECT="1.78" /DWINDOWED
|
||||
cd obj
|
||||
call !link_file red_960x510_window.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=800 /DSCREENHEIGTH=600 /DASPECT="1.33" /DWINDOWED
|
||||
cd obj
|
||||
call !link_file red_800x600_window.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=800 /DSCREENHEIGTH=600 /DASPECT="1.33"
|
||||
cd obj
|
||||
call !link_file red_800x600.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1024 /DSCREENHEIGTH=768 /DASPECT="1.33"
|
||||
cd obj
|
||||
call !link_file red_1024x768.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1280 /DSCREENHEIGTH=800 /DASPECT="1.6"
|
||||
cd obj
|
||||
call !link_file red_1280x800.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1280 /DSCREENHEIGTH=720 /DASPECT="1.78" /DWIDESCREEN
|
||||
cd obj
|
||||
call !link_file red_1280x720.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1280 /DSCREENHEIGTH=1024 /DASPECT="1.25"
|
||||
cd obj
|
||||
call !link_file red_1280x1024.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1400 /DSCREENHEIGTH=1050 /DASPECT="1.33"
|
||||
cd obj
|
||||
call !link_file red_1400x1050.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1600 /DSCREENHEIGTH=1200 /DASPECT="1.33"
|
||||
cd obj
|
||||
call !link_file red_1600x1200.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1680 /DSCREENHEIGTH=1050 /DASPECT="1.6" /DWIDESCREEN
|
||||
cd obj
|
||||
call !link_file red_1680x1050.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1920 /DSCREENHEIGTH=1080 /DASPECT="1.78" /DWIDESCREEN
|
||||
cd obj
|
||||
call !link_file red_1920x1080.exe
|
||||
|
||||
cd ..
|
||||
cl @files.txt @switches.txt /DSPECIALSCREEN /DSCREENWIDTH=1920 /DSCREENHEIGTH=1200 /DASPECT="1.6" /DWIDESCREEN
|
||||
cd obj
|
||||
call !link_file red_1920x1200.exe
|
||||
|
||||
BIN
ev12-4k/obj/link.exe
Normal file
BIN
ev12-4k/obj/link.exe
Normal file
Binary file not shown.
191
ev12-4k/release.h
Normal file
191
ev12-4k/release.h
Normal 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);}";
|
||||
163
ev12-4k/shader_code.h
Normal file
163
ev12-4k/shader_code.h
Normal 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_
|
||||
127
ev12-4k/small.h
Normal file
127
ev12-4k/small.h
Normal 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
ev12-4k/switches.txt
Normal file
24
ev12-4k/switches.txt
Normal 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"
|
||||
103
ev12-4k/synth.cpp
Normal file
103
ev12-4k/synth.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_EXTRA_LEAN
|
||||
#include "windows.h"
|
||||
#include "mmsystem.h"
|
||||
#include "mmreg.h"
|
||||
#include "4klang.h"
|
||||
|
||||
// define this if you have a multicore cpu and can spare ~15 bytes for realtime playback
|
||||
// undef for sound precalc
|
||||
#define USE_SOUND_THREAD
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// sound
|
||||
////////////////////////////////////////////////
|
||||
#define SAMPLE_RATE 44100
|
||||
#define MAX_SAMPLES SAMPLE_RATE*2*60*4
|
||||
|
||||
#pragma bss_seg(".synthnothing")
|
||||
static float lpSoundBuffer[MAX_SAMPLES];
|
||||
static HWAVEOUT hWaveOut;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// initialized data
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Initialization
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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
|
||||
Sleep(15000);
|
||||
waveOutOpen ( &hWaveOut, WAVE_MAPPER, &WaveFMT, NULL, 0, CALLBACK_NULL );
|
||||
waveOutPrepareHeader( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
|
||||
waveOutWrite ( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
|
||||
}
|
||||
|
||||
#pragma code_seg(".envelope")
|
||||
extern "C" float get_Envelope(int instrument)
|
||||
{
|
||||
return 0; //return (&_4klang_envelope_buffer)[((MMTime.u.sample >> 8) << 5) + 2*instrument];
|
||||
}
|
||||
|
||||
#pragma code_seg(".time")
|
||||
extern "C" float get_Time()
|
||||
{
|
||||
waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME));
|
||||
return float(MMTime.u.sample) / SAMPLE_RATE;
|
||||
}
|
||||
|
||||
#pragma code_seg(".sample")
|
||||
extern "C" int get_Sample()
|
||||
{
|
||||
waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME));
|
||||
return (MMTime.u.sample);
|
||||
}
|
||||
12
ev12-4k/synth.h
Normal file
12
ev12-4k/synth.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "4klang.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void InitSound();
|
||||
float get_Envelope(int instrument);
|
||||
float get_Time();
|
||||
int get_Sample();
|
||||
}
|
||||
Reference in New Issue
Block a user