added vertex warp shader and general cleanup
This commit is contained in:
parent
52e14857c7
commit
5937e2ccee
8 changed files with 86 additions and 6 deletions
|
@ -117,7 +117,6 @@ void main() {
|
||||||
newcoord = (floor(newcoord * view) + offset) / view;
|
newcoord = (floor(newcoord * view) + offset) / view;
|
||||||
#endif
|
#endif
|
||||||
vec3 color = texture2D(gcolor, newcoord).rgb;
|
vec3 color = texture2D(gcolor, newcoord).rgb;
|
||||||
//gl_FragData[0] = vec4(vec3(color), 1.0);
|
|
||||||
|
|
||||||
float mask;
|
float mask;
|
||||||
//vec3 ogRGB = texture2D(gcolor, texcoord).rgb;
|
//vec3 ogRGB = texture2D(gcolor, texcoord).rgb;
|
||||||
|
|
12
shaders/gbuffers_entities.fsh
Normal file
12
shaders/gbuffers_entities.fsh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
varying vec2 texcoord;
|
||||||
|
varying vec4 color;
|
||||||
|
|
||||||
|
uniform sampler2D texture;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec4 final = texture2D(texture, texcoord) * color;
|
||||||
|
gl_FragData[0] = final;
|
||||||
|
}
|
||||||
|
|
28
shaders/gbuffers_entities.vsh
Normal file
28
shaders/gbuffers_entities.vsh
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
varying vec2 texcoord;
|
||||||
|
varying vec4 color;
|
||||||
|
|
||||||
|
uniform mat4 gbufferModelView, gbufferModelViewInverse;
|
||||||
|
uniform float viewWidth, viewHeight;
|
||||||
|
|
||||||
|
#define pixelSize 2 // [1 2 4 8 16]
|
||||||
|
//#define vWarp // whether or not to warp vertices
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||||
|
color = gl_Color;
|
||||||
|
|
||||||
|
#ifdef vWarp
|
||||||
|
vec2 screen = vec2(viewWidth / pixelSize, viewHeight / pixelSize);
|
||||||
|
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
|
||||||
|
vec2 nearest = round(position.xy * screen) / screen;
|
||||||
|
position.xy = nearest;
|
||||||
|
//vec3 nearest = round(position.xyz * 100) / 100;
|
||||||
|
//position.xyz = nearest;
|
||||||
|
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
|
||||||
|
#else
|
||||||
|
gl_Position = ftransform();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
12
shaders/gbuffers_terrain.fsh
Normal file
12
shaders/gbuffers_terrain.fsh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
varying vec2 texcoord;
|
||||||
|
varying vec4 color;
|
||||||
|
|
||||||
|
uniform sampler2D texture;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec4 final = texture2D(texture, texcoord) * color;
|
||||||
|
gl_FragData[0] = final;
|
||||||
|
}
|
||||||
|
|
28
shaders/gbuffers_terrain.vsh
Normal file
28
shaders/gbuffers_terrain.vsh
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
varying vec2 texcoord;
|
||||||
|
varying vec4 color;
|
||||||
|
|
||||||
|
uniform mat4 gbufferModelView, gbufferModelViewInverse;
|
||||||
|
uniform float viewWidth, viewHeight;
|
||||||
|
|
||||||
|
#define pixelSize 2 // [1 2 4 8 16]
|
||||||
|
//#define vWarp // whether or not to warp vertices
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||||
|
color = gl_Color;
|
||||||
|
|
||||||
|
#ifdef vWarp
|
||||||
|
vec2 screen = vec2(viewWidth / pixelSize, viewHeight / pixelSize);
|
||||||
|
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
|
||||||
|
vec2 nearest = round(position.xy * screen) / screen;
|
||||||
|
position.xy = nearest;
|
||||||
|
//vec3 nearest = round(position.xyz * 100) / 100;
|
||||||
|
//position.xyz = nearest;
|
||||||
|
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
|
||||||
|
#else
|
||||||
|
gl_Position = ftransform();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -15,5 +15,6 @@ option.valSteps=Value Depth
|
||||||
|
|
||||||
screen.PSX=PSX
|
screen.PSX=PSX
|
||||||
option.vWarp=Vertex Warping
|
option.vWarp=Vertex Warping
|
||||||
option.tWarp=Texture Warping
|
option.tWarp=Affine Textures
|
||||||
|
option.tWarp.comment=Emulates affine texture mapping responsible for warping textures on the PSX
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
sliders=pixelSize hueSteps satSteps valSteps rgbSteps
|
sliders=pixelSize hueSteps satSteps valSteps rgbSteps
|
||||||
|
|
||||||
screen=pixelSize [COLOR] [PSX]
|
screen=pixelSize <empty> [COLOR] [PSX]
|
||||||
|
|
||||||
screen.COLOR=RGB rgbSteps pixelSize hueSteps satSteps valSteps
|
screen.COLOR=RGB rgbSteps hueSteps satSteps valSteps
|
||||||
screen.PSX=<empty>
|
screen.PSX=vWarp
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue