commit f6cac1f6ef3f56384b72010cbebf0d850fb43675
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Fri Nov 18 17:17:25 2016 +0000

    rearrange comments

diff --git a/src/main/res/raw/main_vertex_shader.glsl b/src/main/res/raw/main_vertex_shader.glsl
index ed65634..0d34baf 100644
--- a/src/main/res/raw/main_vertex_shader.glsl
+++ b/src/main/res/raw/main_vertex_shader.glsl
@@ -17,32 +17,32 @@
 // along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                       //
 //////////////////////////////////////////////////////////////////////////////////////////////
 
-uniform vec3 u_objD;                      // half of object width x half of object height X half the depth;
-                                          // point (0,0,0) is the center of the object
+uniform vec3 u_objD;                 // half of object width x half of object height X half the depth;
+                                     // point (0,0,0) is the center of the object
 
-uniform float u_Depth;                    // max absolute value of v.z ; beyond that the vertex would be culled by the near or far planes.
-                                          // I read OpenGL ES has a built-in uniform variable gl_DepthRange.near = n, 
-                                          // .far = f, .diff = f-n so maybe u_Depth is redundant
-                                          // Update: this struct is only available in fragment shaders
+uniform float u_Depth;               // max absolute value of v.z ; beyond that the vertex would be culled by the near or far planes.
+                                     // I read OpenGL ES has a built-in uniform variable gl_DepthRange.near = n,
+                                     // .far = f, .diff = f-n so maybe u_Depth is redundant
+                                     // Update: this struct is only available in fragment shaders
                                 
-uniform mat4 u_MVPMatrix;                 // A constant representing the combined model/view/projection matrix.      		       
-uniform mat4 u_MVMatrix;                  // A constant representing the combined model/view matrix.       		
+uniform mat4 u_MVPMatrix;            // A constant representing the combined model/view/projection matrix.
+uniform mat4 u_MVMatrix;             // A constant representing the combined model/view matrix.
 		 
-attribute vec3 a_Position;                // Per-vertex position information we will pass in.   				
-attribute vec3 a_Normal;                  // Per-vertex normal information we will pass in.
-attribute vec2 a_TexCoordinate;           // Per-vertex texture coordinate information we will pass in. 		
+attribute vec3 a_Position;           // Per-vertex position information we will pass in.
+attribute vec3 a_Normal;             // Per-vertex normal information we will pass in.
+attribute vec2 a_TexCoordinate;      // Per-vertex texture coordinate information we will pass in.
 		  
-varying vec3 v_Position;                  //      		
-varying vec3 v_Normal;                    //
-varying vec2 v_TexCoordinate;             //  		
+varying vec3 v_Position;             //
+varying vec3 v_Normal;               //
+varying vec2 v_TexCoordinate;        //
 
-uniform int vNumEffects;                  // total number of vertex effects
+uniform int vNumEffects;             // total number of vertex effects
 
 #if NUM_VERTEX>0
-uniform int vType[NUM_VERTEX];            // their types.
-uniform vec4 vUniforms[3*NUM_VERTEX];     // i-th effect is 3 consecutive vec4's: [3*i], [3*i+1], [3*i+2].
-                                          // The first vec4 is the Interpolated values,
-                                          // next is half cache half Center, the third -  the Region.
+uniform int vType[NUM_VERTEX];       // their types.
+uniform vec4 vUniforms[3*NUM_VERTEX];// i-th effect is 3 consecutive vec4's: [3*i], [3*i+1], [3*i+2].
+                                     // The first vec4 is the Interpolated values,
+                                     // next is half cache half Center, the third -  the Region.
 #endif
 
 #if NUM_VERTEX>0
@@ -163,38 +163,46 @@ void restrictZ(inout float v)
 //
 // Deform the whole shape of the Object by force V
 // 
-// If the point of application (Sx,Sy) is on the edge of the Object, then:
+// If the point of application (Sx,Sy) is on the upper edge of the Object, then:
 // a) ignore Vz
 // b) change shape of the whole Object in the following way:
-//    Suppose the upper-left corner of the Object rectangle is point L, upper-right - R, force vector V is applied to point M on the upper edge,
-//    width of the Object = w, height = h, |LM| = Wl, |MR| = Wr, force vector V=(Vx,Vy). Also let H = h/(h+Vy)
+//    Suppose the upper-left corner of the Object rectangle is point L, upper-right - R, force vector V
+//    is applied to point M on the upper edge, width of the Object = w, height = h, |LM| = Wl, |MR| = Wr,
+//    force vector V=(Vx,Vy). Also let H = h/(h+Vy)
 //
 //    Let now L' and R' be points such that vec(LL') = Wr/w * vec(V) and vec(RR') = Wl/w * vec(V)
 //    now let Vl be a point on the line segment L --> M+vec(V) such that Vl(y) = L'(y)
 //    and let Vr be a point on the line segment R --> M+vec(V) such that Vr(y) = R'(y)
 //    
-//    Now define points Fl and Fr, the points L and R will be moved to under force V, with Fl(y)=L'(y) and Fr(y)=R'(y) and |VrFr|/|VrR'| = |VlFl|/|VlL'| = H
+//    Now define points Fl and Fr, the points L and R will be moved to under force V, with Fl(y)=L'(y)
+//    and Fr(y)=R'(y) and |VrFr|/|VrR'| = |VlFl|/|VlL'| = H
 //    Now notice that |VrR'| = |VlL'| = Wl*Wr / w   ( a little geometric puzzle! )
 //
 //    Then points L,R under force V move by vectors vec(Fl), vec(Fr) where
 //    vec(Fl) = (Wr/w) * [ (Vx+Wl)-Wl*H, Vy ] = (Wr/w) * [ Wl*Vy / (h+Vy) + Vx, Vy ]
 //    vec(Fr) = (Wl/w) * [ (Vx-Wr)+Wr*H, Vy ] = (Wl/w) * [-Wr*Vy / (h+Vy) + Vx, Vy ]
 //
-//    Lets now denote M+vec(V) = M'. The line segment LMR gets distorted to the curve Fl-M'-Fr. Let's now arbitrarilly decide that:
+//    Lets now denote M+vec(V) = M'. The line segment LMR gets distorted to the curve Fl-M'-Fr. Let's
+//    now arbitrarilly decide that:
 //    a) at point Fl the curve has to be parallel to line LM'
 //    b) at point M' - to line LR
 //    c) at point Fr - to line M'R
 //
-//    Now if Fl=(flx,fly) , M'=(mx,my) , Fr=(frx,fry); direction vector at Fl is (vx,vy) and at M' is (+c,0) where +c is some positive constant, then 
-//    the parametric equations of the Fl--->M' section of the curve (which has to satisfy (X(0),Y(0)) = Fl, (X(1),Y(1))=M', (X'(0),Y'(0)) = (vx,vy), (X'(1),Y'(1)) = (+c,0)) is
+//    Now if Fl=(flx,fly) , M'=(mx,my) , Fr=(frx,fry); direction vector at Fl is (vx,vy) and at M'
+//    is (+c,0) where +c is some positive constant, then  the parametric equations of the Fl--->M'
+//    section of the curve (which has to satisfy (X(0),Y(0)) = Fl, (X(1),Y(1))=M',
+//    (X'(0),Y'(0)) = (vx,vy), (X'(1),Y'(1)) = (+c,0) ) is
 //
 //    X(t) = ( (mx-flx)-vx )t^2 + vx*t + flx                                  (*)
 //    Y(t) = ( vy - 2(my-fly) )t^3 + ( 3(my-fly) -2vy )t^2 + vy*t + fly
 //
-//    Here we have to have X'(1) = 2(mx-flx)-vx which is positive <==> vx<2(mx-flx). We also have to have vy<2(my-fly) so that Y'(t)>0 (this is a must otherwise we have local loops!) 
-//    Similarly for the Fr--->M' part of the curve we have the same equation except for the fact that this time we have to have X'(1)<0 so now we have to have vx>2(mx-flx).
+//    Here we have to have X'(1) = 2(mx-flx)-vx which is positive <==> vx<2(mx-flx). We also have to
+//    have vy<2(my-fly) so that Y'(t)>0 (this is a must otherwise we have local loops!)
+//    Similarly for the Fr--->M' part of the curve we have the same equation except for the fact that
+//    this time we have to have X'(1)<0 so now we have to have vx>2(mx-flx).
 //
-//    If we are stretching the left or right edge of the bitmap then the only difference is that we have to have (X'(1),Y'(1)) = (0,+-c) with + or - c depending on which part of the curve
+//    If we are stretching the left or right edge of the bitmap then the only difference is that we
+//    have to have (X'(1),Y'(1)) = (0,+-c) with + or - c depending on which part of the curve
 //    we are tracing. Then the parametric equation is
 //
 //    X(t) = ( vx - 2(mx-flx) )t^3 + ( 3(mx-flx) -2vx )t^2 + vx*t + flx
@@ -202,8 +210,9 @@ void restrictZ(inout float v)
 //
 //    If we are dragging the top edge:    
 //
-//    Now point (x,u_objD.x) on the top edge will move by vector (X(t),Y(t)) where those functions are given by (*) and
-//    t =  x < dSx ? (u_objD.x+x)/(u_objD.x+dSx) : (u_objD.x-x)/(u_objD.x-dSx)    (this is 'vec2 time' below in the code)
+//    Now point (x,u_objD.x) on the top edge will move by vector (X(t),Y(t)) where those functions
+//    are given by (*) and t =  x < dSx ? (u_objD.x+x)/(u_objD.x+dSx) : (u_objD.x-x)/(u_objD.x-dSx)
+//    (this is 'vec2 time' below in the code).
 //    Any point (x,y) will move by vector (a*X(t),a*Y(t)) where a is (y+u_objD.y)/(2*u_objD.y)
   
 void deform(in int effect, inout vec4 v)
