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 ...@@ -138,27 +138,28 @@ namespace Renderer
"\n" "\n"
"vec4 plas( vec2 v, float time )\n" "vec4 plas( vec2 v, float time )\n"
"{\n" "{\n"
" float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n" "\tfloat 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" "\treturn vec4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"}\n" "}\n"
"\n"
"void main(void)\n" "void main(void)\n"
"{\n" "{\n"
" vec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);\n" "\tvec2 uv = vec2(gl_FragCoord.x / v2Resolution.x, gl_FragCoord.y / v2Resolution.y);\n"
" uv -= 0.5;\n" "\tuv -= 0.5;\n"
" uv /= vec2(v2Resolution.y / v2Resolution.x, 1);\n" "\tuv /= vec2(v2Resolution.y / v2Resolution.x, 1);\n"
"\n" "\n"
" vec2 m;\n" "\tvec2 m;\n"
" m.x = atan(uv.x / uv.y) / 3.14;\n" "\tm.x = atan(uv.x / uv.y) / 3.14;\n"
" m.y = 1 / length(uv) * .2;\n" "\tm.y = 1 / length(uv) * .2;\n"
" float d = m.y;\n" "\tfloat d = m.y;\n"
"\n" "\n"
" float f = texture( texFFT, d ).r * 100;\n" "\tfloat f = texture( texFFT, d ).r * 100;\n"
" m.x += sin( fGlobalTime ) * 0.1;\n" "\tm.x += sin( fGlobalTime ) * 0.1;\n"
" m.y += fGlobalTime * 0.25;\n" "\tm.y += fGlobalTime * 0.25;\n"
"\n" "\n"
" vec4 t = plas( m * 3.14, fGlobalTime ) / d;\n" "\tvec4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
" t = clamp( t, 0.0, 1.0 );\n" "\tt = clamp( t, 0.0, 1.0 );\n"
" out_color = f + t;\n" "\tout_color = f + t;\n"
"}"; "}";
GLFWwindow * mWindow = NULL; GLFWwindow * mWindow = NULL;
......
...@@ -116,36 +116,37 @@ namespace Renderer ...@@ -116,36 +116,37 @@ namespace Renderer
"\n" "\n"
"cbuffer constants\n" "cbuffer constants\n"
"{\n" "{\n"
" float fGlobalTime; // in seconds\n" "\tfloat fGlobalTime; // in seconds\n"
" float2 v2Resolution; // viewport resolution (in pixels)\n" "\tfloat2 v2Resolution; // viewport resolution (in pixels)\n"
"{%midi:begin%}" "{%midi:begin%}"
" float {%midi:name%};\n" "\tfloat {%midi:name%};\n"
"{%midi:end%}" "{%midi:end%}"
"}\n" "}\n"
"\n" "\n"
"float4 plas( float2 v, float time )\n" "float4 plas( float2 v, float time )\n"
"{\n" "{\n"
" float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n" "\tfloat 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" "\treturn float4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"}\n" "}\n"
"\n"
"float4 main( float4 position : SV_POSITION, float2 TexCoord : TEXCOORD ) : SV_TARGET\n" "float4 main( float4 position : SV_POSITION, float2 TexCoord : TEXCOORD ) : SV_TARGET\n"
"{\n" "{\n"
" float2 uv = TexCoord;\n" "\tfloat2 uv = TexCoord;\n"
" uv -= 0.5;\n" "\tuv -= 0.5;\n"
" uv /= float2(v2Resolution.y / v2Resolution.x, 1);" "\tuv /= float2(v2Resolution.y / v2Resolution.x, 1);"
"\n" "\n"
" float2 m;\n" "\tfloat2 m;\n"
" m.x = atan(uv.x / uv.y) / 3.14;\n" "\tm.x = atan(uv.x / uv.y) / 3.14;\n"
" m.y = 1 / length(uv) * .2;\n" "\tm.y = 1 / length(uv) * .2;\n"
" float d = m.y;\n" "\tfloat d = m.y;\n"
"\n" "\n"
" float f = texFFT.Sample( smp, d ).r * 100;\n" "\tfloat f = texFFT.Sample( smp, d ).r * 100;\n"
" m.x += sin( fGlobalTime ) * 0.1;\n" "\tm.x += sin( fGlobalTime ) * 0.1;\n"
" m.y += fGlobalTime * 0.25;\n" "\tm.y += fGlobalTime * 0.25;\n"
"\n" "\n"
" float4 t = plas( m * 3.14, fGlobalTime ) / d;\n" "\tfloat4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
" t = saturate( t );\n" "\tt = saturate( t );\n"
" return f + t;\n" "\treturn f + t;\n"
"}"; "}";
char defaultVertexShader[65536] = char defaultVertexShader[65536] =
...@@ -154,10 +155,10 @@ namespace Renderer ...@@ -154,10 +155,10 @@ namespace Renderer
"\n" "\n"
"VS_OUTPUT_PP main( VS_INPUT_PP In )\n" "VS_OUTPUT_PP main( VS_INPUT_PP In )\n"
"{\n" "{\n"
" VS_OUTPUT_PP Out;\n" "\tVS_OUTPUT_PP Out;\n"
" Out.Pos = float4( In.Pos, 1.0 );\n" "\tOut.Pos = float4( In.Pos, 1.0 );\n"
" Out.TexCoord = In.TexCoord;\n" "\tOut.TexCoord = In.TexCoord;\n"
" return Out;\n" "\treturn Out;\n"
"}\n"; "}\n";
bool run = true; bool run = true;
......
...@@ -129,27 +129,28 @@ namespace Renderer ...@@ -129,27 +129,28 @@ namespace Renderer
"\n" "\n"
"float4 plas( float2 v, float time )\n" "float4 plas( float2 v, float time )\n"
"{\n" "{\n"
" float c = 0.5 + sin( v.x * 10.0 ) + cos( sin( time + v.y ) * 20.0 );\n" "\tfloat 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" "\treturn float4( sin(c * 0.2 + cos(time)), c * 0.15, cos( c * 0.1 + time / .4 ) * .25, 1.0 );\n"
"}\n" "}\n"
"\n"
"float4 main( float2 TexCoord : TEXCOORD0 ) : COLOR0\n" "float4 main( float2 TexCoord : TEXCOORD0 ) : COLOR0\n"
"{\n" "{\n"
" float2 uv = TexCoord;\n" "\tfloat2 uv = TexCoord;\n"
" uv -= 0.5;\n" "\tuv -= 0.5;\n"
" uv /= float2(v2Resolution.y / v2Resolution.x, 1);" "\tuv /= float2(v2Resolution.y / v2Resolution.x, 1);"
"\n" "\n"
" float2 m;\n" "\tfloat2 m;\n"
" m.x = atan(uv.x / uv.y) / 3.14;\n" "\tm.x = atan(uv.x / uv.y) / 3.14;\n"
" m.y = 1 / length(uv) * .2;\n" "\tm.y = 1 / length(uv) * .2;\n"
" float d = m.y;\n" "\tfloat d = m.y;\n"
"\n" "\n"
" float f = tex1D( texFFT, d ).r * 100;\n" "\tfloat f = tex1D( texFFT, d ).r * 100;\n"
" m.x += sin( fGlobalTime ) * 0.1;\n" "\tm.x += sin( fGlobalTime ) * 0.1;\n"
" m.y += fGlobalTime * 0.25;\n" "\tm.y += fGlobalTime * 0.25;\n"
"\n" "\n"
" float4 t = plas( m * 3.14, fGlobalTime ) / d;\n" "\tfloat4 t = plas( m * 3.14, fGlobalTime ) / d;\n"
" t = saturate( t );\n" "\tt = saturate( t );\n"
" return f + t;\n" "\treturn f + t;\n"
"}"; "}";
char defaultVertexShader[65536] = char defaultVertexShader[65536] =
"struct VS_INPUT_PP { float3 Pos : POSITION0; float2 TexCoord : TEXCOORD0; };\n" "struct VS_INPUT_PP { float3 Pos : POSITION0; float2 TexCoord : TEXCOORD0; };\n"
...@@ -157,10 +158,10 @@ namespace Renderer ...@@ -157,10 +158,10 @@ namespace Renderer
"\n" "\n"
"VS_OUTPUT_PP main( VS_INPUT_PP In )\n" "VS_OUTPUT_PP main( VS_INPUT_PP In )\n"
"{\n" "{\n"
" VS_OUTPUT_PP Out;\n" "\tVS_OUTPUT_PP Out;\n"
" Out.Pos = float4( In.Pos, 1.0 );\n" "\tOut.Pos = float4( In.Pos, 1.0 );\n"
" Out.TexCoord = In.TexCoord;\n" "\tOut.TexCoord = In.TexCoord;\n"
" return Out;\n" "\treturn Out;\n"
"}\n"; "}\n";
bool run = true; 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