summaryrefslogtreecommitdiff
path: root/new_shader.gdshader
diff options
context:
space:
mode:
Diffstat (limited to 'new_shader.gdshader')
-rw-r--r--new_shader.gdshader7
1 files changed, 4 insertions, 3 deletions
diff --git a/new_shader.gdshader b/new_shader.gdshader
index 32b1f7c..e9d2a08 100644
--- a/new_shader.gdshader
+++ b/new_shader.gdshader
@@ -1,17 +1,18 @@
shader_type spatial;
uniform sampler2DArray textures : filter_nearest, source_color;
+uniform int elements_per_row;
void vertex() {
// Called for every vertex the material is visible on.
- //vec4 element = texture(textures, vec3(UV, UV2.x));
- //COLOR = element.rgba;
}
void fragment() {
// Called for every pixel the material is visible on.
- vec4 element = texture(textures, vec3(UV, UV2.x));
+ int index = int(UV2.y) * elements_per_row + int(UV2.x);
+ vec4 element = texture(textures, vec3(UV, float(index)));
ALBEDO = element.rgb;
+ //ALPHA = element.a;
}
//void light() {