From 14b6f5cee8236f7c42065813c5dd6a659d4d5d65 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Sat, 19 Apr 2014 14:50:38 -0600 Subject: made shaders faster --- shaders/basic.vert | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'shaders/basic.vert') diff --git a/shaders/basic.vert b/shaders/basic.vert index e1abeb5..36e0c48 100644 --- a/shaders/basic.vert +++ b/shaders/basic.vert @@ -16,6 +16,7 @@ out vec4 position ; out vec3 normal ; out float texture_blend[8] ; +flat out int texidx ; void main() { gl_Position = pjMatrix * (position = mvMatrix * vec4(in_position,1.0)) ; @@ -23,5 +24,6 @@ void main() { normal = normalMatrix * in_normal ; for ( int i = 0 ; i < 8 ; ++ i ) texture_blend[i] = 0 ; - texture_blend[int(clamp(round(in_color.a),0,8))] = 1.0 ; + texidx = int(clamp(round(in_color.a),0,8)); + texture_blend[texidx] = 1.0 ; } -- cgit