-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref_gl: introduce gl2_shim based on vgl_shim for future limited core/…
…gles context support (SLOW, still needs ffp for matrix operations)
- Loading branch information
Dmitry Toroshchin
committed
Oct 4, 2023
1 parent
2fdd080
commit 83b284f
Showing
10 changed files
with
852 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
R"( | ||
precision mediump float; | ||
#if ATTR_TEXCOORD0 | ||
uniform sampler2D uTex0; | ||
#endif | ||
#if ATTR_TEXCOORD1 | ||
uniform sampler2D uTex1; | ||
#endif | ||
#if FEAT_ALPHA_TEST | ||
uniform float uAlphaTest; | ||
#endif | ||
#if FEAT_FOG | ||
uniform vec4 uFog; | ||
#endif | ||
uniform vec4 uColor; | ||
#if ATTR_COLOR | ||
in vec4 vColor; | ||
#endif | ||
#if ATTR_TEXCOORD0 | ||
in vec2 vTexCoord0; | ||
#endif | ||
#if ATTR_TEXCOORD1 | ||
in vec2 vTexCoord1; | ||
#endif | ||
#if ATTR_NORMAL | ||
in vec2 vNormal; | ||
#endif | ||
out vec4 oFragColor; | ||
void main() | ||
{ | ||
#if ATTR_COLOR | ||
vec4 c = vColor; | ||
#else | ||
vec4 c = uColor; | ||
#endif | ||
#if ATTR_TEXCOORD0 | ||
c = c * texture(uTex0, vTexCoord0); | ||
#endif | ||
#if ATTR_TEXCOORD1 | ||
c = c * texture(uTex1, vTexCoord1); | ||
#endif | ||
#if FEAT_ALPHA_TEST | ||
if(c.a <= uAlphaTest) | ||
discard; | ||
#endif | ||
#if FEAT_FOG | ||
float fogDist = gl_FragCoord.z / gl_FragCoord.w; | ||
float fogRate = clamp(exp(-uFog.w * fogDist), 0.f, 1.f); | ||
c.rgb = mix(uFog.rgb, c.rgb, fogRate); | ||
#endif | ||
oFragColor = c; | ||
} | ||
)" |
Oops, something went wrong.