commit 71c3fecc7239b56533dd219d990b3e3dbe8a29b5
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Wed Dec 7 12:11:28 2016 +0000

    Javadoc

diff --git a/src/main/java/org/distorted/library/DistortedFramebuffer.java b/src/main/java/org/distorted/library/DistortedFramebuffer.java
index 158212f..59356be 100644
--- a/src/main/java/org/distorted/library/DistortedFramebuffer.java
+++ b/src/main/java/org/distorted/library/DistortedFramebuffer.java
@@ -28,11 +28,11 @@ import java.util.LinkedList;
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Class which represents a OpenGL Framebuffer object.
- *
+ * <p>
  * User is able to create either WRITE-only Framebuffers from objects already constructed outside
  * of the library (the first constructor; primary use case: the screen) or an offscreen READ-WRITE
  * FBOs (used by the DistortedNode, but also can be used by external users of the library)
- *
+ * <p>
  * Also, keep all objects created in a static LinkedList. The point: we need to be able to mark
  * Framebuffers for deletion, and delete all marked objects later at a convenient time (that's
  * because we can only delete from a thread that holds the OpenGL context so here we provide a
@@ -63,18 +63,17 @@ public class DistortedFramebuffer
 
   private void createProjection()
     {
-    float ratio  = (float) mWidth / mHeight;
-    float left   =-ratio;          //
-    float right  = ratio;          // Create a new perspective projection matrix.
-    float bottom = -1.0f;          //
-    float top    =  1.0f;          // any change to those values will have serious consequences!
-    float near, far;
-
     if( mFOV>0.0f )  // perspective projection
       {
-      near= (float)(top / Math.tan(mFOV*Math.PI/360));
+      float ratio  = (float) mWidth / mHeight;
+      float left   =-ratio;
+      float right  = ratio;
+      float bottom = -1.0f;
+      float top    =  1.0f;
+      float near= (float)(top / Math.tan(mFOV*Math.PI/360));
       mDistance = (int)(mHeight*near/(top-bottom));
-      far = 2*mDistance-near;
+      float far = 2*mDistance-near;
+      mDepth = (int)((far-near)/2);
 
       if( far<=0 )
         {
@@ -84,16 +83,19 @@ public class DistortedFramebuffer
       else
         Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
       }
-    else                      // parallel projection
+    else             // parallel projection
       {
-      near= (float)(top / Math.tan(Math.PI/360));
+      float left   =-mWidth/2;
+      float right  = mWidth/2;
+      float bottom =-mHeight/2;
+      float top    = mHeight/2;
+      float near= (float)(top / Math.tan(Math.PI/360));
       mDistance = (int)(mHeight*near/(top-bottom));
-      far = 2*mDistance-near;
+      float far = 2*mDistance-near;
+      mDepth = (int)((far-near)/2);
 
-      Matrix.orthoM(mProjectionMatrix, 0, -mWidth/2, mWidth/2,-mHeight/2, mHeight/2, near, far);
+      Matrix.orthoM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
       }
-
-    mDepth = (int)((far-near)/2);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -257,8 +259,8 @@ public class DistortedFramebuffer
  * Create new Projection matrix.
  *
  * @param fov Vertical 'field of view' of the Projection frustrum (in degrees).
- * @param x X-coordinate of the point at which our camera looks at. -1<x<1
- * @param y Y-coordinate of the point at which our camera looks at. -1<y<1
+ * @param x X-coordinate of the point at which our camera looks at. -mWidth/2 &lt; x &lt; mWidth/2
+ * @param y Y-coordinate of the point at which our camera looks at. -mHeight/2 &lt; y &lt; mHeight/2
  */
   public void setProjection(float fov, float x, float y)
     {
@@ -276,7 +278,7 @@ public class DistortedFramebuffer
  * As the Framebuffer is not created until the first render, typical usage of this API is actually
  * to set the size of an not-yet-created Framebuffer of an object that has been created with the
  * second constructor.
- *
+ * <p>
  * Fully creating an object, rendering to it, then resizing mid-render is also possible.
  *
  * @param width The new width.
@@ -300,7 +302,7 @@ public class DistortedFramebuffer
  * Set this as the Framebuffer to write to.
  */
 
-  public void setOutput()
+  public void setAsOutput()
     {
     if( texIds[0]==TEXTURE_NOT_CREATED_YET ) createFBO();
 
@@ -312,7 +314,7 @@ public class DistortedFramebuffer
  * Set this as the Framebuffer to read from.
  */
 
-  public void setInput()
+  public void setAsInput()
     {
     if( texIds[0]==TEXTURE_NOT_CREATED_YET ) createFBO();
 
diff --git a/src/main/java/org/distorted/library/DistortedNode.java b/src/main/java/org/distorted/library/DistortedNode.java
index 8b57aac..b932db9 100644
--- a/src/main/java/org/distorted/library/DistortedNode.java
+++ b/src/main/java/org/distorted/library/DistortedNode.java
@@ -93,7 +93,7 @@ public class DistortedNode
       if( !mData.mRendered )
         {
         mData.mRendered = true;
-        mData.mDF.setOutput();
+        mData.mDF.setAsOutput();
 
         GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
         GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
@@ -113,8 +113,8 @@ public class DistortedNode
           }
         }
 
-      df.setOutput();
-      mData.mDF.setInput();
+      df.setAsOutput();
+      mData.mDF.setAsInput();
       }
     
     mObject.drawPriv(currTime, df);
