mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-10 08:55:33 +02:00
Revert to using GL compatibility contexts (and GLES2)
This commit is contained in:
parent
48a4687aaf
commit
36baa6a10e
22 changed files with 192 additions and 201 deletions
|
@ -8,27 +8,26 @@ uniform vec4 subRect;
|
||||||
|
|
||||||
uniform lowp float opacity;
|
uniform lowp float opacity;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
|
{
|
||||||
|
vec2 coor = v_texCoord;
|
||||||
|
vec2 dstCoor = (coor - subRect.xy) * subRect.zw;
|
||||||
|
|
||||||
void main() {
|
vec4 srcFrag = texture2D(source, coor);
|
||||||
vec2 coor = v_texCoord;
|
vec4 dstFrag = texture2D(destination, dstCoor);
|
||||||
vec2 dstCoor = (coor - subRect.xy) * subRect.zw;
|
|
||||||
|
|
||||||
vec4 srcFrag = texture(source, coor);
|
vec4 resFrag;
|
||||||
vec4 dstFrag = texture(destination, dstCoor);
|
|
||||||
|
|
||||||
vec4 resFrag;
|
float co1 = srcFrag.a * opacity;
|
||||||
|
float co2 = dstFrag.a * (1.0 - co1);
|
||||||
|
resFrag.a = co1 + co2;
|
||||||
|
|
||||||
float co1 = srcFrag.a * opacity;
|
if (resFrag.a == 0.0)
|
||||||
float co2 = dstFrag.a * (1.0 - co1);
|
resFrag.rgb = srcFrag.rgb;
|
||||||
resFrag.a = co1 + co2;
|
else
|
||||||
|
resFrag.rgb = (co1*srcFrag.rgb + co2*dstFrag.rgb) / resFrag.a;
|
||||||
|
|
||||||
if (resFrag.a == 0.0)
|
gl_FragColor = resFrag;
|
||||||
resFrag.rgb = srcFrag.rgb;
|
|
||||||
else
|
|
||||||
resFrag.rgb = (co1 * srcFrag.rgb + co2 * dstFrag.rgb) / resFrag.a;
|
|
||||||
|
|
||||||
fragColor = resFrag;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
|
|
||||||
uniform sampler2D v_texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
in vec2 v_blurCoord[2];
|
varying vec2 v_blurCoord[2];
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
|
{
|
||||||
|
lowp vec4 frag = vec4(0, 0, 0, 0);
|
||||||
|
|
||||||
void main() {
|
frag += texture2D(texture, v_texCoord);
|
||||||
lowp vec4 frag = vec4(0, 0, 0, 0);
|
frag += texture2D(texture, v_blurCoord[0]);
|
||||||
|
frag += texture2D(texture, v_blurCoord[1]);
|
||||||
|
|
||||||
frag += texture(v_texture, v_texCoord);
|
gl_FragColor = frag / 3.0;
|
||||||
frag += texture(v_texture, v_blurCoord[0]);
|
|
||||||
frag += texture(v_texture, v_blurCoord[1]);
|
|
||||||
|
|
||||||
fragColor = frag / 3.0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
#version 330
|
#ifdef GLSLES
|
||||||
#define attribute in
|
|
||||||
#define varying out
|
#ifdef FRAGMENT_SHADER
|
||||||
|
/* Only the fragment shader has no default float precision */
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
/* Desktop GLSL doesn't know about these */
|
/* Desktop GLSL doesn't know about these */
|
||||||
#define highp
|
#define highp
|
||||||
#define mediump
|
#define mediump
|
||||||
#define lowp
|
#define lowp
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
|
||||||
uniform lowp float alpha;
|
uniform lowp float alpha;
|
||||||
|
|
||||||
in lowp vec4 v_color;
|
varying lowp vec4 v_color;
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
void main() { fragColor = vec4(v_color.rgb * alpha, 1); }
|
{
|
||||||
|
gl_FragColor = vec4(v_color.rgb * alpha, 1);
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
uniform lowp vec4 color;
|
uniform lowp vec4 color;
|
||||||
out vec4 fragColor;
|
|
||||||
void main() { fragColor = color; }
|
void main()
|
||||||
|
{
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
|
|
||||||
uniform sampler2D v_texture;
|
uniform sampler2D texture;
|
||||||
uniform lowp float gray;
|
uniform lowp float gray;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
const vec3 lumaF = vec3(.299, .587, .114);
|
const vec3 lumaF = vec3(.299, .587, .114);
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
void main() {
|
{
|
||||||
/* Sample source color */
|
/* Sample source color */
|
||||||
vec4 frag = texture(v_texture, v_texCoord);
|
vec4 frag = texture2D(texture, v_texCoord);
|
||||||
|
|
||||||
/* Apply gray */
|
/* Apply gray */
|
||||||
float luma = dot(frag.rgb, lumaF);
|
float luma = dot(frag.rgb, lumaF);
|
||||||
frag.rgb = mix(frag.rgb, vec3(luma), gray);
|
frag.rgb = mix(frag.rgb, vec3(luma), gray);
|
||||||
|
|
||||||
fragColor = frag;
|
gl_FragColor = frag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,40 @@
|
||||||
|
|
||||||
uniform sampler2D v_texture;
|
uniform sampler2D texture;
|
||||||
uniform mediump float hueAdjust;
|
uniform mediump float hueAdjust;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
out vec4 fragColor;
|
|
||||||
|
|
||||||
/* Source: gamedev.stackexchange.com/a/59808/24839 */
|
/* Source: gamedev.stackexchange.com/a/59808/24839 */
|
||||||
vec3 rgb2hsv(vec3 c) {
|
vec3 rgb2hsv(vec3 c)
|
||||||
const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
{
|
||||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||||
|
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||||
|
|
||||||
float d = q.x - min(q.w, q.y);
|
float d = q.x - min(q.w, q.y);
|
||||||
|
|
||||||
/* Avoid divide-by-zero situations by adding a very tiny delta.
|
/* Avoid divide-by-zero situations by adding a very tiny delta.
|
||||||
* Since we always deal with underlying 8-Bit color values, this
|
* Since we always deal with underlying 8-Bit color values, this
|
||||||
* should never mask a real value */
|
* should never mask a real value */
|
||||||
const float eps = 1.0e-10;
|
const float eps = 1.0e-10;
|
||||||
|
|
||||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + eps)), d / (q.x + eps), q.x);
|
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + eps)), d / (q.x + eps), q.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 hsv2rgb(vec3 c) {
|
vec3 hsv2rgb(vec3 c)
|
||||||
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
{
|
||||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||||
|
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main ()
|
||||||
vec4 color = texture(v_texture, v_texCoord.xy);
|
{
|
||||||
vec3 hsv = rgb2hsv(color.rgb);
|
vec4 color = texture2D (texture, v_texCoord.xy);
|
||||||
|
vec3 hsv = rgb2hsv(color.rgb);
|
||||||
|
|
||||||
hsv.x += hueAdjust;
|
hsv.x += hueAdjust;
|
||||||
color.rgb = hsv2rgb(hsv);
|
color.rgb = hsv2rgb(hsv);
|
||||||
|
|
||||||
fragColor = color;
|
gl_FragColor = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,4 +2,7 @@
|
||||||
uniform mat4 projMat;
|
uniform mat4 projMat;
|
||||||
attribute vec2 position;
|
attribute vec2 position;
|
||||||
|
|
||||||
void main() { gl_Position = projMat * vec4(position, 0, 1); }
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = projMat * vec4(position, 0, 1);
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
uniform sampler2D v_texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
uniform lowp vec4 tone;
|
uniform lowp vec4 tone;
|
||||||
|
|
||||||
|
@ -7,31 +7,30 @@ uniform lowp float opacity;
|
||||||
uniform lowp vec4 color;
|
uniform lowp vec4 color;
|
||||||
uniform lowp vec4 flash;
|
uniform lowp vec4 flash;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
const vec3 lumaF = vec3(.299, .587, .114);
|
const vec3 lumaF = vec3(.299, .587, .114);
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
|
{
|
||||||
|
/* Sample source color */
|
||||||
|
vec4 frag = texture2D(texture, v_texCoord);
|
||||||
|
|
||||||
|
/* Apply gray */
|
||||||
|
float luma = dot(frag.rgb, lumaF);
|
||||||
|
frag.rgb = mix(frag.rgb, vec3(luma), tone.w);
|
||||||
|
|
||||||
|
/* Apply tone */
|
||||||
|
frag.rgb += tone.rgb;
|
||||||
|
|
||||||
void main() {
|
/* Apply opacity */
|
||||||
/* Sample source color */
|
frag.a *= opacity;
|
||||||
vec4 frag = texture(v_texture, v_texCoord);
|
|
||||||
|
/* Apply color */
|
||||||
|
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||||
|
|
||||||
/* Apply gray */
|
/* Apply flash */
|
||||||
float luma = dot(frag.rgb, lumaF);
|
frag.rgb = mix(frag.rgb, flash.rgb, flash.a);
|
||||||
frag.rgb = mix(frag.rgb, vec3(luma), tone.w);
|
|
||||||
|
gl_FragColor = frag;
|
||||||
/* Apply tone */
|
|
||||||
frag.rgb += tone.rgb;
|
|
||||||
|
|
||||||
/* Apply opacity */
|
|
||||||
frag.a *= opacity;
|
|
||||||
|
|
||||||
/* Apply color */
|
|
||||||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
|
||||||
|
|
||||||
/* Apply flash */
|
|
||||||
frag.rgb = mix(frag.rgb, flash.rgb, flash.a);
|
|
||||||
|
|
||||||
fragColor = frag;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
|
||||||
uniform sampler2D v_texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
void main() { fragColor = texture(v_texture, v_texCoord); }
|
{
|
||||||
|
gl_FragColor = texture2D(texture, v_texCoord);
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
uniform sampler2D v_texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
in lowp vec4 v_color;
|
varying lowp vec4 v_color;
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
void main() {
|
{
|
||||||
fragColor = texture(v_texture, v_texCoord);
|
gl_FragColor = texture2D(texture, v_texCoord);
|
||||||
fragColor.a *= v_color.a;
|
gl_FragColor.a *= v_color.a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
uniform sampler2D v_texture;
|
uniform sampler2D texture;
|
||||||
uniform lowp float alpha;
|
uniform lowp float alpha;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
out vec4 fragColor;
|
|
||||||
|
|
||||||
void main() {
|
void main()
|
||||||
fragColor = texture(v_texture, v_texCoord);
|
{
|
||||||
fragColor.a *= alpha;
|
gl_FragColor = texture2D(texture, v_texCoord);
|
||||||
|
gl_FragColor.a *= alpha;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
in lowp vec4 v_color;
|
varying lowp vec4 v_color;
|
||||||
out vec4 fragColor;
|
|
||||||
void main() { fragColor = v_color; }
|
void main()
|
||||||
|
{
|
||||||
|
gl_FragColor = v_color;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
uniform sampler2D v_texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
uniform lowp vec4 tone;
|
uniform lowp vec4 tone;
|
||||||
|
|
||||||
|
@ -9,32 +9,31 @@ uniform lowp vec4 color;
|
||||||
uniform float bushDepth;
|
uniform float bushDepth;
|
||||||
uniform lowp float bushOpacity;
|
uniform lowp float bushOpacity;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
const vec3 lumaF = vec3(.299, .587, .114);
|
const vec3 lumaF = vec3(.299, .587, .114);
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
|
{
|
||||||
|
/* Sample source color */
|
||||||
|
vec4 frag = texture2D(texture, v_texCoord);
|
||||||
|
|
||||||
|
/* Apply gray */
|
||||||
|
float luma = dot(frag.rgb, lumaF);
|
||||||
|
frag.rgb = mix(frag.rgb, vec3(luma), tone.w);
|
||||||
|
|
||||||
|
/* Apply tone */
|
||||||
|
frag.rgb += tone.rgb;
|
||||||
|
|
||||||
void main() {
|
/* Apply opacity */
|
||||||
/* Sample source color */
|
frag.a *= opacity;
|
||||||
vec4 frag = texture(v_texture, v_texCoord);
|
|
||||||
|
/* Apply color */
|
||||||
|
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||||
|
|
||||||
/* Apply gray */
|
/* Apply bush alpha by mathematical if */
|
||||||
float luma = dot(frag.rgb, lumaF);
|
lowp float underBush = float(v_texCoord.y < bushDepth);
|
||||||
frag.rgb = mix(frag.rgb, vec3(luma), tone.w);
|
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
||||||
|
|
||||||
/* Apply tone */
|
gl_FragColor = frag;
|
||||||
frag.rgb += tone.rgb;
|
|
||||||
|
|
||||||
/* Apply opacity */
|
|
||||||
frag.a *= opacity;
|
|
||||||
|
|
||||||
/* Apply color */
|
|
||||||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
|
||||||
|
|
||||||
/* Apply bush alpha by mathematical if */
|
|
||||||
lowp float underBush = float(v_texCoord.y < bushDepth);
|
|
||||||
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
|
||||||
|
|
||||||
fragColor = frag;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
|
uniform sampler2D texture;
|
||||||
uniform sampler2D v_texture;
|
|
||||||
|
|
||||||
uniform lowp vec4 tone;
|
uniform lowp vec4 tone;
|
||||||
|
|
||||||
uniform lowp float opacity;
|
uniform lowp float opacity;
|
||||||
uniform lowp vec4 color;
|
uniform lowp vec4 color;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
const vec3 lumaF = vec3(.299, .587, .114);
|
const vec3 lumaF = vec3(.299, .587, .114);
|
||||||
|
|
||||||
out vec4 fragColor;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
/* Sample source color */
|
/* Sample source color */
|
||||||
vec4 frag = texture(v_texture, v_texCoord);
|
vec4 frag = texture2D(texture, v_texCoord);
|
||||||
|
|
||||||
/* Apply gray */
|
/* Apply gray */
|
||||||
float luma = dot(frag.rgb, lumaF);
|
float luma = dot(frag.rgb, lumaF);
|
||||||
|
@ -29,5 +26,5 @@ void main() {
|
||||||
/* Apply color */
|
/* Apply color */
|
||||||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||||
|
|
||||||
fragColor = frag;
|
gl_FragColor = frag;
|
||||||
}
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
uniform mat4 projMat;
|
uniform mat4 projMat;
|
||||||
|
|
||||||
uniform vec2 texSizeInv;
|
uniform vec2 texSizeInv;
|
||||||
|
@ -17,7 +16,7 @@ const float tileH = 32.0;
|
||||||
const float autotileW = 3.0*tileW;
|
const float autotileW = 3.0*tileW;
|
||||||
const float autotileH = 4.0*tileW;
|
const float autotileH = 4.0*tileW;
|
||||||
const float atAreaW = autotileW;
|
const float atAreaW = autotileW;
|
||||||
const float atAreaH = autotileH*nAutotiles;
|
const float atAreaH = autotileH*float(nAutotiles);
|
||||||
const float atAniOffsetX = 3.0*tileW;
|
const float atAniOffsetX = 3.0*tileW;
|
||||||
const float atAniOffsetY = tileH;
|
const float atAniOffsetY = tileH;
|
||||||
|
|
||||||
|
@ -25,17 +24,17 @@ uniform lowp int atFrames[nAutotiles];
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 tex = texCoord;
|
vec2 tex = texCoord;
|
||||||
lowp uint atIndex = uint(tex.y / autotileH);
|
lowp int atIndex = int(tex.y / autotileH);
|
||||||
|
|
||||||
lowp uint pred = uint(tex.x <= atAreaW && tex.y <= atAreaH);
|
lowp int pred = int(tex.x <= atAreaW && tex.y <= atAreaH);
|
||||||
lowp uint frame = uint(aniIndex % atFrames[atIndex]);
|
lowp int frame = int(aniIndex - atFrames[atIndex] * (aniIndex / atFrames[atIndex]));
|
||||||
lowp uint col = frame % 8u;
|
lowp int row = frame / 8;
|
||||||
lowp uint row = frame / 8u;
|
lowp int col = frame - 8 * row;
|
||||||
tex.x += atAniOffsetX * (col * pred);
|
tex.x += atAniOffsetX * float(col * pred);
|
||||||
tex.y += atAniOffsetY * (row * pred);
|
tex.y += atAniOffsetY * float(row * pred);
|
||||||
|
|
||||||
gl_Position = projMat * vec4(position + translation, 0, 1);
|
gl_Position = projMat * vec4(position + translation, 0, 1);
|
||||||
|
|
||||||
v_texCoord = tex * texSizeInv;
|
v_texCoord = tex * texSizeInv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,17 +8,16 @@ uniform float prog;
|
||||||
/* Vague [0, 512] normalized */
|
/* Vague [0, 512] normalized */
|
||||||
uniform float vague;
|
uniform float vague;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
|
{
|
||||||
void main() {
|
float transV = texture2D(transMap, v_texCoord).r;
|
||||||
float transV = texture(transMap, v_texCoord).r;
|
float cTransV = clamp(transV, prog, prog+vague);
|
||||||
float cTransV = clamp(transV, prog, prog + vague);
|
lowp float alpha = (cTransV - prog) / vague;
|
||||||
lowp float alpha = (cTransV - prog) / vague;
|
|
||||||
|
vec4 newFrag = texture2D(currentScene, v_texCoord);
|
||||||
vec4 newFrag = texture(currentScene, v_texCoord);
|
vec4 oldFrag = texture2D(frozenScene, v_texCoord);
|
||||||
vec4 oldFrag = texture(frozenScene, v_texCoord);
|
|
||||||
|
gl_FragColor = mix(newFrag, oldFrag, alpha);
|
||||||
fragColor = mix(newFrag, oldFrag, alpha);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,12 @@ uniform sampler2D frozenScene;
|
||||||
uniform sampler2D currentScene;
|
uniform sampler2D currentScene;
|
||||||
uniform float prog;
|
uniform float prog;
|
||||||
|
|
||||||
in vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
out vec4 fragColor;
|
void main()
|
||||||
|
{
|
||||||
|
vec4 newPixel = texture2D(currentScene, v_texCoord);
|
||||||
|
vec4 oldPixel = texture2D(frozenScene, v_texCoord);
|
||||||
|
|
||||||
void main() {
|
gl_FragColor = mix(oldPixel, newPixel, prog);
|
||||||
vec4 newPixel = texture(currentScene, v_texCoord);
|
|
||||||
vec4 oldPixel = texture(frozenScene, v_texCoord);
|
|
||||||
|
|
||||||
fragColor = mix(oldPixel, newPixel, prog);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,6 @@
|
||||||
struct Config {
|
struct Config {
|
||||||
int rgssVersion;
|
int rgssVersion;
|
||||||
|
|
||||||
struct {
|
|
||||||
char major;
|
|
||||||
char minor;
|
|
||||||
} glVersion;
|
|
||||||
|
|
||||||
bool debugMode;
|
bool debugMode;
|
||||||
bool printFPS;
|
bool printFPS;
|
||||||
|
|
||||||
|
|
|
@ -170,14 +170,6 @@ void Config::read(int argc, char *argv[]) {
|
||||||
fillStringVec(opts[@"rubyLoadpath"], rubyLoadpaths);
|
fillStringVec(opts[@"rubyLoadpath"], rubyLoadpaths);
|
||||||
rgssVersion = clamp(rgssVersion, 0, 3);
|
rgssVersion = clamp(rgssVersion, 0, 3);
|
||||||
SE.sourceCount = clamp(SE.sourceCount, 1, 64);
|
SE.sourceCount = clamp(SE.sourceCount, 1, 64);
|
||||||
|
|
||||||
if ([opts[@"openGL4"] boolValue]) {
|
|
||||||
glVersion.major = 4;
|
|
||||||
glVersion.minor = 1;
|
|
||||||
} else {
|
|
||||||
glVersion.major = 3;
|
|
||||||
glVersion.minor = 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setupScreenSize(Config &conf) {
|
static void setupScreenSize(Config &conf) {
|
||||||
|
|
|
@ -448,13 +448,6 @@ static SDL_GLContext initGL(SDL_Window *win, Config &conf,
|
||||||
if (conf.debugMode)
|
if (conf.debugMode)
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
|
||||||
|
|
||||||
// Core profile enables OpenGL4 on macOS
|
|
||||||
// Using OpenGL 4.1 requires a GPU with max texture size of 16384 or better
|
|
||||||
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, conf.glVersion.major);
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, conf.glVersion.minor);
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
|
||||||
|
|
||||||
glCtx = SDL_GL_CreateContext(win);
|
glCtx = SDL_GL_CreateContext(win);
|
||||||
|
|
||||||
if (!glCtx) {
|
if (!glCtx) {
|
||||||
|
|
|
@ -115,20 +115,20 @@ void Shader::unbind()
|
||||||
static void setupShaderSource(GLuint shader, GLenum type,
|
static void setupShaderSource(GLuint shader, GLenum type,
|
||||||
const unsigned char *body, int bodySize)
|
const unsigned char *body, int bodySize)
|
||||||
{
|
{
|
||||||
//static const char glesDefine[] = "#define GLSLES\n";
|
static const char glesDefine[] = "#define GLSLES\n";
|
||||||
static const char fragDefine[] = "";//#define FRAGMENT_SHADER\n";
|
static const char fragDefine[] = "#define FRAGMENT_SHADER\n";
|
||||||
|
|
||||||
const GLchar *shaderSrc[4];
|
const GLchar *shaderSrc[4];
|
||||||
GLint shaderSrcSize[4];
|
GLint shaderSrcSize[4];
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
/*
|
|
||||||
if (gl.glsles)
|
if (gl.glsles)
|
||||||
{
|
{
|
||||||
shaderSrc[i] = glesDefine;
|
shaderSrc[i] = glesDefine;
|
||||||
shaderSrcSize[i] = sizeof(glesDefine)-1;
|
shaderSrcSize[i] = sizeof(glesDefine)-1;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if (type == GL_FRAGMENT_SHADER)
|
if (type == GL_FRAGMENT_SHADER)
|
||||||
{
|
{
|
||||||
shaderSrc[i] = fragDefine;
|
shaderSrc[i] = fragDefine;
|
||||||
|
|
Loading…
Add table
Reference in a new issue