Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge branch 'GLSL-master'
Merge an endless story. The branch name is a lie, it was started as glsl, but now it is a complete reworked opengl3 backend. It just began with simple changes which aren't supported on osx. They either support ogl2 OR ogl3 core, but mixing isn't allowed. As the branch name says, the vicious circle starts with GLSL, but just implementing one wasn't possible either: - OSX supports only GLSL100 which doesn't support our shaders. - Vertex Array Objects are needed for ogl3, but not supported on ogl2 - immediate mode isn't supported any more, so we must implement vertex buffers - uniform buffers are recommended as else we would need tons glUniform - postprocessing shaders have to be converted to glsl - lots of smaller outdated issues and bug fixes :-) Thanks at all for testing and at Sonic for converting all of our shaders to glsl130 And sorry for all upcoming bugs...
- Loading branch information
Showing
152 changed files
with
52,962 additions
and
48,597 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,109 +1,61 @@ | ||
| uniform samplerRECT samp0 : register(s0); | ||
| uniform sampler2D samp9; | ||
|
|
||
| void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) | ||
| { | ||
| float4 c0 = texRECT(samp0, uv0).rgba; | ||
| out vec4 ocol0; | ||
| in vec2 uv0; | ||
|
|
||
| uniform vec4 resolution; | ||
|
|
||
| void main() | ||
| { | ||
| //Change this number to increase the pixel size. | ||
| int pixelSize = 3; | ||
| float pixelSize = 3; | ||
|
|
||
| float red = 0.0; | ||
| float green = 0.0; | ||
| float blue = 0.0; | ||
| int val = uv0[0]; | ||
| int val2 = uv0[1]; | ||
|
|
||
| val = val % pixelSize; | ||
| val2 = val2 % pixelSize; | ||
|
|
||
| if(val == 0 && val2 == 0 ){ | ||
| if (c0.r < 0.1 && c0.r >= 0) | ||
| red = 0.1; | ||
| if (c0.r < 0.20 && c0.r >= 0.1) | ||
| red = 0.20; | ||
| if (c0.r <0.40 && c0.r >= 0.20) | ||
| red = 0.40; | ||
| if (c0.r <0.60 && c0.r >= 0.40) | ||
| red = 0.60; | ||
| if (c0.r <0.80 && c0.r >= 0.60) | ||
| red = 0.80; | ||
| if (c0.r >= 0.80) | ||
| red = 1; | ||
|
|
||
| if (c0.b < 0.1 && c0.b >= 0) | ||
| blue = 0.1; | ||
| if (c0.b < 0.20 && c0.b >= 0.1) | ||
| blue = 0.20; | ||
| if (c0.b <0.40 && c0.b >= 0.20) | ||
| blue = 0.40; | ||
| if (c0.b <0.60 && c0.b >= 0.40) | ||
| blue = 0.60; | ||
| if (c0.b <0.80 && c0.b >= 0.60) | ||
| blue = 0.80; | ||
| if (c0.b >= 0.80) | ||
| blue = 1; | ||
|
|
||
|
|
||
| if (c0.g < 0.1 && c0.g >= 0) | ||
| green = 0.1; | ||
| if (c0.g < 0.20 && c0.g >= 0.1) | ||
| green = 0.20; | ||
| if (c0.g <0.40 && c0.g >= 0.20) | ||
| green = 0.40; | ||
| if (c0.g <0.60 && c0.g >= 0.40) | ||
| green = 0.60; | ||
| if (c0.g <0.80 && c0.g >= 0.60) | ||
| green = 0.80; | ||
| if (c0.g >= 0.80) | ||
| green = 1; | ||
|
|
||
| } | ||
| else{ | ||
| float4 c1 = texRECT(samp0, uv0-float2(val, val2)).rgba; | ||
|
|
||
| if (c1.r < 0.1 && c1.r >= 0) | ||
| red = 0.1; | ||
| if (c1.r < 0.20 && c1.r >= 0.1) | ||
| red = 0.20; | ||
| if (c1.r <0.40 && c1.r >= 0.20) | ||
| red = 0.40; | ||
| if (c1.r <0.60 && c1.r >= 0.40) | ||
| red = 0.60; | ||
| if (c1.r <0.80 && c1.r >= 0.60) | ||
| red = 0.80; | ||
| if (c1.r >= 0.80) | ||
| red = 1; | ||
|
|
||
| if (c1.b < 0.1 && c1.b >= 0) | ||
| blue = 0.1; | ||
| if (c1.b < 0.20 && c1.b >= 0.1) | ||
| blue = 0.20; | ||
| if (c1.b <0.40 && c1.b >= 0.20) | ||
| blue = 0.40; | ||
| if (c1.b <0.60 && c1.b >= 0.40) | ||
| blue = 0.60; | ||
| if (c1.b <0.80 && c1.b >= 0.60) | ||
| blue = 0.80; | ||
| if (c1.b >= 0.80) | ||
| blue = 1; | ||
|
|
||
|
|
||
| if (c1.g < 0.1 && c1.g >= 0) | ||
| green = 0.1; | ||
| if (c1.g < 0.20 && c1.g >= 0.1) | ||
| green = 0.20; | ||
| if (c1.g <0.40 && c1.g >= 0.20) | ||
| green = 0.40; | ||
| if (c1.g <0.60 && c1.g >= 0.40) | ||
| green = 0.60; | ||
| if (c1.g <0.80 && c1.g >= 0.60) | ||
| green = 0.80; | ||
| if (c1.g >= 0.80) | ||
| green = 1; | ||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| ocol0 = float4(red, green, blue, c0.a); | ||
| vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw; | ||
|
|
||
| vec4 c0 = texture(samp9, pos); | ||
|
|
||
| if (c0.r < 0.1) | ||
| red = 0.1; | ||
| else if (c0.r < 0.20) | ||
| red = 0.20; | ||
| else if (c0.r < 0.40) | ||
| red = 0.40; | ||
| else if (c0.r < 0.60) | ||
| red = 0.60; | ||
| else if (c0.r < 0.80) | ||
| red = 0.80; | ||
| else | ||
| red = 1.0; | ||
|
|
||
| if (c0.b < 0.1) | ||
| blue = 0.1; | ||
| else if (c0.b < 0.20) | ||
| blue = 0.20; | ||
| else if (c0.b < 0.40) | ||
| blue = 0.40; | ||
| else if (c0.b < 0.60) | ||
| blue = 0.60; | ||
| else if (c0.b < 0.80) | ||
| blue = 0.80; | ||
| else | ||
| blue = 1.0; | ||
|
|
||
| if (c0.g < 0.1) | ||
| green = 0.1; | ||
| else if (c0.g < 0.20) | ||
| green = 0.20; | ||
| else if (c0.g < 0.40) | ||
| green = 0.40; | ||
| else if (c0.g < 0.60) | ||
| green = 0.60; | ||
| else if (c0.g < 0.80) | ||
| green = 0.80; | ||
| else | ||
| green = 1.0; | ||
|
|
||
| ocol0 = vec4(red, green, blue, c0.a); | ||
| } |
Oops, something went wrong.