Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
Bonzomatic
Commits
86c76978
Commit
86c76978
authored
Feb 17, 2015
by
Gargaj
Browse files
replace default shader with something textureless
(thanks to glslsandbox for inspiration)
parent
e1a2ca90
Changes
3
Show whitespace changes
Inline
Side-by-side
platform_sdl/Renderer.cpp
View file @
86c76978
...
...
@@ -120,9 +120,14 @@ namespace Renderer
"
\n
"
"layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
\n
"
"
\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
"
"}
\n
"
"void main(void)
\n
"
"{
\n
"
" vec2 uv = gl_TexCoord[0].xy;
\n
"
;
" vec2 uv = gl_TexCoord[0].xy;
\n
"
" uv -= 0.5;
\n
"
" uv /= vec2(v2Resolution.y / v2Resolution.x, 1);
\n
"
"
\n
"
...
...
@@ -135,8 +140,9 @@ namespace Renderer
" m.x += sin( fGlobalTime ) * 0.1;
\n
"
" m.y += fGlobalTime * 0.25;
\n
"
"
\n
"
" vec4 t = texture( texTex2, m.xy ) * d; // or /d
\n
"
" out_color = f + t;// + uv.xyxy * 0.5 * (sin( fGlobalTime ) + 1.5);
\n
"
" vec4 t = plas( m * 3.14, fGlobalTime ) / d;
\n
"
" t = clamp( t, 0.0, 1.0 );
\n
"
" out_color = f + t;
\n
"
"}"
;
SDL_Surface
*
mScreen
=
NULL
;
...
...
platform_w32_dx11/Renderer.cpp
View file @
86c76978
...
...
@@ -77,6 +77,11 @@ namespace Renderer
"{%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
"
"}
\n
"
"float4 main( float4 position : SV_POSITION, float2 TexCoord : TEXCOORD ) : SV_TARGET
\n
"
"{
\n
"
" float2 uv = TexCoord;
\n
"
...
...
@@ -92,8 +97,9 @@ namespace Renderer
" m.x += sin( fGlobalTime ) * 0.1;
\n
"
" m.y += fGlobalTime * 0.25;
\n
"
"
\n
"
" float4 t = texTex2.Sample( smp, m.xy ) * d; // or /d
\n
"
" return f + t;// + uv.xyxy * 0.5 * (sin( fGlobalTime ) + 1.5);
\n
"
" float4 t = plas( m * 3.14, fGlobalTime ) / d;
\n
"
" t = saturate( t );
\n
"
" return f + t;
\n
"
"}"
;
char
defaultVertexShader
[
65536
]
=
...
...
platform_w32_dx9/Renderer.cpp
View file @
86c76978
...
...
@@ -72,6 +72,11 @@ namespace Renderer
"float fGlobalTime; // in seconds
\n
"
"float2 v2Resolution; // viewport resolution (in pixels)
\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
"
"}
\n
"
"float4 main( float2 TexCoord : TEXCOORD0 ) : COLOR0
\n
"
"{
\n
"
" float2 uv = TexCoord;
\n
"
...
...
@@ -87,8 +92,9 @@ namespace Renderer
" m.x += sin( fGlobalTime ) * 0.1;
\n
"
" m.y += fGlobalTime * 0.25;
\n
"
"
\n
"
" float4 t = tex2D( texTex2, m.xy ) * d; // or /d
\n
"
" return f + t;// + uv.xyxy * 0.5 * (sin( fGlobalTime ) + 1.5);
\n
"
" float4 t = plas( m * 3.14, fGlobalTime ) / d;
\n
"
" t = saturate( t );
\n
"
" return f + t;
\n
"
"}"
;
char
defaultVertexShader
[
65536
]
=
"struct VS_INPUT_PP { float3 Pos : POSITION0; float2 TexCoord : TEXCOORD0; };
\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment