Unverified Commit c9f5594a authored by CHEpachilo's avatar CHEpachilo Committed by GitHub
Browse files

Default shader edits. (#137)

* Update Renderer.cpp

* Tabulation edits

All double spaces in defaultShader replaced with "\t".

* Tabulation edits

All double spaces in defaultShader replaced with "\t"
parent 639bc41c
......@@ -138,27 +138,28 @@ namespace Renderer
"\n"
"vec4 plas( vec2 v, float time )\n"
"{\n"
" float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n"
" return vec4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"\tfloat c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n"
"\treturn vec4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"}\n"
"\n"
"void main(void)\n"
"{\n"
" vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);\n"
" uv -= 0.5;\n"
" uv /= vec2(v2Resolution.y / v2Resolution.x, 1);\n"
"\tvec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);\n"
"\tuv -= 0.5;\n"
"\tuv /= vec2(v2Resolution.y / v2Resolution.x, 1);\n"
"\n"
" vec2 m;\n"
" m.x = atan(uv.x / uv.y) / 3.14;\n"
" m.y = 1 / length(uv) * .2;\n"
" float d = m.y;\n"
"\tvec2 m;\n"
"\tm.x = atan(uv.x / uv.y) / 3.14;\n"
"\tm.y = 1 / length(uv) * .2;\n"
"\tfloat d = m.y;\n"
"\n"
" float f = texture( texFFT, d ).r * 100;\n"
" m.x += sin( fGlobalTime ) * 0.1;\n"
" m.y += fGlobalTime * 0.25;\n"
"\tfloat f = texture( texFFT, d ).r * 100;\n"
"\tm.x += sin( fGlobalTime ) * 0.1;\n"
"\tm.y += fGlobalTime * 0.25;\n"
"\n"
" vec4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
" t = clamp( t, 0.0, 1.0 );\n"
" out_color = f + t;\n"
"\tvec4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
"\tt = clamp( t, 0.0, 1.0 );\n"
"\tout_color = f + t;\n"
"}";
GLFWwindow * mWindow = NULL;
......
......@@ -116,36 +116,37 @@ namespace Renderer
"\n"
"cbuffer constants\n"
"{\n"
" float fGlobalTime; // in seconds\n"
" float2 v2Resolution; // viewport resolution (in pixels)\n"
"\tfloat fGlobalTime; // in seconds\n"
"\tfloat2 v2Resolution; // viewport resolution (in pixels)\n"
"{%midi:begin%}"
" float {%midi:name%};\n"
"\tfloat {%midi:name%};\n"
"{%midi:end%}"
"}\n"
"\n"
"float4 plas( float2 v, float time )\n"
"{\n"
" float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n"
" return float4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"\tfloat c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n"
"\treturn float4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"}\n"
"\n"
"float4 main( float4 position : SV_POSITION, float2 TexCoord : TEXCOORD ) : SV_TARGET\n"
"{\n"
" float2 uv = TexCoord;\n"
" uv -= 0.5;\n"
" uv /= float2(v2Resolution.y / v2Resolution.x, 1);"
"\tfloat2 uv = TexCoord;\n"
"\tuv -= 0.5;\n"
"\tuv /= float2(v2Resolution.y / v2Resolution.x, 1);"
"\n"
" float2 m;\n"
" m.x = atan(uv.x / uv.y) / 3.14;\n"
" m.y = 1 / length(uv) * .2;\n"
" float d = m.y;\n"
"\tfloat2 m;\n"
"\tm.x = atan(uv.x / uv.y) / 3.14;\n"
"\tm.y = 1 / length(uv) * .2;\n"
"\tfloat d = m.y;\n"
"\n"
" float f = texFFT.Sample( smp, d ).r * 100;\n"
" m.x += sin( fGlobalTime ) * 0.1;\n"
" m.y += fGlobalTime * 0.25;\n"
"\tfloat f = texFFT.Sample( smp, d ).r * 100;\n"
"\tm.x += sin( fGlobalTime ) * 0.1;\n"
"\tm.y += fGlobalTime * 0.25;\n"
"\n"
" float4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
" t = saturate( t );\n"
" return f + t;\n"
"\tfloat4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
"\tt = saturate( t );\n"
"\treturn f + t;\n"
"}";
char defaultVertexShader[65536] =
......@@ -154,10 +155,10 @@ namespace Renderer
"\n"
"VS_OUTPUT_PP main( VS_INPUT_PP In )\n"
"{\n"
" VS_OUTPUT_PP Out;\n"
" Out.Pos = float4( In.Pos, 1.0 );\n"
" Out.TexCoord = In.TexCoord;\n"
" return Out;\n"
"\tVS_OUTPUT_PP Out;\n"
"\tOut.Pos = float4( In.Pos, 1.0 );\n"
"\tOut.TexCoord = In.TexCoord;\n"
"\treturn Out;\n"
"}\n";
bool run = true;
......
......@@ -129,27 +129,28 @@ namespace Renderer
"\n"
"float4 plas( float2 v, float time )\n"
"{\n"
" float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n"
" return float4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"\tfloat c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n"
"\treturn float4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"}\n"
"\n"
"float4 main( float2 TexCoord : TEXCOORD0 ) : COLOR0\n"
"{\n"
" float2 uv = TexCoord;\n"
" uv -= 0.5;\n"
" uv /= float2(v2Resolution.y / v2Resolution.x, 1);"
"\tfloat2 uv = TexCoord;\n"
"\tuv -= 0.5;\n"
"\tuv /= float2(v2Resolution.y / v2Resolution.x, 1);"
"\n"
" float2 m;\n"
" m.x = atan(uv.x / uv.y) / 3.14;\n"
" m.y = 1 / length(uv) * .2;\n"
" float d = m.y;\n"
"\tfloat2 m;\n"
"\tm.x = atan(uv.x / uv.y) / 3.14;\n"
"\tm.y = 1 / length(uv) * .2;\n"
"\tfloat d = m.y;\n"
"\n"
" float f = tex1D( texFFT, d ).r * 100;\n"
" m.x += sin( fGlobalTime ) * 0.1;\n"
" m.y += fGlobalTime * 0.25;\n"
"\tfloat f = tex1D( texFFT, d ).r * 100;\n"
"\tm.x += sin( fGlobalTime ) * 0.1;\n"
"\tm.y += fGlobalTime * 0.25;\n"
"\n"
" float4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
" t = saturate( t );\n"
" return f + t;\n"
"\tfloat4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
"\tt = saturate( t );\n"
"\treturn f + t;\n"
"}";
char defaultVertexShader[65536] =
"struct VS_INPUT_PP { float3 Pos : POSITION0; float2 TexCoord : TEXCOORD0; };\n"
......@@ -157,10 +158,10 @@ namespace Renderer
"\n"
"VS_OUTPUT_PP main( VS_INPUT_PP In )\n"
"{\n"
" VS_OUTPUT_PP Out;\n"
" Out.Pos = float4( In.Pos, 1.0 );\n"
" Out.TexCoord = In.TexCoord;\n"
" return Out;\n"
"\tVS_OUTPUT_PP Out;\n"
"\tOut.Pos = float4( In.Pos, 1.0 );\n"
"\tOut.TexCoord = In.TexCoord;\n"
"\treturn Out;\n"
"}\n";
bool run = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment