mittorn
1 year ago
committed by
Alibek Omarov
2 changed files with 118 additions and 125 deletions
@ -1,69 +1,65 @@ |
|||||||
R"( |
"#if VER <= 300\n" |
||||||
|
"#define layout(x)\n" |
||||||
|
"#endif\n" |
||||||
#if VER <= 300 |
"#if VER < 300\n" |
||||||
#define layout(x) |
"#define out attribute\n" |
||||||
#endif |
"#define in varying\n" |
||||||
#if VER < 300 |
"#define texture texture2D\n" |
||||||
#define out attribute |
"#endif\n" |
||||||
#define in varying |
"#if VER >= 130\n" |
||||||
#define texture texture2D |
"precision mediump float;\n" |
||||||
#endif |
"#endif\n" |
||||||
#if VER >= 130 |
"#if ATTR_TEXCOORD0\n" |
||||||
precision mediump float; |
"uniform sampler2D uTex0;\n" |
||||||
#endif |
"#endif\n" |
||||||
#if ATTR_TEXCOORD0 |
"#if ATTR_TEXCOORD1\n" |
||||||
uniform sampler2D uTex0; |
"uniform sampler2D uTex1;\n" |
||||||
#endif |
"#endif\n" |
||||||
#if ATTR_TEXCOORD1 |
"#if FEAT_ALPHA_TEST\n" |
||||||
uniform sampler2D uTex1; |
"uniform float uAlphaTest;\n" |
||||||
#endif |
"#endif\n" |
||||||
#if FEAT_ALPHA_TEST |
"#if FEAT_FOG\n" |
||||||
uniform float uAlphaTest; |
"uniform vec4 uFog;\n" |
||||||
#endif |
"#endif\n" |
||||||
#if FEAT_FOG |
"uniform vec4 uColor;\n" |
||||||
uniform vec4 uFog; |
"#if ATTR_COLOR\n" |
||||||
#endif |
"in vec4 vColor;\n" |
||||||
uniform vec4 uColor; |
"#endif\n" |
||||||
#if ATTR_COLOR |
"#if ATTR_TEXCOORD0\n" |
||||||
in vec4 vColor; |
"in vec2 vTexCoord0;\n" |
||||||
#endif |
"#endif\n" |
||||||
#if ATTR_TEXCOORD0 |
"#if ATTR_TEXCOORD1\n" |
||||||
in vec2 vTexCoord0; |
"in vec2 vTexCoord1;\n" |
||||||
#endif |
"#endif\n" |
||||||
#if ATTR_TEXCOORD1 |
"#if ATTR_NORMAL\n" |
||||||
in vec2 vTexCoord1; |
"in vec2 vNormal;\n" |
||||||
#endif |
"#endif\n" |
||||||
#if ATTR_NORMAL |
"#if VER >= 300\n" |
||||||
in vec2 vNormal; |
"out vec4 oFragColor;\n" |
||||||
#endif |
"#else\n" |
||||||
#if VER >= 300 |
"#define oFragColor gl_FragColor\n" |
||||||
out vec4 oFragColor; |
"#endif\n" |
||||||
#else |
"void main()\n" |
||||||
#define oFragColor gl_FragColor |
"{\n" |
||||||
#endif |
"#if ATTR_COLOR\n" |
||||||
void main() |
"vec4 c = vColor;\n" |
||||||
{ |
"#else\n" |
||||||
#if ATTR_COLOR |
"vec4 c = uColor;\n" |
||||||
vec4 c = vColor; |
"#endif\n" |
||||||
#else |
"#if ATTR_TEXCOORD0\n" |
||||||
vec4 c = uColor; |
"c = c * texture(uTex0, vTexCoord0);\n" |
||||||
#endif |
"#endif\n" |
||||||
#if ATTR_TEXCOORD0 |
"#if ATTR_TEXCOORD1\n" |
||||||
c = c * texture(uTex0, vTexCoord0); |
"c = c * texture(uTex1, vTexCoord1);\n" |
||||||
#endif |
"#endif\n" |
||||||
#if ATTR_TEXCOORD1 |
"#if FEAT_ALPHA_TEST\n" |
||||||
c = c * texture(uTex1, vTexCoord1); |
"if(c.a <= uAlphaTest)\n" |
||||||
#endif |
"discard;\n" |
||||||
#if FEAT_ALPHA_TEST |
"#endif\n" |
||||||
if(c.a <= uAlphaTest) |
"#if FEAT_FOG\n" |
||||||
discard; |
"float fogDist = gl_FragCoord.z / gl_FragCoord.w;\n" |
||||||
#endif |
"float fogRate = clamp(exp(-uFog.w * fogDist), 0.f, 1.f);\n" |
||||||
#if FEAT_FOG |
"c.rgb = mix(uFog.rgb, c.rgb, fogRate);\n" |
||||||
float fogDist = gl_FragCoord.z / gl_FragCoord.w; |
"#endif\n" |
||||||
float fogRate = clamp(exp(-uFog.w * fogDist), 0.f, 1.f); |
"oFragColor = c;\n" |
||||||
c.rgb = mix(uFog.rgb, c.rgb, fogRate); |
"}\n" |
||||||
#endif |
|
||||||
oFragColor = c; |
|
||||||
} |
|
||||||
)" |
|
||||||
|
@ -1,56 +1,53 @@ |
|||||||
R"( |
"#if VER <= 300\n" |
||||||
|
"#define layout(x)\n" |
||||||
#if VER <= 300 |
"#endif\n" |
||||||
#define layout(x) |
"#if VER < 300\n" |
||||||
#endif |
"#define in attribute\n" |
||||||
#if VER < 300 |
"#define out varying\n" |
||||||
#define in attribute |
"#endif\n" |
||||||
#define out varying |
"\n" |
||||||
#endif |
"layout(location = LOC_ATTR_POSITION) in vec3 inPosition;\n" |
||||||
|
"#if ATTR_COLOR\n" |
||||||
layout(location = LOC_ATTR_POSITION) in vec3 inPosition; |
"layout(location = LOC_ATTR_COLOR) in vec4 inColor;\n" |
||||||
#if ATTR_COLOR |
"#endif\n" |
||||||
layout(location = LOC_ATTR_COLOR) in vec4 inColor; |
"#if ATTR_TEXCOORD0\n" |
||||||
#endif |
"layout(location = LOC_ATTR_TEXCOORD0) in vec2 inTexCoord0;\n" |
||||||
#if ATTR_TEXCOORD0 |
"#endif\n" |
||||||
layout(location = LOC_ATTR_TEXCOORD0) in vec2 inTexCoord0; |
"#if ATTR_TEXCOORD1\n" |
||||||
#endif |
"layout(location = LOC_ATTR_TEXCOORD1) in vec2 inTexCoord1;\n" |
||||||
#if ATTR_TEXCOORD1 |
"#endif\n" |
||||||
layout(location = LOC_ATTR_TEXCOORD1) in vec2 inTexCoord1; |
"\n" |
||||||
#endif |
"#if ATTR_NORMAL\n" |
||||||
|
"in vec3 inNormal;\n" |
||||||
#if ATTR_NORMAL |
"#endif\n" |
||||||
in vec3 inNormal; |
"#if ATTR_COLOR\n" |
||||||
#endif |
"out vec4 vColor;\n" |
||||||
#if ATTR_COLOR |
"#endif\n" |
||||||
out vec4 vColor; |
"#if ATTR_TEXCOORD0\n" |
||||||
#endif |
"out vec2 vTexCoord0;\n" |
||||||
#if ATTR_TEXCOORD0 |
"#endif\n" |
||||||
out vec2 vTexCoord0; |
"#if ATTR_TEXCOORD1\n" |
||||||
#endif |
"out vec2 vTexCoord1;\n" |
||||||
#if ATTR_TEXCOORD1 |
"#endif\n" |
||||||
out vec2 vTexCoord1; |
"#if ATTR_NORMAL\n" |
||||||
#endif |
"out vec3 vNormal;\n" |
||||||
#if ATTR_NORMAL |
"#endif\n" |
||||||
out vec3 vNormal; |
"\n" |
||||||
#endif |
"uniform mat4 uMVP;\n" |
||||||
|
"\n" |
||||||
uniform mat4 uMVP; |
"void main()\n" |
||||||
|
"{\n" |
||||||
void main() |
"gl_Position = uMVP * vec4(inPosition,1.0f);\n" |
||||||
{ |
"#if ATTR_COLOR\n" |
||||||
gl_Position = uMVP * vec4(inPosition,1.0f); |
"vColor = inColor;\n" |
||||||
#if ATTR_COLOR |
"#endif\n" |
||||||
vColor = inColor; |
"#if ATTR_NORMAL\n" |
||||||
#endif |
"vNormal = inNormal;\n" |
||||||
#if ATTR_NORMAL |
"#endif\n" |
||||||
vNormal = inNormal; |
"#if ATTR_TEXCOORD0\n" |
||||||
#endif |
"vTexCoord0 = inTexCoord0;\n" |
||||||
#if ATTR_TEXCOORD0 |
"#endif\n" |
||||||
vTexCoord0 = inTexCoord0; |
"#if ATTR_TEXCOORD1\n" |
||||||
#endif |
"vTexCoord1 = inTexCoord1;\n" |
||||||
#if ATTR_TEXCOORD1 |
"#endif\n" |
||||||
vTexCoord1 = inTexCoord1; |
"}\n" |
||||||
#endif |
|
||||||
} |
|
||||||
)" |
|
||||||
|
Loading…
Reference in new issue