fix cocktail-cab-portrait

This commit is contained in:
hunterk 2017-09-13 20:53:48 -05:00
parent ca18344e2f
commit 3c05e89b8c

View File

@ -1,9 +1,9 @@
#pragma parameter height "CocktailTable Image Height" 1.99 -3.0 3.0 0.01
#pragma parameter width "CocktailTable Image Width" 0.8 -5.0 5.0 0.05
#pragma parameter separation "CocktailTable Image Separation" -0.235 -2.0 2.0 0.005
#pragma parameter location "CocktailTable Image Location" -0.235 -2.0 2.0 0.005
#pragma parameter zoom "CocktailTable Zoom" 0.51 -2.0 5.0 0.01
#pragma parameter location_x "CocktailTable Location X" 0.0 -1.0 1.0 0.01
#pragma parameter location_y "CocktailTable Location Y" 0.0 -1.0 1.0 0.01
#define mul(a,b) (b*a)
#if defined(VERTEX)
@ -12,8 +12,8 @@
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif
@ -22,32 +22,15 @@
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING vec4 _color1;
COMPAT_VARYING float _frame_rotation;
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
float _frame_count;
float _frame_direction;
float _frame_rotation;
};
struct output_dummy {
vec4 _color1;
};
vec4 _oPosition1;
input_dummy _IN1;
vec4 _r0014;
vec4 _r0016;
vec2 _r0018;
vec2 _v0018;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec2 t1;
vec4 _oPosition1;
uniform mat4 MVPMatrix;
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
@ -55,48 +38,33 @@ uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
// compatibility #defines
#define vTexCoord TEX0.xy
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
#ifdef PARAMETER_UNIFORM
uniform COMPAT_PRECISION float height;
uniform COMPAT_PRECISION float width;
uniform COMPAT_PRECISION float separation;
uniform COMPAT_PRECISION float location;
uniform COMPAT_PRECISION float zoom;
uniform COMPAT_PRECISION float location_x;
uniform COMPAT_PRECISION float location_y;
#else
#define height 1.99
#define width 0.8
#define separation -0.235
#define location -0.235
#define zoom 0.51
#define location_x 0.0
#define location_y 0.0
#endif
void main()
{
vec4 _oColor;
vec2 _otexCoord;
vec2 _otexCoord1;
vec2 _shift;
_r0014 = VertexCoord.x*MVPMatrix[0];
_r0014 = _r0014 + VertexCoord.y*MVPMatrix[1];
_r0014 = _r0014 + VertexCoord.z*MVPMatrix[2];
_r0014 = _r0014 + VertexCoord.w*MVPMatrix[3];
_r0016 = _r0014.x*vec4( height, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00);
_r0016 = _r0016 + _r0014.y*vec4( 0.00000000E+00, width, 0.00000000E+00, 0.00000000E+00);
_r0016 = _r0016 + _r0014.z*vec4( 0.00000000E+00, 0.00000000E+00, 1.00000000E+00, 0.00000000E+00);
_r0016 = _r0016 + _r0014.w*vec4( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 1.00000000E+00);
_oPosition1 = _r0016;
_oColor = COLOR;
_shift = (5.00000000E-01*InputSize)/TextureSize;
_otexCoord = (TexCoord.xy - _shift)/zoom + _shift;
_v0018 = TexCoord.xy - _shift;
_r0018 = _v0018.x*vec2( -1.00000000E+00, 0.00000000E+00);
_r0018 = _r0018 + _v0018.y*vec2( 0.00000000E+00, -1.00000000E+00);
_otexCoord1 = _r0018/zoom + _shift;
gl_Position = _r0016;
COL0 = COLOR;
TEX0.xy = _otexCoord;
TEX1.xy = _otexCoord1;
mat4 RotationMatrix = mat4( height, 0.0, 0.0, 0.0,
0.0, width, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0 );
gl_Position = mul((MVPMatrix * VertexCoord), RotationMatrix);
vec2 shift = 0.5 * InputSize.xy / TextureSize.xy;
TEX0.xy = ((TexCoord.xy-shift) / zoom) + shift;
t1 = ((mat2(-1.0, 0.0, 0.0, -1.0) * (TexCoord.xy - shift)) / zoom) + shift;
}
#elif defined(FRAGMENT)
@ -121,60 +89,32 @@ precision mediump float;
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING vec4 _color;
COMPAT_VARYING float _frame_rotation;
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
float _frame_count;
float _frame_direction;
float _frame_rotation;
};
struct output_dummy {
vec4 _color;
};
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
vec2 _c0005;
vec2 _c0007;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
uniform sampler2D Texture;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec2 t1;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
#ifdef PARAMETER_UNIFORM
uniform COMPAT_PRECISION float height;
uniform COMPAT_PRECISION float width;
uniform COMPAT_PRECISION float separation;
uniform COMPAT_PRECISION float location;
uniform COMPAT_PRECISION float zoom;
uniform COMPAT_PRECISION float location_x;
uniform COMPAT_PRECISION float location_y;
#endif
void main()
{
output_dummy _OUT;
//fix for clamping issues on GLES
vec2 fragCoord1 = TEX0.xy * InputSize / TextureSize * vec2(0.9999);
vec2 fragCoord2 = TEX1.xy* InputSize / TextureSize * vec2(0.9999);
if ( fragCoord1.x < 0.9999 && fragCoord1.x > 0.0001 && fragCoord1.y < 0.9999 && fragCoord1.y > 0.0001 )
if ( fragCoord2.x < 0.9999 && fragCoord2.x > 0.0001 && fragCoord2.y < 0.9999 && fragCoord2.y > 0.0001 )
_c0005 = TEX0.xy + vec2( location_x, separation + location_y);
_TMP0 = COMPAT_TEXTURE(Texture, _c0005);
_c0007 = TEX1.xy + vec2( -location_x, separation - location_y);
_TMP1 = COMPAT_TEXTURE(Texture, _c0007);
_OUT._color = _TMP0 + _TMP1;
FragColor = _OUT._color;
return;
FragColor = texture(Source, vTexCoord + vec2(0.0, location)) + texture(Source, t1 + vec2(0.0, location));
}
#endif