mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-06 02:05:30 +01:00
Introduce array textures for node rendering (#16574)
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
uniform sampler2D baseTexture;
|
||||
#ifdef USE_ARRAY_TEXTURE
|
||||
uniform sampler2DArray baseTexture;
|
||||
#else
|
||||
uniform sampler2D baseTexture;
|
||||
#endif
|
||||
|
||||
uniform vec3 dayLight;
|
||||
uniform lowp vec4 fogColor;
|
||||
@@ -41,8 +45,10 @@ varying vec3 worldPosition;
|
||||
varying lowp vec4 varColor;
|
||||
#ifdef GL_ES
|
||||
varying mediump vec2 varTexCoord;
|
||||
varying float varTexLayer;
|
||||
#else
|
||||
centroid varying vec2 varTexCoord;
|
||||
centroid varying float varTexLayer; // actually int
|
||||
#endif
|
||||
varying highp vec3 eyeVec;
|
||||
varying float nightRatio;
|
||||
@@ -365,10 +371,13 @@ void main(void)
|
||||
vec3 color;
|
||||
vec2 uv = varTexCoord.st;
|
||||
|
||||
#ifdef USE_ARRAY_TEXTURE
|
||||
vec4 base = texture(baseTexture, vec3(uv, varTexLayer)).rgba;
|
||||
#else
|
||||
vec4 base = texture2D(baseTexture, uv).rgba;
|
||||
// If alpha is zero, we can just discard the pixel. This fixes transparency
|
||||
// on GPUs like GC7000L, where GL_ALPHA_TEST is not implemented in mesa,
|
||||
// and also on GLES 2, where GL_ALPHA_TEST is missing entirely.
|
||||
#endif
|
||||
|
||||
// Handle transparency by discarding pixel as appropriate.
|
||||
#ifdef USE_DISCARD
|
||||
if (base.a == 0.0)
|
||||
discard;
|
||||
|
||||
Reference in New Issue
Block a user