From a7e9188862b5db35863f05b3d507658cadbced6d Mon Sep 17 00:00:00 2001 From: Valerie Date: Thu, 11 Apr 2024 12:04:33 -0400 Subject: [PATCH] initial texture warp implementation --- shaders/gbuffers_basic.vsh | 11 ++++++++--- shaders/lang/en_US.lang | 2 +- shaders/shaders.properties | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/shaders/gbuffers_basic.vsh b/shaders/gbuffers_basic.vsh index 0129250..da83c0c 100644 --- a/shaders/gbuffers_basic.vsh +++ b/shaders/gbuffers_basic.vsh @@ -1,5 +1,9 @@ #version 120 +#define pixelSize 2 // [1 2 4 8 16] +#define vWarp 0 // psx vertex warp [0 1 2 4 8 16 32] +//#define tWarp // psx texture warp + varying vec2 texcoord; varying vec4 color; varying vec2 lmcoord; @@ -7,9 +11,6 @@ varying vec2 lmcoord; uniform mat4 gbufferModelView, gbufferModelViewInverse; uniform float viewWidth, viewHeight; -#define pixelSize 2 // [1 2 4 8 16] -#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; @@ -25,5 +26,9 @@ void main() { #else gl_Position = ftransform(); #endif + + #ifdef tWarp + gl_Position /= gl_Position.w; + #endif } diff --git a/shaders/lang/en_US.lang b/shaders/lang/en_US.lang index 1f990ef..605a669 100644 --- a/shaders/lang/en_US.lang +++ b/shaders/lang/en_US.lang @@ -26,6 +26,6 @@ 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=Texture Warping option.tWarp.comment=Emulates affine texture mapping responsible for warping textures on the PSX diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 97ec62a..ee780dd 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -3,5 +3,5 @@ sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp screen=pixelSize [COLOR] [PSX] screen.COLOR=colorMode dithering rgbSteps hueSteps satSteps valSteps -screen.PSX=vWarp +screen.PSX=vWarp tWarp