-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working on adding the animation shader…
- Loading branch information
1 parent
44cf7f3
commit 29a5962
Showing
13 changed files
with
160 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//varying float alphaAmt = 0.5; | ||
|
||
|
||
void main(){ | ||
//this is the fragment shader | ||
//this is where the pixel level drawing happens | ||
//gl_FragCoord gives us the x and y of the current pixel its drawing | ||
|
||
//we grab the x and y and store them in an int | ||
float xVal = gl_FragCoord.x; | ||
float yVal = gl_FragCoord.y; | ||
|
||
//we use the mod function to only draw pixels if they are every 2 in x or every 4 in y | ||
//if( mod(xVal, 2.0) == 0.5 && mod(yVal, 4.0) == 0.5 ){ | ||
// gl_FragColor = gl_Color; | ||
//}else{ | ||
gl_FragColor.a = .5; | ||
//} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
void main() { | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_Position = ftransform(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#version 120 | ||
|
||
uniform float percent; | ||
varying float normPos; | ||
|
||
float map(float value, float inputMin, float inputMax, float outputMin, float outputMax) {; | ||
return ((value - inputMin) / (inputMax - inputMin) * (outputMax - outputMin) + outputMin); | ||
} | ||
|
||
void main() { | ||
// if(percent < normPos){ | ||
// discard; | ||
// } | ||
gl_FragColor = vec4( vec3( 1.- map(normPos, percent-.01, percent+.01, 0., 1.0)) , 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
|
||
uniform float percent; | ||
varying float normPos; | ||
|
||
void main(void) | ||
{ | ||
vec4 pos = gl_Vertex; | ||
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * pos; | ||
gl_FrontColor = gl_Color; | ||
|
||
normPos = gl_Normal.x; | ||
|
||
|
||
} |
27 changes: 27 additions & 0 deletions
27
CloudsSecondaryDisplay/bin/data/shaders/simpleBlurHorizontal.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
uniform sampler2DRect src_tex_unit0; | ||
uniform float blurAmnt; | ||
|
||
void main( void ) | ||
{ | ||
vec2 st = gl_TexCoord[0].st; | ||
|
||
//horizontal blur | ||
//from http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/ | ||
|
||
vec4 color; | ||
|
||
color += 1.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt * -4.0, 0.0)); | ||
color += 2.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt * -3.0, 0.0)); | ||
color += 3.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt * -2.0, 0.0)); | ||
color += 4.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt * -1.0, 0.0)); | ||
|
||
color += 5.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt, 0)); | ||
|
||
color += 4.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt * 1.0, 0.0)); | ||
color += 3.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt * 2.0, 0.0)); | ||
color += 2.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt * 3.0, 0.0)); | ||
color += 1.0 * texture2DRect(src_tex_unit0, st + vec2(blurAmnt * 4.0, 0.0)); | ||
|
||
color /= 25.0; | ||
gl_FragColor = color; | ||
} |
4 changes: 4 additions & 0 deletions
4
CloudsSecondaryDisplay/bin/data/shaders/simpleBlurHorizontal.vert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
void main() { | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_Position = ftransform(); | ||
} |
27 changes: 27 additions & 0 deletions
27
CloudsSecondaryDisplay/bin/data/shaders/simpleBlurVertical.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
uniform sampler2DRect src_tex_unit0; | ||
uniform float blurAmnt; | ||
|
||
void main( void ) | ||
{ | ||
vec2 st = gl_TexCoord[0].st; | ||
|
||
//vertical blur | ||
//from http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/ | ||
|
||
vec4 color; | ||
|
||
color += 1.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt * 4.0)); | ||
color += 2.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt * 3.0)); | ||
color += 3.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt * 2.0)); | ||
color += 4.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt * 1.0)); | ||
|
||
color += 5.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt) ); | ||
|
||
color += 4.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt * -1.0)); | ||
color += 3.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt * -2.0)); | ||
color += 2.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt * -3.0)); | ||
color += 1.0 * texture2DRect(src_tex_unit0, st + vec2(0.0, blurAmnt * -4.0)); | ||
|
||
color /= 25.0; | ||
gl_FragColor = color; | ||
} |
4 changes: 4 additions & 0 deletions
4
CloudsSecondaryDisplay/bin/data/shaders/simpleBlurVertical.vert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
void main() { | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_Position = ftransform(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters