add 'u_alphaClip' to the blocks shader
This commit is contained in:
@@ -9,14 +9,14 @@ uniform samplerCube u_cubemap;
|
|||||||
uniform vec3 u_fogColor;
|
uniform vec3 u_fogColor;
|
||||||
uniform float u_fogFactor;
|
uniform float u_fogFactor;
|
||||||
uniform float u_fogCurve;
|
uniform float u_fogCurve;
|
||||||
|
uniform bool u_alphaClip;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec3 fogColor = texture(u_cubemap, a_dir).rgb;
|
vec3 fogColor = texture(u_cubemap, a_dir).rgb;
|
||||||
vec4 tex_color = texture(u_texture0, a_texCoord);
|
vec4 tex_color = texture(u_texture0, a_texCoord);
|
||||||
float depth = (a_distance/256.0);
|
float depth = (a_distance/256.0);
|
||||||
float alpha = a_color.a * tex_color.a;
|
float alpha = a_color.a * tex_color.a;
|
||||||
// anyway it's any alpha-test alternative required
|
if (u_alphaClip && alpha < 0.9f)
|
||||||
if (alpha < 0.3f)
|
|
||||||
discard;
|
discard;
|
||||||
f_color = mix(a_color * tex_color, vec4(fogColor,1.0),
|
f_color = mix(a_color * tex_color, vec4(fogColor,1.0),
|
||||||
min(1.0, pow(depth*u_fogFactor, u_fogCurve)));
|
min(1.0, pow(depth*u_fogFactor, u_fogCurve)));
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ void ChunksRenderer::drawChunks(
|
|||||||
bool culling = settings.graphics.frustumCulling.get();
|
bool culling = settings.graphics.frustumCulling.get();
|
||||||
|
|
||||||
visibleChunks = 0;
|
visibleChunks = 0;
|
||||||
|
shader.uniform1i("u_alphaClip", true);
|
||||||
//if (GLEW_ARB_multi_draw_indirect && false) {
|
//if (GLEW_ARB_multi_draw_indirect && false) {
|
||||||
// TODO: implement Multi Draw Indirect chunks draw
|
// TODO: implement Multi Draw Indirect chunks draw
|
||||||
//} else {
|
//} else {
|
||||||
@@ -232,6 +233,7 @@ void ChunksRenderer::drawSortedMeshes(const Camera& camera, Shader& shader) {
|
|||||||
|
|
||||||
atlas.getTexture()->bind();
|
atlas.getTexture()->bind();
|
||||||
shader.uniformMatrix("u_model", glm::mat4(1.0f));
|
shader.uniformMatrix("u_model", glm::mat4(1.0f));
|
||||||
|
shader.uniform1i("u_alphaClip", false);
|
||||||
|
|
||||||
for (const auto& index : indices) {
|
for (const auto& index : indices) {
|
||||||
const auto& chunk = chunks[index.index];
|
const auto& chunk = chunks[index.index];
|
||||||
|
|||||||
Reference in New Issue
Block a user