parent
6931979b8e
commit
5b2ad9b5f1
|
@ -211,7 +211,6 @@ add_resources(
|
||||||
shaders/imesh_point.vert
|
shaders/imesh_point.vert
|
||||||
shaders/imesh_tex.frag
|
shaders/imesh_tex.frag
|
||||||
shaders/imesh_texa.frag
|
shaders/imesh_texa.frag
|
||||||
shaders/imesh_texr.frag
|
|
||||||
shaders/imesh_tex.vert
|
shaders/imesh_tex.vert
|
||||||
shaders/mesh.frag
|
shaders/mesh.frag
|
||||||
shaders/mesh.vert
|
shaders/mesh.vert
|
||||||
|
|
|
@ -9,5 +9,5 @@ uniform sampler2D texture;
|
||||||
varying vec2 fragTex;
|
varying vec2 fragTex;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_FragColor = vec4(color.rgb, color.a * texture2D(texture, fragTex).a);
|
gl_FragColor = vec4(color.rgb, color.a * texture2D(texture, fragTex).TEX_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Indexed Mesh rendering shader
|
|
||||||
//
|
|
||||||
// Copyright 2016 Aleksey Egorov
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
uniform vec4 color;
|
|
||||||
uniform sampler2D texture;
|
|
||||||
|
|
||||||
varying vec2 fragTex;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
gl_FragColor = vec4(color.rgb, color.a * texture2D(texture, fragTex).r);
|
|
||||||
}
|
|
|
@ -7,6 +7,6 @@ uniform vec4 color;
|
||||||
uniform sampler2D texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
if(texture2D(texture, gl_FragCoord.xy / 32.0).a < 0.5) discard;
|
if(texture2D(texture, gl_FragCoord.xy / 32.0).TEX_ALPHA < 0.5) discard;
|
||||||
gl_FragColor = color;
|
gl_FragColor = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,12 +84,21 @@ static GLuint CompileShader(const std::string &res, GLenum type) {
|
||||||
// the `precision` keyword entirely, because that's clearly how minor versions work.
|
// the `precision` keyword entirely, because that's clearly how minor versions work.
|
||||||
// Christ, what a trash fire.
|
// Christ, what a trash fire.
|
||||||
|
|
||||||
std::string src(resData, size);
|
const char *prelude;
|
||||||
#if defined(HAVE_GLES)
|
#if defined(HAVE_GLES)
|
||||||
src = "#version 100\nprecision highp float;\n" + src;
|
prelude = R"(
|
||||||
|
#version 100
|
||||||
|
#define TEX_ALPHA a
|
||||||
|
precision highp float;
|
||||||
|
)";
|
||||||
#else
|
#else
|
||||||
src = "#version 120\n" + src;
|
prelude = R"(
|
||||||
|
#version 120
|
||||||
|
#define TEX_ALPHA r
|
||||||
|
)";
|
||||||
#endif
|
#endif
|
||||||
|
std::string src(resData, size);
|
||||||
|
src = prelude + src;
|
||||||
|
|
||||||
GLuint shader = glCreateShader(type);
|
GLuint shader = glCreateShader(type);
|
||||||
ssassert(shader != 0, "glCreateShader failed");
|
ssassert(shader != 0, "glCreateShader failed");
|
||||||
|
|
Loading…
Reference in New Issue