WIP OSX and TvOS support
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
|
||||
//#extension GL_EXT_shadow_samplers : require
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
#if ENABLE_RIM_COLOR == 1
|
||||
uniform lowp vec3 rim_color;
|
||||
uniform mediump float rim_power;
|
||||
@@ -61,20 +63,20 @@
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
uniform sampler2D normalTexture;
|
||||
#else
|
||||
varying mediump vec3 normal;
|
||||
in mediump vec3 normal;
|
||||
#endif
|
||||
|
||||
#if HAS_DIFFUSE_MAP == 1 || HAS_NORMAL_MAP == 1 || HAS_SPEC_MAP == 1 || HAS_REFLECTION_MAP == 1
|
||||
varying highp vec2 texCoord;
|
||||
in highp vec2 texCoord;
|
||||
#endif
|
||||
#if HAS_NORMAL_MAP_OFFSET == 1 || HAS_NORMAL_MAP_SCALE == 1
|
||||
varying highp vec2 normal_uv;
|
||||
in highp vec2 normal_uv;
|
||||
#else
|
||||
#define normal_uv texCoord
|
||||
#endif
|
||||
#else
|
||||
#if HAS_DIFFUSE_MAP == 1
|
||||
varying highp vec2 texCoord;
|
||||
in highp vec2 texCoord;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -86,7 +88,7 @@
|
||||
|
||||
#if GBUFFER_PASS == 1
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
varying highp mat3 tangent_to_view_matrix;
|
||||
in highp mat3 tangent_to_view_matrix;
|
||||
#else
|
||||
uniform highp mat4 model_view_inverse_transpose_matrix;
|
||||
#endif
|
||||
@@ -94,7 +96,7 @@
|
||||
#if HAS_DIFFUSE_MAP == 1 && ALPHA_TEST == 1
|
||||
uniform sampler2D diffuseTexture;
|
||||
#if HAS_DIFFUSE_MAP_OFFSET == 1 || HAS_DIFFUSE_MAP_SCALE == 1
|
||||
varying highp vec2 diffuse_uv;
|
||||
in highp vec2 diffuse_uv;
|
||||
#else
|
||||
#define diffuse_uv texCoord
|
||||
#endif
|
||||
@@ -124,17 +126,17 @@
|
||||
uniform lowp vec3 material_reflection;
|
||||
uniform samplerCube reflectionCubeTexture;
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
varying highp mat3 tangent_to_world_matrix;
|
||||
in highp mat3 tangent_to_world_matrix;
|
||||
#define NEED_EYEVEC
|
||||
|
||||
uniform highp mat4 model_matrix;
|
||||
#else
|
||||
varying mediump vec3 reflectionVec;
|
||||
in mediump vec3 reflectionVec;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_EYEVEC
|
||||
varying mediump vec3 eyeVec;
|
||||
in mediump vec3 eyeVec;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -144,46 +146,46 @@
|
||||
#else
|
||||
uniform sampler2D shadowTexture1;
|
||||
#endif
|
||||
varying highp vec4 shadowMapCoord1;
|
||||
in highp vec4 shadowMapCoord1;
|
||||
#endif
|
||||
|
||||
#if HAS_LIGHT_MAP == 1
|
||||
uniform sampler2D lightmapTexture;
|
||||
varying mediump vec2 lightmap_uv;
|
||||
in mediump vec2 lightmap_uv;
|
||||
#endif
|
||||
|
||||
#if SHADOW_QUALITY >= 2
|
||||
uniform sampler2D shadowTexture2;
|
||||
varying highp vec4 shadowMapCoord2;
|
||||
in highp vec4 shadowMapCoord2;
|
||||
#endif
|
||||
|
||||
#if SHADOW_QUALITY >= 3
|
||||
uniform sampler2D shadowTexture3;
|
||||
varying highp vec4 shadowMapCoord3;
|
||||
in highp vec4 shadowMapCoord3;
|
||||
#endif
|
||||
|
||||
#if ENABLE_PER_PIXEL == 1
|
||||
varying mediump vec3 lightVec;
|
||||
varying mediump vec3 halfVec;
|
||||
in mediump vec3 lightVec;
|
||||
in mediump vec3 halfVec;
|
||||
#else
|
||||
varying mediump float lamberFactor;
|
||||
varying mediump float specularFactor;
|
||||
in mediump float lamberFactor;
|
||||
in mediump float specularFactor;
|
||||
#endif
|
||||
|
||||
#if (HAS_SPEC_MAP_OFFSET == 1|| HAS_SPEC_MAP_SCALE == 1) && ENABLE_PER_PIXEL == 1
|
||||
varying mediump vec2 spec_uv;
|
||||
in mediump vec2 spec_uv;
|
||||
#else
|
||||
#define spec_uv texCoord
|
||||
#endif
|
||||
|
||||
#if (HAS_REFLECTION_MAP_OFFSET == 1|| HAS_REFLECTION_MAP_SCALE == 1) && ENABLE_PER_PIXEL == 1
|
||||
varying mediump vec2 reflection_uv;
|
||||
in mediump vec2 reflection_uv;
|
||||
#else
|
||||
#define reflection_uv texCoord
|
||||
#endif
|
||||
|
||||
#if HAS_DIFFUSE_MAP_OFFSET == 1 || HAS_DIFFUSE_MAP_SCALE == 1
|
||||
varying highp vec2 diffuse_uv;
|
||||
in highp vec2 diffuse_uv;
|
||||
#else
|
||||
#define diffuse_uv texCoord
|
||||
#endif
|
||||
@@ -197,12 +199,12 @@
|
||||
void main()
|
||||
{
|
||||
#if ALPHA_TEST == 1 && HAS_DIFFUSE_MAP == 1
|
||||
mediump vec4 diffuseMaterial = texture2D(diffuseTexture, diffuse_uv);
|
||||
mediump vec4 diffuseMaterial = texture(diffuseTexture, diffuse_uv);
|
||||
if(diffuseMaterial.a < 0.5) discard;
|
||||
#endif
|
||||
|
||||
#if GBUFFER_PASS == 1 && ALPHA_TEST == 1
|
||||
if(texture2D(diffuseTexture, diffuse_uv).a < 0.5) discard;
|
||||
if(texture(diffuseTexture, diffuse_uv).a < 0.5) discard;
|
||||
#endif
|
||||
|
||||
#if GBUFFER_PASS == 2 || GBUFFER_PASS == 3
|
||||
@@ -210,7 +212,7 @@ void main()
|
||||
#endif
|
||||
|
||||
#if GBUFFER_PASS == 3
|
||||
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
|
||||
lowp vec4 gbuffer_sample = texture(gbuffer_frame, gbuffer_uv);
|
||||
mediump vec3 gbuffer_lamber_factor = gbuffer_sample.rgb * 5.0;
|
||||
lowp float gbuffer_specular_factor = gbuffer_sample.a;
|
||||
#endif
|
||||
@@ -218,18 +220,18 @@ void main()
|
||||
#if GBUFFER_PASS == 1
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
// lookup normal from normal map, move from [0,1] to [-1, 1] range, normalize
|
||||
mediump vec3 normal = normalize(2.0 * texture2D(normalTexture,normal_uv).rgb - 1.0);
|
||||
mediump vec3 normal = normalize(2.0 * texture(normalTexture,normal_uv).rgb - 1.0);
|
||||
mediump vec3 view_space_normal = tangent_to_view_matrix * normal;
|
||||
#else
|
||||
mediump vec3 view_space_normal = vec3(model_view_inverse_transpose_matrix * vec4(normal, 1.0));
|
||||
#endif
|
||||
gl_FragColor = vec4(view_space_normal * 0.5 + 0.5, material_shininess / 100.0);
|
||||
colorOut = vec4(view_space_normal * 0.5 + 0.5, material_shininess / 100.0);
|
||||
#else
|
||||
#if HAS_DIFFUSE_MAP == 1
|
||||
#if ALPHA_TEST == 1
|
||||
diffuseMaterial.a = 1.0;
|
||||
#else
|
||||
mediump vec4 diffuseMaterial = texture2D(diffuseTexture, diffuse_uv);
|
||||
mediump vec4 diffuseMaterial = texture(diffuseTexture, diffuse_uv);
|
||||
#endif
|
||||
|
||||
#else
|
||||
@@ -239,7 +241,7 @@ void main()
|
||||
#if ENABLE_PER_PIXEL == 1
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
// lookup normal from normal map, move from [0,1] to [-1, 1] range, normalize
|
||||
mediump vec3 normal = normalize(2.0 * texture2D(normalTexture,normal_uv).rgb - 1.0);
|
||||
mediump vec3 normal = normalize(2.0 * texture(normalTexture,normal_uv).rgb - 1.0);
|
||||
#endif
|
||||
|
||||
#if GBUFFER_PASS == 3
|
||||
@@ -277,7 +279,7 @@ void main()
|
||||
#if DEBUG_PSSM == 1
|
||||
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.75, 0.5, 1.0) + vec4(0.0, 0.0, 0.5, 0.0);
|
||||
#endif
|
||||
shadowMapDepth = texture2D(shadowTexture1, shadowMapPos).z;
|
||||
shadowMapDepth = texture(shadowTexture1, shadowMapPos).z;
|
||||
vertexShadowDepth = (shadowMapCoord1 / shadowMapCoord1.w).z;
|
||||
}
|
||||
#endif
|
||||
@@ -292,14 +294,14 @@ void main()
|
||||
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.75, 0.5, 1.0) + vec4(0.0, 0.0, 0.5 * diffuseMaterial.a, 0.0);
|
||||
#endif
|
||||
highp vec2 shadowMapPos = (shadowMapCoord1 / shadowMapCoord1.w).st;
|
||||
shadowMapDepth = texture2D(shadowTexture1, shadowMapPos).z;
|
||||
shadowMapDepth = texture(shadowTexture1, shadowMapPos).z;
|
||||
vertexShadowDepth = (shadowMapCoord1 / shadowMapCoord1.w).z;
|
||||
} else if(shadowMapCoord2.s >= -1.0 && shadowMapCoord2.s <= 1.0 && shadowMapCoord2.t >= -1.0 && shadowMapCoord2.t <= 1.0 && shadowMapCoord2.z >= 0.0 && shadowMapCoord2.z <= 1.0) {
|
||||
#if DEBUG_PSSM == 1
|
||||
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.50, 0.75, 1.0) + vec4(0.0, 0.5 * diffuseMaterial.a, 0.0, 0.0);
|
||||
#endif
|
||||
highp vec2 shadowMapPos = (shadowMapCoord2 / shadowMapCoord2.w).st;
|
||||
shadowMapDepth = texture2D(shadowTexture2, shadowMapPos).z;
|
||||
shadowMapDepth = texture(shadowTexture2, shadowMapPos).z;
|
||||
vertexShadowDepth = (shadowMapCoord2 / shadowMapCoord2.w).z;
|
||||
}
|
||||
#if SHADOW_QUALITY >= 3
|
||||
@@ -308,7 +310,7 @@ void main()
|
||||
diffuseMaterial = diffuseMaterial * vec4(0.50, 0.75, 0.75, 1.0) + vec4(0.5 * diffuseMaterial.a, 0.0, 0.0, 0.0);
|
||||
#endif
|
||||
highp vec2 shadowMapPos = (shadowMapCoord3 / shadowMapCoord3.w).st;
|
||||
shadowMapDepth = texture2D(shadowTexture3, shadowMapPos).z;
|
||||
shadowMapDepth = texture(shadowTexture3, shadowMapPos).z;
|
||||
vertexShadowDepth = (shadowMapCoord3 / shadowMapCoord3.w).z;
|
||||
}
|
||||
|
||||
@@ -330,38 +332,38 @@ void main()
|
||||
|
||||
#if ENABLE_AMBIENT == 1
|
||||
// -------------------- Add ambient light and alpha component --------------------
|
||||
gl_FragColor = vec4(vec3(diffuseMaterial) * material_ambient, 0.0);
|
||||
colorOut = vec4(vec3(diffuseMaterial) * material_ambient, 0.0);
|
||||
#else
|
||||
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
colorOut = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
#endif
|
||||
|
||||
#if ENABLE_DIFFUSE == 1
|
||||
// -------------------- Add diffuse light --------------------
|
||||
gl_FragColor += diffuseMaterial * vec4(material_diffuse * lamberFactor, 1.0);
|
||||
colorOut += diffuseMaterial * vec4(material_diffuse * lamberFactor, 1.0);
|
||||
#endif
|
||||
|
||||
// -------------------- Apply material_alpha --------------------
|
||||
|
||||
#if ALPHA_BLEND == 1
|
||||
gl_FragColor.a = diffuseMaterial.a;
|
||||
gl_FragColor *= material_alpha;
|
||||
colorOut.a = diffuseMaterial.a;
|
||||
colorOut *= material_alpha;
|
||||
#endif
|
||||
|
||||
// -------------------- Add specular light --------------------
|
||||
// Additive, not masked against diffuse alpha
|
||||
#if ENABLE_SPECULAR == 1
|
||||
#if HAS_SPEC_MAP == 1 && ENABLE_PER_PIXEL == 1
|
||||
gl_FragColor.rgb += material_specular * vec3(texture2D(specularTexture, spec_uv)) * specularFactor;
|
||||
colorOut.rgb += material_specular * vec3(texture(specularTexture, spec_uv)) * specularFactor;
|
||||
#else
|
||||
gl_FragColor.rgb += material_specular * specularFactor;
|
||||
colorOut.rgb += material_specular * specularFactor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// -------------------- Multiply light map --------------------
|
||||
#if HAS_LIGHT_MAP == 1
|
||||
mediump vec3 lightMapColor = vec3(texture2D(lightmapTexture, lightmap_uv));
|
||||
//gl_FragColor = vec4(gl_FragColor.r * lightMapColor.r, gl_FragColor.g * lightMapColor.g, gl_FragColor.b * lightMapColor.b, gl_FragColor.a);
|
||||
gl_FragColor.rgb *= lightMapColor;
|
||||
mediump vec3 lightMapColor = vec3(texture(lightmapTexture, lightmap_uv));
|
||||
//colorOut = vec4(colorOut.r * lightMapColor.r, colorOut.g * lightMapColor.g, colorOut.b * lightMapColor.b, colorOut.a);
|
||||
colorOut.rgb *= lightMapColor;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -375,9 +377,9 @@ void main()
|
||||
mediump vec3 reflectionVec = mat3(model_matrix) * (incidenceVec - 2.0 * dot(world_space_normal, incidenceVec) * world_space_normal);
|
||||
#endif
|
||||
#if HAS_REFLECTION_MAP == 1
|
||||
gl_FragColor += vec4(material_reflection, 0.0) * texture2D(reflectionTexture, reflection_uv) * vec4(textureCube(reflectionCubeTexture, reflectionVec).rgb, 1.0);
|
||||
colorOut += vec4(material_reflection, 0.0) * texture(reflectionTexture, reflection_uv) * vec4(texture(reflectionCubeTexture, reflectionVec).rgb, 1.0);
|
||||
#else
|
||||
gl_FragColor += vec4(material_reflection, 0.0) * vec4(textureCube(reflectionCubeTexture, reflectionVec).rgb, 1.0);
|
||||
colorOut += vec4(material_reflection, 0.0) * vec4(texture(reflectionCubeTexture, reflectionVec).rgb, 1.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -402,9 +404,9 @@ void main()
|
||||
#endif
|
||||
|
||||
#if ALPHA_BLEND == 1
|
||||
gl_FragColor.rgb = mix(fog_color.rgb * gl_FragColor.a, gl_FragColor.rgb, fog_alpha);
|
||||
colorOut.rgb = mix(fog_color.rgb * colorOut.a, colorOut.rgb, fog_alpha);
|
||||
#else
|
||||
gl_FragColor.rgb = mix(fog_color.rgb, gl_FragColor.rgb, fog_alpha);
|
||||
colorOut.rgb = mix(fog_color.rgb, colorOut.rgb, fog_alpha);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -414,10 +416,10 @@ void main()
|
||||
#if ENABLE_RIM_COLOR == 1
|
||||
lowp float rim = 1.0 - clamp(dot(normalize(eyeVec), normal), 0.0, 1.0);
|
||||
|
||||
gl_FragColor += vec4(rim_color, 1.0) * pow(rim, rim_power);
|
||||
colorOut += vec4(rim_color, 1.0) * pow(rim, rim_power);
|
||||
#endif
|
||||
|
||||
#if BONE_COUNT > 0
|
||||
gl_FragColor.b = 1.0;
|
||||
colorOut.b = 1.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
//
|
||||
|
||||
|
||||
attribute highp vec3 vertex_position, vertex_normal;
|
||||
in highp vec3 vertex_position, vertex_normal;
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
attribute highp vec3 vertex_tangent;
|
||||
in highp vec3 vertex_tangent;
|
||||
#endif
|
||||
attribute mediump vec2 vertex_uv;
|
||||
in mediump vec2 vertex_uv;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
|
||||
#if BONE_COUNT > 0
|
||||
attribute highp vec4 bone_weights;
|
||||
attribute highp vec4 bone_indexes;
|
||||
in highp vec4 bone_weights;
|
||||
in highp vec4 bone_indexes;
|
||||
uniform highp mat4 bone_transforms[BONE_COUNT];
|
||||
#else
|
||||
#define vertex_position_skinned vertex_position
|
||||
@@ -51,7 +51,7 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
|
||||
|
||||
#if ENABLE_PER_PIXEL == 1 || GBUFFER_PASS == 1
|
||||
#if HAS_DIFFUSE_MAP == 1 || HAS_NORMAL_MAP == 1 || HAS_SPEC_MAP == 1 || HAS_REFLECTION_MAP == 1
|
||||
varying highp vec2 texCoord;
|
||||
out highp vec2 texCoord;
|
||||
#endif
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
#if HAS_NORMAL_MAP_SCALE == 1
|
||||
@@ -63,22 +63,22 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
|
||||
#endif
|
||||
|
||||
#if HAS_NORMAL_MAP_OFFSET == 1 || HAS_NORMAL_MAP_SCALE == 1
|
||||
varying highp vec2 normal_uv;
|
||||
out highp vec2 normal_uv;
|
||||
#endif
|
||||
#else
|
||||
varying mediump vec3 normal;
|
||||
out mediump vec3 normal;
|
||||
#endif
|
||||
#else
|
||||
uniform mediump float material_shininess;
|
||||
#if HAS_DIFFUSE_MAP == 1
|
||||
varying highp vec2 texCoord;
|
||||
out highp vec2 texCoord;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if GBUFFER_PASS == 1
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
uniform highp mat4 model_view_inverse_transpose_matrix;
|
||||
varying highp mat3 tangent_to_view_matrix;
|
||||
out highp mat3 tangent_to_view_matrix;
|
||||
#endif
|
||||
#else
|
||||
|
||||
@@ -86,16 +86,16 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
|
||||
uniform highp vec3 camera_position_model_space;
|
||||
|
||||
#if HAS_LIGHT_MAP == 1
|
||||
attribute mediump vec2 vertex_lightmap_uv;
|
||||
varying mediump vec2 lightmap_uv;
|
||||
in mediump vec2 vertex_lightmap_uv;
|
||||
out mediump vec2 lightmap_uv;
|
||||
#endif
|
||||
|
||||
#if ENABLE_PER_PIXEL == 1
|
||||
varying mediump vec3 lightVec;
|
||||
varying mediump vec3 halfVec;
|
||||
out mediump vec3 lightVec;
|
||||
out mediump vec3 halfVec;
|
||||
|
||||
#if HAS_SPEC_MAP_OFFSET == 1 || HAS_SPEC_MAP_SCALE == 1
|
||||
varying highp vec2 spec_uv;
|
||||
out highp vec2 spec_uv;
|
||||
#endif
|
||||
|
||||
#if HAS_SPEC_MAP_SCALE == 1
|
||||
@@ -107,7 +107,7 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
|
||||
#endif
|
||||
|
||||
#if HAS_REFLECTION_MAP_OFFSET == 1 || HAS_REFLECTION_MAP_SCALE == 1
|
||||
varying highp vec2 reflection_uv;
|
||||
out highp vec2 reflection_uv;
|
||||
#endif
|
||||
|
||||
#if HAS_REFLECTION_MAP_SCALE == 1
|
||||
@@ -120,22 +120,22 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
|
||||
|
||||
#if SHADOW_QUALITY >= 1
|
||||
uniform highp mat4 shadow_mvp1;
|
||||
varying highp vec4 shadowMapCoord1;
|
||||
out highp vec4 shadowMapCoord1;
|
||||
#endif
|
||||
|
||||
#if SHADOW_QUALITY >= 2
|
||||
uniform highp mat4 shadow_mvp2;
|
||||
varying highp vec4 shadowMapCoord2;
|
||||
out highp vec4 shadowMapCoord2;
|
||||
#endif
|
||||
|
||||
#if SHADOW_QUALITY >= 3
|
||||
uniform highp mat4 shadow_mvp3;
|
||||
varying highp vec4 shadowMapCoord3;
|
||||
out highp vec4 shadowMapCoord3;
|
||||
#endif
|
||||
|
||||
#else
|
||||
varying mediump float lamberFactor;
|
||||
varying mediump float specularFactor;
|
||||
out mediump float lamberFactor;
|
||||
out mediump float specularFactor;
|
||||
#endif
|
||||
|
||||
#if ENABLE_RIM_COLOR == 1
|
||||
@@ -146,15 +146,15 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
|
||||
#if HAS_NORMAL_MAP == 1
|
||||
#define NEED_EYEVEC
|
||||
uniform highp mat4 model_inverse_transpose_matrix;
|
||||
varying highp mat3 tangent_to_world_matrix;
|
||||
out highp mat3 tangent_to_world_matrix;
|
||||
#else
|
||||
uniform highp mat4 model_matrix;
|
||||
varying mediump vec3 reflectionVec;
|
||||
out mediump vec3 reflectionVec;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_EYEVEC
|
||||
varying mediump vec3 eyeVec;
|
||||
out mediump vec3 eyeVec;
|
||||
#endif
|
||||
|
||||
#if HAS_DIFFUSE_MAP_SCALE == 1
|
||||
@@ -166,7 +166,7 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
|
||||
#endif
|
||||
|
||||
#if HAS_DIFFUSE_MAP_OFFSET == 1 || HAS_DIFFUSE_MAP_SCALE == 1
|
||||
varying highp vec2 diffuse_uv;
|
||||
out highp vec2 diffuse_uv;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,32 +31,33 @@
|
||||
#define PIXEL_SHIFT_3 0.003
|
||||
#define PIXEL_SHIFT_4 0.004
|
||||
|
||||
varying mediump vec2 textureCoordinate;
|
||||
//precision lowp float;
|
||||
in vec2 textureCoordinate;
|
||||
|
||||
#if ENABLE_VIDEO_BG == 1
|
||||
uniform lowp sampler2D videoFrame;
|
||||
uniform sampler2D videoFrame;
|
||||
#endif
|
||||
|
||||
#if ENABLE_FADE_COLOR == 1
|
||||
uniform lowp vec4 fade_color;
|
||||
uniform vec4 fade_color;
|
||||
#endif
|
||||
|
||||
uniform lowp sampler2D renderFrame;
|
||||
uniform lowp sampler2D depthFrame;
|
||||
uniform sampler2D renderFrame;
|
||||
uniform sampler2D depthFrame;
|
||||
|
||||
#if VOLUMETRIC_ENVIRONMENT_DOWNSAMPLED == 1
|
||||
uniform lowp sampler2D volumetricEnvironmentFrame;
|
||||
uniform sampler2D volumetricEnvironmentFrame;
|
||||
#endif
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
lowp vec4 renderColor = texture2D(renderFrame, textureCoordinate);
|
||||
vec4 renderColor = texture(renderFrame, textureCoordinate);
|
||||
#if DOF_QUALITY > 0 || ENABLE_FLASH == 1
|
||||
mediump float depth = texture2D(depthFrame, textureCoordinate).r;
|
||||
float depth = texture(depthFrame, textureCoordinate).r;
|
||||
#endif
|
||||
mediump vec4 pixelColor = renderColor;
|
||||
vec4 pixelColor = renderColor;
|
||||
|
||||
|
||||
#if DOF_QUALITY == 2
|
||||
@@ -67,43 +68,43 @@ void main()
|
||||
// _XXXXX_
|
||||
// _XXXXX_
|
||||
// __XXX__
|
||||
mediump float cf1 = PIXEL_SHIFT_1;
|
||||
mediump float cf2 = PIXEL_SHIFT_2;
|
||||
float cf1 = PIXEL_SHIFT_1;
|
||||
float cf2 = PIXEL_SHIFT_2;
|
||||
|
||||
mediump float bx1 = textureCoordinate.s + cf1;
|
||||
mediump float bx2 = textureCoordinate.s + cf2;
|
||||
mediump float bxm1 = textureCoordinate.s - cf1;
|
||||
mediump float bxm2 = textureCoordinate.s - cf2;
|
||||
float bx1 = textureCoordinate.s + cf1;
|
||||
float bx2 = textureCoordinate.s + cf2;
|
||||
float bxm1 = textureCoordinate.s - cf1;
|
||||
float bxm2 = textureCoordinate.s - cf2;
|
||||
|
||||
mediump float by1 = textureCoordinate.t + cf1;
|
||||
mediump float by2 = textureCoordinate.t + cf2;
|
||||
mediump float bym1 = textureCoordinate.t - cf1;
|
||||
mediump float bym2 = textureCoordinate.t - cf2;
|
||||
float by1 = textureCoordinate.t + cf1;
|
||||
float by2 = textureCoordinate.t + cf2;
|
||||
float bym1 = textureCoordinate.t - cf1;
|
||||
float bym2 = textureCoordinate.t - cf2;
|
||||
|
||||
pixelColor += texture2D(renderFrame, vec2(bx1, textureCoordinate.t));
|
||||
pixelColor += texture2D(renderFrame, vec2(bxm1, textureCoordinate.t));
|
||||
pixelColor += texture2D(renderFrame, vec2(bx2, textureCoordinate.t));
|
||||
pixelColor += texture2D(renderFrame, vec2(bxm2, textureCoordinate.t));
|
||||
pixelColor += texture(renderFrame, vec2(bx1, textureCoordinate.t));
|
||||
pixelColor += texture(renderFrame, vec2(bxm1, textureCoordinate.t));
|
||||
pixelColor += texture(renderFrame, vec2(bx2, textureCoordinate.t));
|
||||
pixelColor += texture(renderFrame, vec2(bxm2, textureCoordinate.t));
|
||||
|
||||
pixelColor += texture2D(renderFrame, vec2(textureCoordinate.s, by1));
|
||||
pixelColor += texture2D(renderFrame, vec2(bx1, by1));
|
||||
pixelColor += texture2D(renderFrame, vec2(bxm1, by1));
|
||||
pixelColor += texture2D(renderFrame, vec2(bx2, by1));
|
||||
pixelColor += texture2D(renderFrame, vec2(bxm2, by1));
|
||||
pixelColor += texture(renderFrame, vec2(textureCoordinate.s, by1));
|
||||
pixelColor += texture(renderFrame, vec2(bx1, by1));
|
||||
pixelColor += texture(renderFrame, vec2(bxm1, by1));
|
||||
pixelColor += texture(renderFrame, vec2(bx2, by1));
|
||||
pixelColor += texture(renderFrame, vec2(bxm2, by1));
|
||||
|
||||
pixelColor += texture2D(renderFrame, vec2(textureCoordinate.s, by2));
|
||||
pixelColor += texture2D(renderFrame, vec2(bx1, by2));
|
||||
pixelColor += texture2D(renderFrame, vec2(bxm1, by2));
|
||||
pixelColor += texture(renderFrame, vec2(textureCoordinate.s, by2));
|
||||
pixelColor += texture(renderFrame, vec2(bx1, by2));
|
||||
pixelColor += texture(renderFrame, vec2(bxm1, by2));
|
||||
|
||||
pixelColor += texture2D(renderFrame, vec2(textureCoordinate.s,bym1));
|
||||
pixelColor += texture2D(renderFrame, vec2(bx1,bym1));
|
||||
pixelColor += texture2D(renderFrame, vec2(bxm1,bym1));
|
||||
pixelColor += texture2D(renderFrame, vec2(bx2,bym1));
|
||||
pixelColor += texture2D(renderFrame, vec2(bxm2,bym1));
|
||||
pixelColor += texture(renderFrame, vec2(textureCoordinate.s,bym1));
|
||||
pixelColor += texture(renderFrame, vec2(bx1,bym1));
|
||||
pixelColor += texture(renderFrame, vec2(bxm1,bym1));
|
||||
pixelColor += texture(renderFrame, vec2(bx2,bym1));
|
||||
pixelColor += texture(renderFrame, vec2(bxm2,bym1));
|
||||
|
||||
pixelColor += texture2D(renderFrame, vec2(bx1, bym2));
|
||||
pixelColor += texture2D(renderFrame, vec2(bx1, bym2));
|
||||
pixelColor += texture2D(renderFrame, vec2(bxm1, bym2));
|
||||
pixelColor += texture(renderFrame, vec2(bx1, bym2));
|
||||
pixelColor += texture(renderFrame, vec2(bx1, bym2));
|
||||
pixelColor += texture(renderFrame, vec2(bxm1, bym2));
|
||||
pixelColor /= 21.0;
|
||||
|
||||
#endif
|
||||
@@ -117,26 +118,26 @@ void main()
|
||||
// _XXXXX_
|
||||
// __XXX__
|
||||
// ___X___
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_2));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_2, 0));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, 0));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, 0));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_2, 0));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture2D(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_2));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_2));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_2, 0));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, 0));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, 0));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_2, 0));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(-PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(+PIXEL_SHIFT_1, -PIXEL_SHIFT_1));
|
||||
pixelColor += texture(renderFrame, textureCoordinate + vec2(0, -PIXEL_SHIFT_2));
|
||||
pixelColor /= 13.0;
|
||||
|
||||
#endif
|
||||
// DOF_QUALITY == 1
|
||||
|
||||
#if DOF_QUALITY > 0
|
||||
mediump float focusDepth = texture2D(depthFrame, vec2(0.5, 0.5)).r;
|
||||
mediump float blurAmount = clamp((depth - DOF_DEPTH - focusDepth) / DOF_FALLOFF, 0.0, 1.0);
|
||||
float focusDepth = texture(depthFrame, vec2(0.5, 0.5)).r;
|
||||
float blurAmount = clamp((depth - DOF_DEPTH - focusDepth) / DOF_FALLOFF, 0.0, 1.0);
|
||||
pixelColor = pixelColor * blurAmount + renderColor * (1.0 - blurAmount);
|
||||
#endif
|
||||
|
||||
@@ -160,7 +161,7 @@ void main()
|
||||
// ---- VIDEO_BG END ----
|
||||
|
||||
#if VOLUMETRIC_ENVIRONMENT_DOWNSAMPLED == 1
|
||||
pixelColor += texture2D(volumetricEnvironmentFrame, textureCoordinate);
|
||||
pixelColor += texture(volumetricEnvironmentFrame, textureCoordinate);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -177,13 +178,13 @@ void main()
|
||||
pixelColor.rgb = mix(pixelColor.rgb, fade_color.rgb, fade_color.a);
|
||||
#endif
|
||||
|
||||
gl_FragColor = pixelColor;
|
||||
|
||||
colorOut = pixelColor;
|
||||
|
||||
//PASSTHROUGH STATEMENT
|
||||
// gl_FragColor = texture2D(depthFrame, textureCoordinate);
|
||||
// colorOut = texture(depthFrame, textureCoordinate);
|
||||
|
||||
//gl_FragColor = vec4(vec3(blurAmount), 1.0);
|
||||
|
||||
//colorOut = vec4(vec3(blurAmount), 1.0);
|
||||
|
||||
colorOut = vec4(0.0, 0.0, 1.0, 1.0); // FINDME, KIP!!, HACK!!
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
uniform mediump vec2 viewport_downsample;
|
||||
attribute vec4 vertex_position;
|
||||
attribute lowp vec4 vertex_uv;
|
||||
uniform vec2 viewport_downsample;
|
||||
in vec4 vertex_position;
|
||||
in vec4 vertex_uv;
|
||||
|
||||
varying mediump vec2 textureCoordinate;
|
||||
out vec2 textureCoordinate;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
//varying mediump vec2 texCoord;
|
||||
//in mediump vec2 texCoord;
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
colorOut = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#define SHADOW_BIAS 0.01
|
||||
|
||||
|
||||
attribute highp vec4 vertex_position;
|
||||
in highp vec4 vertex_position;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
|
||||
void main()
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
varying mediump vec2 textureCoordinate;
|
||||
out vec4 colorOut;
|
||||
|
||||
in mediump vec2 textureCoordinate;
|
||||
|
||||
uniform sampler2D diffuseTexture;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 font_color = texture2D(diffuseTexture, textureCoordinate);
|
||||
gl_FragColor = vec4(font_color.r, font_color.g, font_color.b, font_color.r + 0.50);
|
||||
vec4 font_color = texture(diffuseTexture, textureCoordinate);
|
||||
colorOut = vec4(font_color.r, font_color.g, font_color.b, font_color.r + 0.50);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
varying mediump vec2 textureCoordinate;
|
||||
out mediump vec2 textureCoordinate;
|
||||
|
||||
attribute vec4 vertex_position;
|
||||
attribute lowp vec2 vertex_uv;
|
||||
in vec4 vertex_position;
|
||||
in lowp vec2 vertex_uv;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
|
||||
void main()
|
||||
|
||||
@@ -31,13 +31,15 @@
|
||||
|
||||
//#extension GL_EXT_shadow_samplers : require
|
||||
|
||||
varying mediump vec2 texCoord;
|
||||
out vec4 colorOut;
|
||||
|
||||
varying mediump vec4 shadowMapCoord1;
|
||||
in mediump vec2 texCoord;
|
||||
|
||||
in mediump vec4 shadowMapCoord1;
|
||||
uniform sampler2DShadow shadowTexture1;
|
||||
uniform mediump vec3 light_color;
|
||||
varying lowp float intensity_modulate;
|
||||
in lowp float intensity_modulate;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1) * max(1.0 - texCoord.x*texCoord.x-texCoord.y*texCoord.y, 0.0) * intensity_modulate;
|
||||
colorOut = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1) * max(1.0 - texCoord.x*texCoord.x-texCoord.y*texCoord.y, 0.0) * intensity_modulate;
|
||||
}
|
||||
@@ -29,19 +29,19 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute mediump vec2 vertex_uv;
|
||||
in mediump vec2 vertex_uv;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
uniform mediump vec4 viewport;
|
||||
uniform mediump float flare_size;
|
||||
attribute vec4 vertex_position;
|
||||
in vec4 vertex_position;
|
||||
uniform highp vec3 particle_origin;
|
||||
|
||||
uniform highp mat4 shadow_mvp1;
|
||||
varying mediump vec4 shadowMapCoord1;
|
||||
out mediump vec4 shadowMapCoord1;
|
||||
|
||||
varying mediump vec2 texCoord;
|
||||
out mediump vec2 texCoord;
|
||||
uniform highp float time_absolute;
|
||||
varying lowp float intensity_modulate;
|
||||
out lowp float intensity_modulate;
|
||||
|
||||
void main() {
|
||||
highp vec4 offset_center = vertex_position + vec4(particle_origin, 0.0);
|
||||
|
||||
@@ -29,10 +29,12 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
varying mediump vec2 texCoord;
|
||||
out vec4 colorOut;
|
||||
|
||||
in vec2 texCoord;
|
||||
uniform sampler2D diffuseTexture;
|
||||
uniform lowp float material_alpha;
|
||||
uniform float material_alpha;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0) * material_alpha;
|
||||
colorOut = vec4(vec3(texture(diffuseTexture, texCoord)), 1.0) * material_alpha;
|
||||
}
|
||||
@@ -29,12 +29,12 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute mediump vec2 vertex_uv;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
uniform mediump vec4 viewport;
|
||||
uniform mediump float flare_size;
|
||||
in vec2 vertex_uv;
|
||||
uniform mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
uniform vec4 viewport;
|
||||
uniform float flare_size;
|
||||
|
||||
varying mediump vec2 texCoord;
|
||||
out vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
texCoord = vertex_uv;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
uniform sampler2D gbuffer_frame;
|
||||
uniform sampler2D gbuffer_depth;
|
||||
@@ -37,14 +38,14 @@ uniform mediump vec4 viewport;
|
||||
void main()
|
||||
{
|
||||
lowp vec2 gbuffer_uv = vec2(gl_FragCoord.xy / viewport.zw); // FINDME, TODO - Dependent Texture Read adding latency, due to calculation of texture UV within fragment -- move to vertex shader?
|
||||
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
|
||||
lowp vec4 gbuffer_sample = texture(gbuffer_frame, gbuffer_uv);
|
||||
|
||||
mediump vec3 gbuffer_normal = normalize(2.0 * gbuffer_sample.rgb - 1.0);
|
||||
mediump float gbuffer_specular_exponent = gbuffer_sample.a * 100.0;
|
||||
|
||||
mediump vec3 view_space_vertex_position = vec3(
|
||||
((2.0 * gl_FragCoord.xy) - (2.0 * viewport.xy)) / (viewport.zw) - 1.0,
|
||||
(2.0 * -texture2D(gbuffer_depth, gbuffer_uv).r - gl_DepthRange.near - gl_DepthRange.far) / (gl_DepthRange.far - gl_DepthRange.near)
|
||||
(2.0 * -texture(gbuffer_depth, gbuffer_uv).r - gl_DepthRange.near - gl_DepthRange.far) / (gl_DepthRange.far - gl_DepthRange.near)
|
||||
);
|
||||
|
||||
//mediump float lamberFactor = max(0.0,dot(light_direction_view_space, gbuffer_normal)) * 0.2;
|
||||
@@ -56,5 +57,5 @@ void main()
|
||||
specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent);
|
||||
|
||||
|
||||
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_intensity;
|
||||
colorOut = vec4(light_color * lamberFactor, specularFactor) * light_intensity;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute vec4 vertex_position;
|
||||
in vec4 vertex_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
uniform sampler2D gbuffer_frame;
|
||||
uniform sampler2D gbuffer_depth;
|
||||
@@ -43,14 +44,14 @@ void main()
|
||||
{
|
||||
|
||||
lowp vec2 gbuffer_uv = vec2(gl_FragCoord.xy / viewport.zw); // FINDME, TODO - Dependent Texture Read adding latency, due to calculation of texture UV within fragment -- move to vertex shader?
|
||||
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
|
||||
lowp vec4 gbuffer_sample = texture(gbuffer_frame, gbuffer_uv);
|
||||
|
||||
mediump vec3 gbuffer_normal = normalize(2.0 * gbuffer_sample.rgb - 1.0);
|
||||
mediump float gbuffer_specular_exponent = gbuffer_sample.a * 100.0;
|
||||
|
||||
mediump vec4 clip_space_vertex_position = vec4(
|
||||
gl_FragCoord.xy / viewport.zw * 2.0 - 1.0,
|
||||
texture2D(gbuffer_depth, gbuffer_uv).r * 2.0 - 1.0,
|
||||
texture(gbuffer_depth, gbuffer_uv).r * 2.0 - 1.0,
|
||||
1.0
|
||||
);
|
||||
|
||||
@@ -69,5 +70,5 @@ void main()
|
||||
specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent);
|
||||
//}
|
||||
|
||||
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_attenuation;
|
||||
colorOut = vec4(light_color * lamberFactor, specularFactor) * light_attenuation;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute vec4 vertex_position;
|
||||
in vec4 vertex_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
uniform sampler2D gbuffer_frame;
|
||||
uniform sampler2D gbuffer_depth;
|
||||
@@ -43,14 +44,14 @@ void main()
|
||||
{
|
||||
|
||||
lowp vec2 gbuffer_uv = vec2(gl_FragCoord.xy / viewport.zw); // FINDME, TODO - Dependent Texture Read adding latency, due to calculation of texture UV within fragment -- move to vertex shader?
|
||||
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
|
||||
lowp vec4 gbuffer_sample = texture(gbuffer_frame, gbuffer_uv);
|
||||
|
||||
mediump vec3 gbuffer_normal = normalize(2.0 * gbuffer_sample.rgb - 1.0);
|
||||
mediump float gbuffer_specular_exponent = gbuffer_sample.a * 100.0;
|
||||
|
||||
mediump vec4 clip_space_vertex_position = vec4(
|
||||
gl_FragCoord.xy / viewport.zw * 2.0 - 1.0,
|
||||
texture2D(gbuffer_depth, gbuffer_uv).r * 2.0 - 1.0,
|
||||
texture(gbuffer_depth, gbuffer_uv).r * 2.0 - 1.0,
|
||||
1.0
|
||||
);
|
||||
|
||||
@@ -69,5 +70,5 @@ void main()
|
||||
specularFactor = pow(dot(halfVec,gbuffer_normal), gbuffer_specular_exponent);
|
||||
//}
|
||||
|
||||
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_attenuation;
|
||||
colorOut = vec4(light_color * lamberFactor, specularFactor) * light_attenuation;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute vec4 vertex_position;
|
||||
in vec4 vertex_position;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
|
||||
void main()
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
void main() {
|
||||
//gl_FragColor = vec4(0.00, 0.00, 0.00, 0.00);
|
||||
gl_FragColor = vec4(0.00, 0.00, 0.00, 0.00);
|
||||
//colorOut = vec4(0.00, 0.00, 0.00, 0.00);
|
||||
colorOut = vec4(0.00, 0.00, 0.00, 0.00);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute vec4 vertex_position;
|
||||
in vec4 vertex_position;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
|
||||
void main()
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
varying mediump vec2 textureCoordinate;
|
||||
out vec4 colorOut;
|
||||
|
||||
in mediump vec2 textureCoordinate;
|
||||
|
||||
uniform sampler2D diffuseTexture;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(diffuseTexture, textureCoordinate);
|
||||
colorOut = texture(diffuseTexture, textureCoordinate);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
varying mediump vec2 textureCoordinate;
|
||||
out mediump vec2 textureCoordinate;
|
||||
|
||||
attribute vec4 vertex_position;
|
||||
attribute lowp vec4 vertex_uv;
|
||||
in vec4 vertex_position;
|
||||
in lowp vec4 vertex_uv;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
|
||||
void main()
|
||||
|
||||
@@ -29,10 +29,12 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
uniform samplerCube diffuseTexture;
|
||||
|
||||
varying mediump vec3 texCoord;
|
||||
in mediump vec3 texCoord;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = textureCube(diffuseTexture, normalize(texCoord));
|
||||
colorOut = textureCube(diffuseTexture, normalize(texCoord));
|
||||
}
|
||||
@@ -30,12 +30,9 @@
|
||||
//
|
||||
//
|
||||
|
||||
attribute vec4 vertex_position;
|
||||
//attribute lowp vec4 vertex_uv;
|
||||
//
|
||||
//varying mediump vec2 textureCoordinate;
|
||||
in vec4 vertex_position;
|
||||
|
||||
varying mediump vec3 texCoord;
|
||||
out mediump vec3 texCoord;
|
||||
uniform highp mat4 inv_mvp_matrix_no_translate; // Inverse of the model-view-projection matrix, without view translation component
|
||||
uniform mediump vec4 viewport;
|
||||
|
||||
|
||||
@@ -29,10 +29,12 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
varying mediump vec2 texCoord;
|
||||
out vec4 colorOut;
|
||||
|
||||
in mediump vec2 texCoord;
|
||||
uniform sampler2D diffuseTexture;
|
||||
uniform lowp float material_alpha;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vec4(vec3(texture2D(diffuseTexture, texCoord)), 1.0) * material_alpha;
|
||||
colorOut = vec4(vec3(texture(diffuseTexture, texCoord)), 1.0) * material_alpha;
|
||||
}
|
||||
@@ -29,11 +29,11 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute mediump vec2 vertex_uv;
|
||||
in mediump vec2 vertex_uv;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
uniform mediump vec4 viewport;
|
||||
|
||||
varying mediump vec2 texCoord;
|
||||
out mediump vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
texCoord = vertex_uv;
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
out vec4 colorOut;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vec4(0.0, 0.05, 0.05, 0.0);
|
||||
colorOut = vec4(0.0, 0.05, 0.05, 0.0);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute vec4 vertex_position;
|
||||
in vec4 vertex_position;
|
||||
uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying the model, view, and projection matrices
|
||||
|
||||
void main()
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
varying mediump vec4 shadowMapCoord1;
|
||||
out vec4 colorOut;
|
||||
|
||||
in mediump vec4 shadowMapCoord1;
|
||||
uniform sampler2DShadow shadowTexture1;
|
||||
uniform lowp sampler2D depthFrame;
|
||||
uniform mediump vec4 viewport;
|
||||
@@ -33,7 +35,7 @@ uniform mediump vec3 light_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
if(gl_FragCoord.z > texture2D(depthFrame, vec2(gl_FragCoord.xy / viewport.zw)).r) discard;
|
||||
if(gl_FragCoord.z > texture(depthFrame, vec2(gl_FragCoord.xy / viewport.zw)).r) discard;
|
||||
|
||||
gl_FragColor = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1);
|
||||
colorOut = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1);
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute highp vec4 vertex_position;
|
||||
in highp vec4 vertex_position;
|
||||
uniform highp mat4 inv_mvp_matrix;
|
||||
|
||||
uniform highp vec2 slice_depth_scale; // First component is the depth for the nearest plane, in view space. Second component is the distance between planes, in view space
|
||||
|
||||
uniform highp mat4 shadow_mvp1;
|
||||
varying mediump vec4 shadowMapCoord1;
|
||||
out mediump vec4 shadowMapCoord1;
|
||||
|
||||
uniform highp mat4 projection_matrix;
|
||||
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
varying mediump vec4 shadowMapCoord1;
|
||||
out vec4 colorOut;
|
||||
|
||||
in mediump vec4 shadowMapCoord1;
|
||||
uniform sampler2DShadow shadowTexture1;
|
||||
uniform mediump vec3 light_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1);
|
||||
colorOut = vec4(light_color, 1.0) * shadow2DProj(shadowTexture1, shadowMapCoord1);
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
attribute highp vec4 vertex_position;
|
||||
in highp vec4 vertex_position;
|
||||
uniform highp mat4 inv_mvp_matrix;
|
||||
|
||||
uniform highp vec2 slice_depth_scale; // First component is the depth for the nearest plane, in view space. Second component is the distance between planes, in view space
|
||||
|
||||
uniform highp mat4 shadow_mvp1;
|
||||
varying mediump vec4 shadowMapCoord1;
|
||||
out mediump vec4 shadowMapCoord1;
|
||||
|
||||
uniform highp mat4 projection_matrix;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user