vertex warp is now a slider, shaders preserve lightmap
This commit is contained in:
parent
bd2dd746b2
commit
f056ae3f4d
6 changed files with 27 additions and 12 deletions
|
@ -2,11 +2,14 @@
|
|||
|
||||
varying vec2 texcoord;
|
||||
varying vec4 color;
|
||||
varying vec2 lmcoord;
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D lightmap;
|
||||
|
||||
void main() {
|
||||
vec4 final = texture2D(texture, texcoord) * color;
|
||||
final *= texture2D(lightmap, lmcoord);
|
||||
gl_FragData[0] = final;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,24 +2,25 @@
|
|||
|
||||
varying vec2 texcoord;
|
||||
varying vec4 color;
|
||||
varying vec2 lmcoord;
|
||||
|
||||
uniform mat4 gbufferModelView, gbufferModelViewInverse;
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
#define pixelSize 2 // [1 2 4 8 16]
|
||||
//#define vWarp // whether or not to warp vertices
|
||||
#define vWarp 0 // psx vertex warp [0 1 2 4 8 16 32]
|
||||
|
||||
void main() {
|
||||
texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
lmcoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
|
||||
color = gl_Color;
|
||||
|
||||
#ifdef vWarp
|
||||
vec2 screen = vec2(viewWidth / pixelSize, viewHeight / pixelSize);
|
||||
float mod = pixelSize * vWarp;
|
||||
vec2 screen = vec2(viewWidth / mod, viewHeight / mod);
|
||||
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
|
||||
vec2 nearest = round(position.xy * screen) / screen;
|
||||
vec2 nearest = round(position.xy / position.w * 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();
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
|
||||
varying vec2 texcoord;
|
||||
varying vec4 color;
|
||||
varying vec2 lmcoord;
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D lightmap;
|
||||
|
||||
void main() {
|
||||
vec4 final = texture2D(texture, texcoord) * color;
|
||||
final *= texture2D(lightmap, lmcoord);
|
||||
gl_FragData[0] = final;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,24 +2,25 @@
|
|||
|
||||
varying vec2 texcoord;
|
||||
varying vec4 color;
|
||||
varying vec2 lmcoord;
|
||||
|
||||
uniform mat4 gbufferModelView, gbufferModelViewInverse;
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
#define pixelSize 2 // [1 2 4 8 16]
|
||||
//#define vWarp // whether or not to warp vertices
|
||||
#define vWarp 0 // psx vertex warp [0 1 2 4 8 16 32]
|
||||
|
||||
void main() {
|
||||
texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
lmcoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
|
||||
color = gl_Color;
|
||||
|
||||
#ifdef vWarp
|
||||
vec2 screen = vec2(viewWidth / pixelSize, viewHeight / pixelSize);
|
||||
#if vWarp > 0
|
||||
float mod = pixelSize * vWarp;
|
||||
vec2 screen = vec2(viewWidth / mod, viewHeight / mod);
|
||||
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
|
||||
vec2 nearest = round(position.xy * screen) / screen;
|
||||
vec2 nearest = round(position.xy / position.w * 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();
|
||||
|
|
|
@ -19,6 +19,13 @@ option.valSteps=Value Depth
|
|||
screen.PSX=PSX
|
||||
option.vWarp=Vertex Warping
|
||||
option.vWarp.comment=Emulates screen-space vertex snapping responsible for vertex wobble on the PSX
|
||||
value.vWarp.0=Off
|
||||
value.vWarp.1=Minimal (1x)
|
||||
value.vWarp.2=Low (2x)
|
||||
value.vWarp.4=Medium (4x)
|
||||
value.vWarp.8=High (8x)
|
||||
value.vWarp.16=Extreme (16x)
|
||||
value.vWarp.32=Silly (32x)
|
||||
option.tWarp=Affine Textures
|
||||
option.tWarp.comment=Emulates affine texture mapping responsible for warping textures on the PSX
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
sliders=pixelSize hueSteps satSteps valSteps rgbSteps
|
||||
sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp
|
||||
|
||||
screen=pixelSize <empty> [COLOR] [PSX]
|
||||
|
||||
|
|
Loading…
Reference in a new issue