Fix 2d stippling of hovered and selected faces.

This was broken in ec07516.
pull/168/head
whitequark 2017-01-14 06:10:23 +00:00
parent 6931979b8e
commit 5b2ad9b5f1
5 changed files with 14 additions and 19 deletions

View File

@ -211,7 +211,6 @@ add_resources(
shaders/imesh_point.vert
shaders/imesh_tex.frag
shaders/imesh_texa.frag
shaders/imesh_texr.frag
shaders/imesh_tex.vert
shaders/mesh.frag
shaders/mesh.vert

View File

@ -9,5 +9,5 @@ uniform sampler2D texture;
varying vec2 fragTex;
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);
}

View File

@ -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);
}

View File

@ -7,6 +7,6 @@ uniform vec4 color;
uniform sampler2D texture;
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;
}

View File

@ -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.
// Christ, what a trash fire.
std::string src(resData, size);
const char *prelude;
#if defined(HAVE_GLES)
src = "#version 100\nprecision highp float;\n" + src;
prelude = R"(
#version 100
#define TEX_ALPHA a
precision highp float;
)";
#else
src = "#version 120\n" + src;
prelude = R"(
#version 120
#define TEX_ALPHA r
)";
#endif
std::string src(resData, size);
src = prelude + src;
GLuint shader = glCreateShader(type);
ssassert(shader != 0, "glCreateShader failed");