commit a8537f43a99b1c270998831a0ae6af018da1f5e1
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Thu Feb 2 17:23:08 2017 +0000

    Preparation for effect-independent computation of the nermal vectors.

diff --git a/src/main/res/raw/main_vertex_shader.glsl b/src/main/res/raw/main_vertex_shader.glsl
index e1cb374..121536e 100644
--- a/src/main/res/raw/main_vertex_shader.glsl
+++ b/src/main/res/raw/main_vertex_shader.glsl
@@ -214,7 +214,7 @@ void restrictZ(inout float v)
 //        along the force line is.
 //        0<=C<1 looks completely ridiculous and C<0 destroys the system.
 
-void deform(in int effect, inout vec4 v, inout vec4 n)
+void deform(in int effect, inout vec3 v, inout vec3 n)
   {
   const vec2 ONE = vec2(1.0,1.0);
 
@@ -309,7 +309,7 @@ void deform(in int effect, inout vec4 v, inout vec4 n)
 // Thus we actually want to compute N(v.x,v.y) = a*(-(dx/|PS|)*f'(|PX|), -(dy/|PS|)*f'(|PX|), 1) and keep adding
 // the first two components. (a is the horizontal part)
         
-void distort(in int effect, inout vec4 v, inout vec4 n)
+void distort(in int effect, inout vec3 v, inout vec3 n)
   {
   vec2 center = vUniforms[effect+1].yz;
   vec2 ps = center-v.xy;
@@ -337,7 +337,7 @@ void distort(in int effect, inout vec4 v, inout vec4 n)
 // Pull P=(v.x,v.y) towards center of the effect with P' = P + (1-h)*dist(S-P)
 // when h>1 we are pushing points away from S: P' = P + (1/h-1)*dist(S-P)
  
-void sink(in int effect,inout vec4 v)
+void sink(in int effect,inout vec3 v)
   {
   vec2 center = vUniforms[effect+1].yz;
   vec2 ps = center-v.xy;
@@ -356,7 +356,7 @@ void sink(in int effect,inout vec4 v)
 // with P' = P + (1-h)*dist(line to P)
 // when h>1 we are pushing points away from S: P' = P + (1/h-1)*dist(line to P)
 
-void pinch(in int effect,inout vec4 v)
+void pinch(in int effect,inout vec3 v)
   {
   vec2 center = vUniforms[effect+1].yz;
   vec2 ps = center-v.xy;
@@ -375,7 +375,7 @@ void pinch(in int effect,inout vec4 v)
 // This effect rotates the current vertex V by vInterpolated.x radians clockwise around the circle dilated 
 // by (1-d) around the center of the effect S.
 
-void swirl(in int effect, inout vec4 v)
+void swirl(in int effect, inout vec3 v)
   {
   vec2 center  = vUniforms[effect+1].yz;
   vec2 PS = center-v.xy;
@@ -460,7 +460,7 @@ void swirl(in int effect, inout vec4 v)
 //
 // Generally speaking I'd keep to amplitude < length, as the opposite case has some other problems as well.
 
-void wave(in int effect, inout vec4 v, inout vec4 n)
+void wave(in int effect, inout vec3 v, inout vec3 n)
   {
   vec2 center     = vUniforms[effect+1].yz;
   float amplitude = vUniforms[effect  ].x;
@@ -484,7 +484,7 @@ void wave(in int effect, inout vec4 v, inout vec4 n)
 
     vec3 dir= vec3(sinB*cosA,cosB*cosA,sinA);
 
-    v.xyz += sin(angle)*deg*dir;
+    v += sin(angle)*deg*dir;
 
     if( n.z != 0.0 )
       {
@@ -529,8 +529,8 @@ void wave(in int effect, inout vec4 v, inout vec4 n)
   		  
 void main()                                                 	
   {              
-  vec4 v = vec4( 2.0*u_objD*a_Position,1.0 );
-  vec4 n = vec4(a_Normal,0.0);
+  vec3 v = 2.0*u_objD*a_Position;
+  vec3 n = a_Normal;
 
 #if NUM_VERTEX>0
   for(int i=0; i<vNumEffects; i++)
@@ -546,8 +546,8 @@ void main()
   restrictZ(v.z);
 #endif
    
-  v_Position      = v.xyz;
+  v_Position      = v;
   v_TexCoordinate = a_TexCoordinate;
-  v_Normal        = normalize(vec3(u_MVMatrix*n));
-  gl_Position     = u_MVPMatrix*v;      
+  v_Normal        = normalize(vec3(u_MVMatrix*vec4(n,0.0)));
+  gl_Position     = u_MVPMatrix*vec4(v,1.0);
   }                               
