소스 검색

apply preferred style to com.jme3.renderer (#1653)

* coding style improvements
 + use curly braces where optional (4.1.1)
 + indent continuation lines by +8 (4.5.2)
 + no single space after an open paren or before a close paren (4.6.2)
 + no single space before an unary operator (4.6.2)
 + no single space before a square bracket (4.6.2)
 + single space before "else" (4.6.2 #2)
 + single space before an open curly brace (4.6.2 #3)
 + single space around a binary or ternary operator (4.6.2 #4)
 + single space after a comma (4.6.2 #5)

* coding style improvements:  no wildcard imports (3.3.1)

* RenderContext:  import ordering and spacing (3.3.3)

* wrap lines that exceed 110 characters

* single variable per declaration (4.8.2.1)

* Caps:  mark fallthrough with comments (4.8.4.2)

* RenderContext:  "static" before "final" (4.8.7)

* constant names use CONSTANT_CASE (5.2.4) Note: **API change**

* ignore acronyms in camel case (5.3) Note: **API change**

* improve the javadoc style:
 + paragraphs separated by a blank line (7.1.2)
 + successive paragraphs start with "<p>" (7.1.2)
 + javadoc blocks begin with a summary fragment, not a sentence (7.2)
 + summary not in imperative mood (7.2)
 + summary capitalized and punctuated like a sentence (7.2)

* Renderer:  re-order block tags (7.1.3)

* indent block-tag continuations by at least +4 (7.1.3)

* one blank line before the first block tag (7.1.3)

* correct indentation of javadoc in 2 places (7.1.1)

* TestIDList:  ignore acronyms in camel case (5.3)

* revisit the javadoc style, reverting portions of e763ecb6

* one annotation per line (4.8.5)

* add required javadoc (7.3)

* Camera:  blank line before the first block tag (7.1.2)

* Camera:  revert an unintented change

* Camera:  change "Determines" to "Returns" in 2 places

* no trailing spaces

* revert API changes

* convert comment to javadoc and add missing javadoc
Stephen Gold 3 년 전
부모
커밋
988cbd8970

+ 203 - 124
jme3-core/src/main/java/com/jme3/renderer/Camera.java

@@ -33,24 +33,33 @@ package com.jme3.renderer;
 
 import com.jme3.bounding.BoundingBox;
 import com.jme3.bounding.BoundingVolume;
-import com.jme3.export.*;
-import com.jme3.math.*;
+import com.jme3.export.InputCapsule;
+import com.jme3.export.JmeExporter;
+import com.jme3.export.JmeImporter;
+import com.jme3.export.OutputCapsule;
+import com.jme3.export.Savable;
+import com.jme3.math.FastMath;
+import com.jme3.math.Matrix4f;
+import com.jme3.math.Plane;
+import com.jme3.math.Quaternion;
+import com.jme3.math.Vector2f;
+import com.jme3.math.Vector3f;
+import com.jme3.math.Vector4f;
 import com.jme3.util.TempVars;
 import java.io.IOException;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
- * <code>Camera</code> is a standalone, purely mathematical class for doing
+ * A standalone, purely mathematical class for doing
  * camera-related computations.
  *
- * <p>
- * Given input data such as location, orientation (direction, left, up),
+ * <p>Given input data such as location, orientation (direction, left, up),
  * and viewport settings, it can compute data necessary to render objects
  * with the graphics library. Two matrices are generated, the view matrix
  * transforms objects from world space into eye space, while the projection
- * matrix transforms objects from eye space into clip space.
- * </p>
+ * matrix transforms objects from eye space into clip space.</p>
+ *
  * <p>Another purpose of the camera class is to do frustum culling operations,
  * defined by six planes which define a 3D frustum shape, it is possible to
  * test if an object bounded by a mathematically defined volume is inside
@@ -66,24 +75,23 @@ public class Camera implements Savable, Cloneable {
     private static final Logger logger = Logger.getLogger(Camera.class.getName());
 
     /**
-     * The <code>FrustumIntersect</code> enum is returned as a result
-     * of a culling check operation, 
+     * The result of a culling check operation.
      * see {@link #contains(com.jme3.bounding.BoundingVolume) }
      */
     public enum FrustumIntersect {
 
         /**
-         * defines a constant assigned to spatials that are completely outside
+         * Defines a constant assigned to spatials that are completely outside
          * of this camera's view frustum.
          */
         Outside,
         /**
-         * defines a constant assigned to spatials that are completely inside
+         * Defines a constant assigned to spatials that are completely inside
          * the camera's view frustum.
          */
         Inside,
         /**
-         * defines a constant assigned to spatials that are intersecting one of
+         * Defines a constant assigned to spatials that are intersecting one of
          * the six planes that define the view frustum.
          */
         Intersects;
@@ -121,7 +129,7 @@ public class Camera implements Savable, Cloneable {
      */
     private static final int MAX_WORLD_PLANES = 6;
     /**
-     * Camera's location
+     * Camera's location.
      */
     protected Vector3f location;
     /**
@@ -152,11 +160,21 @@ public class Camera implements Savable, Cloneable {
      * Distance from camera to bottom frustum plane.
      */
     protected float frustumBottom;
-    //Temporary values computed in onFrustumChange that are needed if a
-    //call is made to onFrameChange.
+    /**
+     * Temporary values computed in onFrustumChange that are needed if a call is made to onFrameChange.
+     */
     protected float[] coeffLeft;
+    /**
+     * Temporary values computed in onFrustumChange that are needed if a call is made to onFrameChange.
+     */
     protected float[] coeffRight;
+    /**
+     * Temporary values computed in onFrustumChange that are needed if a call is made to onFrameChange.
+     */
     protected float[] coeffBottom;
+    /**
+     * Temporary values computed in onFrustumChange that are needed if a call is made to onFrameChange.
+     */
     protected float[] coeffTop;
     //view port coordinates
     /**
@@ -188,17 +206,38 @@ public class Camera implements Savable, Cloneable {
      * children.
      */
     private int planeState;
+    /**
+     * The width of the viewport in pixels.
+     */
     protected int width;
+    /**
+     * The height of the viewport in pixels.
+     */
     protected int height;
+    /**
+     * True if the renderer needs to update its viewport boundaries.
+     */
     protected boolean viewportChanged = true;
     /**
      * store the value for field parallelProjection
      */
     private boolean parallelProjection = true;
+    /**
+     * Temporarily overrides the projection matrix.
+     */
     protected Matrix4f projectionMatrixOverride = new Matrix4f();
     private boolean overrideProjection;
+    /**
+     * Transforms world space into eye space.
+     */
     protected Matrix4f viewMatrix = new Matrix4f();
+    /**
+     * Transforms eye space into clip space, unless overridden by projectionMatrixOverride.
+     */
     protected Matrix4f projectionMatrix = new Matrix4f();
+    /**
+     * Transforms world space into clip space.
+     */
     protected Matrix4f viewProjectionMatrix = new Matrix4f();
     private BoundingBox guiBounding = new BoundingBox();
     /** The camera's name. */
@@ -215,9 +254,9 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * Constructor instantiates a new <code>Camera</code> object. All
+     * Instantiates a new <code>Camera</code> object. All
      * values of the camera are set to default.
-     * 
+     *
      * @param width the desired width (in pixels)
      * @param height the desired height (in pixels)
      */
@@ -289,10 +328,10 @@ public class Camera implements Savable, Cloneable {
             throw new AssertionError();
         }
     }
-    
+
     /**
-     * This method copies the settings of the given camera.
-     * 
+     * Copies the settings of the given camera.
+     *
      * @param cam
      *            the camera we copy the settings from
      */
@@ -323,18 +362,18 @@ public class Camera implements Savable, Cloneable {
 
         this.width = cam.width;
         this.height = cam.height;
-        
+
         this.planeState = 0;
         this.viewportChanged = true;
         for (int i = 0; i < MAX_WORLD_PLANES; ++i) {
             worldPlane[i].setNormal(cam.worldPlane[i].getNormal());
             worldPlane[i].setConstant(cam.worldPlane[i].getConstant());
         }
-        
+
         this.parallelProjection = cam.parallelProjection;
         this.overrideProjection = cam.overrideProjection;
         this.projectionMatrixOverride.set(cam.projectionMatrixOverride);
-        
+
         this.viewMatrix.set(cam.viewMatrix);
         this.projectionMatrix.set(cam.projectionMatrix);
         this.viewProjectionMatrix.set(cam.viewProjectionMatrix);
@@ -349,7 +388,8 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * This method sets the cameras name.
+     * Sets the cameras name.
+     *
      * @param name the cameras name
      */
     public void setName(String name) {
@@ -357,7 +397,8 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * This method returns the cameras name.
+     * Returns the cameras name.
+     *
      * @return the cameras name
      */
     public String getName() {
@@ -367,21 +408,24 @@ public class Camera implements Savable, Cloneable {
     /**
      * Sets a clipPlane for this camera.
      * The clipPlane is used to recompute the
-     * projectionMatrix using the plane as the near plane     
+     * projectionMatrix using the plane as the near plane
      * This technique is known as the oblique near-plane clipping method introduced by Eric Lengyel
      * more info here
      * <ul>
      * <li><a href="http://www.terathon.com/code/oblique.html">http://www.terathon.com/code/oblique.html</a>
      * <li><a href="http://aras-p.info/texts/obliqueortho.html">http://aras-p.info/texts/obliqueortho.html</a>
-     * <li><a href="http://hacksoflife.blogspot.com/2008/12/every-now-and-then-i-come-across.html">http://hacksoflife.blogspot.com/2008/12/every-now-and-then-i-come-across.html</a>
+     * <li><a href="http://hacksoflife.blogspot.com/2008/12/every-now-and-then-i-come-across.html">
+     * http://hacksoflife.blogspot.com/2008/12/every-now-and-then-i-come-across.html</a>
      * </ul>
      *
-     * Note that this will work properly only if it's called on each update, and be aware that it won't work properly with the sky bucket.
+     * <p>Note that this will work properly only if it's called on each update,
+     * and be aware that it won't work properly with the sky bucket.
      * if you want to handle the sky bucket, look at how it's done in SimpleWaterProcessor.java
+     *
      * @param clipPlane the plane
      * @param side the side the camera stands from the plane
      */
-    public void setClipPlane(Plane clipPlane, Plane.Side side) {     
+    public void setClipPlane(Plane clipPlane, Plane.Side side) {
         float sideFactor = 1;
         if (side == Plane.Side.Negative) {
             sideFactor = -1;
@@ -390,9 +434,9 @@ public class Camera implements Savable, Cloneable {
         if (clipPlane.whichSide(location) == side) {
             return;
         }
-        
+
         TempVars vars = TempVars.get();
-        try {        
+        try {
             Matrix4f p = projectionMatrixOverride.set(projectionMatrix);
 
             Matrix4f ivm = viewMatrix;
@@ -400,18 +444,20 @@ public class Camera implements Savable, Cloneable {
             Vector3f point = clipPlane.getNormal().mult(clipPlane.getConstant(), vars.vect1);
             Vector3f pp = ivm.mult(point, vars.vect2);
             Vector3f pn = ivm.multNormal(clipPlane.getNormal(), vars.vect3);
-            Vector4f clipPlaneV = vars.vect4f1.set(pn.x * sideFactor, pn.y * sideFactor, pn.z * sideFactor, -(pp.dot(pn)) * sideFactor);
-    
+            Vector4f clipPlaneV = vars.vect4f1.set(pn.x * sideFactor, pn.y * sideFactor, pn.z * sideFactor,
+                    -(pp.dot(pn)) * sideFactor);
+
             Vector4f v = vars.vect4f2.set(0, 0, 0, 0);
-    
+
             v.x = (Math.signum(clipPlaneV.x) + p.m02) / p.m00;
             v.y = (Math.signum(clipPlaneV.y) + p.m12) / p.m11;
             v.z = -1.0f;
             v.w = (1.0f + p.m22) / p.m23;
-    
-            float dot = clipPlaneV.dot(v);//clipPlaneV.x * v.x + clipPlaneV.y * v.y + clipPlaneV.z * v.z + clipPlaneV.w * v.w;
+
+            float dot = clipPlaneV.dot(v);
+            //clipPlaneV.x * v.x + clipPlaneV.y * v.y + clipPlaneV.z * v.z + clipPlaneV.w * v.w;
             Vector4f c = clipPlaneV.multLocal(2.0f / dot);
-    
+
             p.m20 = c.x - p.m30;
             p.m21 = c.y - p.m31;
             p.m22 = c.z - p.m32;
@@ -419,7 +465,7 @@ public class Camera implements Savable, Cloneable {
             setProjectionMatrix(p);
         } finally {
             vars.release();
-        }            
+        }
     }
 
     /**
@@ -428,14 +474,18 @@ public class Camera implements Savable, Cloneable {
      * This technique is known as the oblique near-plane clipping method introduced by Eric Lengyel
      * more info here
      * <ul>
-     * <li><a href="http://www.terathon.com/code/oblique.html">http://www.terathon.com/code/oblique.html</a></li>
-     * <li><a href="http://aras-p.info/texts/obliqueortho.html">http://aras-p.info/texts/obliqueortho.html</a></li>
+     * <li><a href="http://www.terathon.com/code/oblique.html">
+     * http://www.terathon.com/code/oblique.html</a></li>
+     * <li><a href="http://aras-p.info/texts/obliqueortho.html">
+     * http://aras-p.info/texts/obliqueortho.html</a></li>
      * <li><a href="http://hacksoflife.blogspot.com/2008/12/every-now-and-then-i-come-across.html">
      * http://hacksoflife.blogspot.com/2008/12/every-now-and-then-i-come-across.html</a></li>
      * </ul>
      *
-     * Note that this will work properly only if it's called on each update, and be aware that it won't work properly with the sky bucket.
+     * <p>Note that this will work properly only if it's called on each update,
+     * and be aware that it won't work properly with the sky bucket.
      * if you want to handle the sky bucket, look at how it's done in SimpleWaterProcessor.java
+     *
      * @param clipPlane the plane
      */
     public void setClipPlane(Plane clipPlane) {
@@ -443,14 +493,14 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * Resize this camera's view for the specified display size. Invoked by an
+     * Resizes this camera's view for the specified display size. Invoked by an
      * associated {@link RenderManager} to notify the camera of changes to the
      * display dimensions.
      *
      * @param width the new width of the display, in pixels
      * @param height the new height of the display, in pixels
      * @param fixAspect if true, recompute the camera's frustum to preserve its
-     * prior aspect ratio
+     *     prior aspect ratio
      */
     public void resize(int width, int height, boolean fixAspect) {
         this.width = width;
@@ -468,7 +518,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getFrustumBottom</code> returns the value of the bottom frustum
+     * Returns the value of the bottom frustum
      * plane.
      *
      * @return the value of the bottom frustum plane.
@@ -478,7 +528,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrustumBottom</code> sets the value of the bottom frustum
+     * Sets the value of the bottom frustum
      * plane.
      *
      * @param frustumBottom the value of the bottom frustum plane.
@@ -489,7 +539,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getFrustumFar</code> gets the value of the far frustum plane.
+     * Gets the value of the far frustum plane.
      *
      * @return the value of the far frustum plane.
      */
@@ -498,7 +548,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrustumFar</code> sets the value of the far frustum plane.
+     * Sets the value of the far frustum plane.
      *
      * @param frustumFar the value of the far frustum plane.
      */
@@ -508,7 +558,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getFrustumLeft</code> gets the value of the left frustum plane.
+     * Gets the value of the left frustum plane.
      *
      * @return the value of the left frustum plane.
      */
@@ -517,7 +567,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrustumLeft</code> sets the value of the left frustum plane.
+     * Sets the value of the left frustum plane.
      *
      * @param frustumLeft the value of the left frustum plane.
      */
@@ -527,7 +577,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getFrustumNear</code> gets the value of the near frustum plane.
+     * Gets the value of the near frustum plane.
      *
      * @return the value of the near frustum plane.
      */
@@ -536,7 +586,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrustumNear</code> sets the value of the near frustum plane.
+     * Sets the value of the near frustum plane.
      *
      * @param frustumNear the value of the near frustum plane.
      */
@@ -546,7 +596,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getFrustumRight</code> gets the value of the right frustum plane.
+     * Gets the value of the right frustum plane.
      *
      * @return frustumRight the value of the right frustum plane.
      */
@@ -555,7 +605,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrustumRight</code> sets the value of the right frustum plane.
+     * Sets the value of the right frustum plane.
      *
      * @param frustumRight the value of the right frustum plane.
      */
@@ -565,7 +615,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getFrustumTop</code> gets the value of the top frustum plane.
+     * Gets the value of the top frustum plane.
      *
      * @return the value of the top frustum plane.
      */
@@ -574,7 +624,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrustumTop</code> sets the value of the top frustum plane.
+     * Sets the value of the top frustum plane.
      *
      * @param frustumTop the value of the top frustum plane.
      */
@@ -632,7 +682,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getLocation</code> retrieves the location vector of the camera.
+     * Retrieves the location vector of the camera.
      *
      * @return the position of the camera.
      * @see Camera#getLocation()
@@ -642,7 +692,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getRotation</code> retrieves the rotation quaternion of the camera.
+     * Retrieves the rotation quaternion of the camera.
      *
      * @return the rotation of the camera.
      */
@@ -651,7 +701,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getDirection</code> retrieves the direction vector the camera is
+     * Retrieves the direction vector the camera is
      * facing.
      *
      * @return the direction the camera is facing.
@@ -662,7 +712,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getLeft</code> retrieves the left axis of the camera.
+     * Retrieves the left axis of the camera.
      *
      * @return the left axis of the camera.
      * @see Camera#getLeft()
@@ -672,7 +722,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getUp</code> retrieves the up axis of the camera.
+     * Retrieves the up axis of the camera.
      *
      * @return the up axis of the camera.
      * @see Camera#getUp()
@@ -682,7 +732,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getDirection</code> retrieves the direction vector the camera is
+     * Retrieves the direction vector the camera is
      * facing.
      *
      * @param store storage for the result (modified if not null)
@@ -694,7 +744,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getLeft</code> retrieves the left axis of the camera.
+     * Retrieves the left axis of the camera.
      *
      * @param store storage for the result (modified if not null)
      * @return the left axis of the camera.
@@ -705,7 +755,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getUp</code> retrieves the up axis of the camera.
+     * Retrieves the up axis of the camera.
      *
      * @param store storage for the result (modified if not null)
      * @return the up axis of the camera.
@@ -716,7 +766,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setLocation</code> sets the position of the camera.
+     * Sets the position of the camera.
      *
      * @param location the position of the camera.
      */
@@ -726,7 +776,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setRotation</code> sets the orientation of this camera. This will
+     * Sets the orientation of this camera. This will
      * be equivalent to setting each of the axes:
      * <code><br>
      * cam.setLeft(rotation.getRotationColumn(0));<br>
@@ -742,12 +792,12 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>lookAtDirection</code> sets the direction the camera is facing
+     * Sets the direction the camera is facing
      * given a direction and an up vector.
      *
      * @param direction the direction this camera is facing.
      * @param up the desired "up" direction for the camera (not null,
-     * unaffected, typically (0,1,0))
+     *     unaffected, typically (0,1,0))
      */
     public void lookAtDirection(Vector3f direction, Vector3f up) {
         this.rotation.lookAt(direction, up);
@@ -755,14 +805,14 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setAxes</code> sets the axes (left, up and direction) for this
+     * Sets the axes (left, up and direction) for this
      * camera.
      *
      * @param left      the left axis of the camera.
      * @param up        the up axis of the camera.
      * @param direction the direction the camera is facing.
-     * 
-     * @see Camera#setAxes(com.jme3.math.Quaternion) 
+     *
+     * @see Camera#setAxes(com.jme3.math.Quaternion)
      */
     public void setAxes(Vector3f left, Vector3f up, Vector3f direction) {
         this.rotation.fromAxes(left, up, direction);
@@ -770,7 +820,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setAxes</code> uses a rotational matrix to set the axes of the
+     * Uses a rotational matrix to set the axes of the
      * camera.
      *
      * @param axes the matrix that defines the orientation of the camera.
@@ -781,7 +831,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * normalize normalizes the camera vectors.
+     * Normalizes the camera vectors.
      */
     public void normalize() {
         this.rotation.normalizeLocal();
@@ -789,7 +839,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrustum</code> sets the frustum of this camera object.
+     * Sets the frustum of this camera object.
      *
      * @param near   the near plane.
      * @param far    the far plane.
@@ -813,7 +863,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrustumPerspective</code> defines the frustum for the camera.  This
+     * Defines the frustum for the camera.  This
      * frustum is defined by a viewing angle, aspect ratio, and near/far planes
      *
      * @param fovY   Frame of view angle along the Y in degrees.
@@ -845,7 +895,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrame</code> sets the orientation and location of the camera.
+     * Sets the orientation and location of the camera.
      *
      * @param location  the point position of the camera.
      * @param left      the left axis of the camera.
@@ -863,7 +913,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>lookAt</code> is a convenience method for auto-setting the frame
+     * A convenience method for auto-setting the frame
      * based on a world position the user desires the camera to look at. It
      * repoints the camera towards the given position using the difference
      * between the position and the current camera location as a direction
@@ -905,8 +955,8 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setFrame</code> sets the orientation and location of the camera.
-     * 
+     * Sets the orientation and location of the camera.
+     *
      * @param location
      *            the point position of the camera.
      * @param axes
@@ -919,7 +969,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>update</code> updates the camera parameters by calling
+     * Updates the camera parameters by calling
      * <code>onFrustumChange</code>,<code>onViewPortChange</code> and
      * <code>onFrameChange</code>.
      *
@@ -933,7 +983,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getPlaneState</code> returns the state of the frustum planes. So
+     * Returns the state of the frustum planes. So
      * checks can be made as to which frustum plane has been examined for
      * culling thus far.
      *
@@ -944,7 +994,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setPlaneState</code> sets the state to keep track of tested
+     * Sets the state to keep track of tested
      * planes for culling.
      *
      * @param planeState the updated state.
@@ -954,7 +1004,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getViewPortLeft</code> gets the left boundary of the viewport
+     * Gets the left boundary of the viewport.
      *
      * @return the left boundary of the viewport
      */
@@ -963,7 +1013,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setViewPortLeft</code> sets the left boundary of the viewport
+     * Sets the left boundary of the viewport.
      *
      * @param left the left boundary of the viewport
      */
@@ -973,7 +1023,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getViewPortRight</code> gets the right boundary of the viewport
+     * Gets the right boundary of the viewport.
      *
      * @return the right boundary of the viewport
      */
@@ -982,7 +1032,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setViewPortRight</code> sets the right boundary of the viewport
+     * Sets the right boundary of the viewport.
      *
      * @param right the right boundary of the viewport
      */
@@ -992,7 +1042,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getViewPortTop</code> gets the top boundary of the viewport
+     * Gets the top boundary of the viewport.
      *
      * @return the top boundary of the viewport
      */
@@ -1001,7 +1051,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setViewPortTop</code> sets the top boundary of the viewport
+     * Sets the top boundary of the viewport.
      *
      * @param top the top boundary of the viewport
      */
@@ -1011,7 +1061,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>getViewPortBottom</code> gets the bottom boundary of the viewport
+     * Gets the bottom boundary of the viewport.
      *
      * @return the bottom boundary of the viewport
      */
@@ -1020,7 +1070,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setViewPortBottom</code> sets the bottom boundary of the viewport
+     * Sets the bottom boundary of the viewport.
      *
      * @param bottom the bottom boundary of the viewport
      */
@@ -1030,7 +1080,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>setViewPort</code> sets the boundaries of the viewport
+     * Sets the boundaries of the viewport.
      *
      * @param left   the left boundary of the viewport (default: 0)
      * @param right  the right boundary of the viewport (default: 1)
@@ -1056,7 +1106,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>contains</code> tests a bounding volume against the planes of the
+     * Tests a bounding volume against the planes of the
      * camera's frustum. The frustum's planes are set such that the normals all
      * face in towards the viewable scene. Therefore, if the bounding volume is
      * on the negative side of the plane is can be culled out.
@@ -1109,13 +1159,20 @@ public class Camera implements Savable, Cloneable {
 
         return rVal;
     }
-    
+
+    /**
+     * Provides access to one of the planes used for culling.
+     *
+     * @param planeId the index of the Plane to access (0&rarr;left, 1&rarr;right, 2&rarr;bottom, 3&rarr;top,
+     *     4&rarr;far, 5&rarr;near)
+     * @return the pre-existing instance
+     */
     public Plane getWorldPlane(int planeId) {
         return worldPlane[planeId];
     }
-    
+
     /**
-     * <code>containsGui</code> tests a bounding volume against the ortho
+     * Tests a bounding volume against the ortho
      * bounding box of the camera. A bounding box spanning from
      * 0, 0 to Width, Height. Constrained by the viewport settings on the
      * camera.
@@ -1131,8 +1188,11 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
+     * Provides access to the view matrix.
+     *
      * @return the view matrix of the camera.
-     * The view matrix transforms world space into eye space.
+     *
+     * <p>The view matrix transforms world space into eye space.
      * This matrix is usually defined by the position and
      * orientation of the camera.
      */
@@ -1146,22 +1206,24 @@ public class Camera implements Savable, Cloneable {
      * Use null argument to return to normal functionality.
      *
      * @param projMatrix the desired projection matrix (unaffected) or null
-     * to cease the override
+     *     to cease the override
      */
     public void setProjectionMatrix(Matrix4f projMatrix) {
         if (projMatrix == null) {
             overrideProjection = false;
-            projectionMatrixOverride.loadIdentity();   
+            projectionMatrixOverride.loadIdentity();
         } else {
-            overrideProjection = true;            
+            overrideProjection = true;
             projectionMatrixOverride.set(projMatrix);
-        }            
+        }
         updateViewProjection();
     }
 
     /**
+     * Provides access to the projection matrix.
      * @return the projection matrix of the camera.
-     * The view projection matrix  transforms eye space into clip space.
+     *
+     * <p>The view projection matrix  transforms eye space into clip space.
      * This matrix is usually defined by the viewport and perspective settings
      * of the camera.
      */
@@ -1186,18 +1248,21 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
+     * Provides access to the view projection matrix.
      * @return The result of multiplying the projection matrix by the view
-     * matrix. This matrix is required for rendering an object. It is
-     * precomputed so as to not compute it every time an object is rendered.
+     *     matrix. This matrix is required for rendering an object. It is
+     *     precomputed so as to not compute it every time an object is rendered.
      */
     public Matrix4f getViewProjectionMatrix() {
         return viewProjectionMatrix;
     }
 
     /**
-     * @return True if the viewport (width, height, left, right, bottom, up)
+     * Tests whether the viewport (width, height, left, right, bottom, up)
      * has been changed. This is needed in the renderer so that the proper
      * viewport can be set-up.
+     *
+     * @return true if changed, otherwise false
      */
     public boolean isViewportChanged() {
         return viewportChanged;
@@ -1233,7 +1298,7 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>onFrustumChange</code> updates the frustum to reflect any changes
+     * Updates the frustum to reflect any changes
      * made to the planes. The new frustum values are kept in a temporary
      * location for use when calculating the new frame. The projection
      * matrix is updated to reflect the current values of the frustum.
@@ -1275,7 +1340,8 @@ public class Camera implements Savable, Cloneable {
             coeffTop[1] = 0;
         }
 
-        projectionMatrix.fromFrustum(frustumNear, frustumFar, frustumLeft, frustumRight, frustumTop, frustumBottom, parallelProjection);
+        projectionMatrix.fromFrustum(frustumNear, frustumFar, frustumLeft, frustumRight,
+                frustumTop, frustumBottom, parallelProjection);
 //        projectionMatrix.transposeLocal();
 
         // The frame is affected by the frustum values
@@ -1284,11 +1350,11 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * <code>onFrameChange</code> updates the view frame of the camera.
+     * Updates the view frame of the camera.
      */
     public void onFrameChange() {
         TempVars vars = TempVars.get();
-        
+
         Vector3f left = getLeft(vars.vect1);
         Vector3f direction = getDirection(vars.vect2);
         Vector3f up = getUp(vars.vect3);
@@ -1348,14 +1414,16 @@ public class Camera implements Savable, Cloneable {
         worldPlane[NEAR_PLANE].setConstant(dirDotLocation + frustumNear);
 
         viewMatrix.fromFrame(location, direction, up, left);
-        
+
         vars.release();
-        
+
 //        viewMatrix.transposeLocal();
         updateViewProjection();
     }
 
     /**
+     * Determines whether the projection is parallel or perspective.
+     *
      * @return true if parallel projection is enable, false if in normal perspective mode
      * @see #setParallelProjection(boolean)
      */
@@ -1364,9 +1432,10 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * Enable/disable parallel projection.
+     * Enables/disables parallel projection.
      *
-     * @param value true to set up this camera for parallel projection is enable, false to enter normal perspective mode
+     * @param value true to set up this camera for parallel projection is enable,
+     *     false to enter normal perspective mode
      */
     public void setParallelProjection(final boolean value) {
         this.parallelProjection = value;
@@ -1374,10 +1443,11 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
-     * Computes the z value in projection space from the z value in view space 
+     * Computes the z value in projection space from the z value in view space
      * Note that the returned value is going non linearly from 0 to 1.
      * for more explanations on non linear z buffer see
      * http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html
+     *
      * @param viewZPos the z value in view space.
      * @return the z value in projection space.
      */
@@ -1395,9 +1465,10 @@ public class Camera implements Savable, Cloneable {
      * This former value is also known as the Z buffer value or non linear depth buffer.
      * for more explanations on non linear z buffer see
      * http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html
-     * 
-     * To compute the projection space z from the view space z (distance from cam to object) @see Camera#getViewToProjectionZ
-     * 
+     *
+     * <p>To compute the projection space z from the view space z (distance from cam to object)
+     * @see Camera#getViewToProjectionZ
+     *
      * @param screenPos 2d coordinate in screen space
      * @param projectionZPos non linear z value in projection space
      * @return the position in world space.
@@ -1407,11 +1478,13 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
+     * Converts the given position from screen space to world space.
+     *
      * @param screenPosition a (2-D) location in screen space (not null)
      * @param projectionZPos a (non-linear) Z value in projection space
      * @param store storage for the result (modified if not null)
-     * @return a location vector (in world coordinates, either 
-     * <code>store</code> or a new vector)
+     * @return a location vector (in world coordinates, either
+     *     <code>store</code> or a new vector)
      * @see Camera#getWorldCoordinates
      */
     public Vector3f getWorldCoordinates(Vector2f screenPosition,
@@ -1419,7 +1492,7 @@ public class Camera implements Savable, Cloneable {
         if (store == null) {
             store = new Vector3f();
         }
- 
+
         Matrix4f inverseMat = new Matrix4f(viewProjectionMatrix);
         inverseMat.invertLocal();
 
@@ -1428,7 +1501,7 @@ public class Camera implements Savable, Cloneable {
                 (screenPosition.y / getHeight() - viewPortBottom) / (viewPortTop - viewPortBottom) * 2 - 1,
                 projectionZPos * 2 - 1);
 
-        float w = inverseMat.multProj(store, store);      
+        float w = inverseMat.multProj(store, store);
         store.multLocal(1f / w);
 
         return store;
@@ -1436,7 +1509,7 @@ public class Camera implements Savable, Cloneable {
 
     /**
      * Converts the given position from world space to screen space.
-     * 
+     *
      * @param worldPos a location in world coordinates (not null, unaffected)
      * @return a new (3-D) location vector (in screen coordinates)
      * @see Camera#getScreenCoordinates
@@ -1450,8 +1523,8 @@ public class Camera implements Savable, Cloneable {
      *
      * @param worldPosition a location in world coordinates (not null, unaffected)
      * @param store storage for the result (modified if not null)
-     * @return a (3-D) location vector (in screen coordinates, either 
-     * <code>store</code> or a new vector)
+     * @return a (3-D) location vector (in screen coordinates, either
+     *     <code>store</code> or a new vector)
      * @see Camera#getScreenCoordinates(Vector3f, Vector3f)
      */
     public Vector3f getScreenCoordinates(Vector3f worldPosition, Vector3f store) {
@@ -1464,8 +1537,10 @@ public class Camera implements Savable, Cloneable {
 //        tmp_quat.set( worldPosition.x, worldPosition.y, worldPosition.z, 1 );
 //        viewProjectionMatrix.mult(tmp_quat, tmp_quat);
 //        tmp_quat.multLocal( 1.0f / tmp_quat.getW() );
-//        store.x = ( ( tmp_quat.getX() + 1 ) * ( viewPortRight - viewPortLeft ) / 2 + viewPortLeft ) * getWidth();
-//        store.y = ( ( tmp_quat.getY() + 1 ) * ( viewPortTop - viewPortBottom ) / 2 + viewPortBottom ) * getHeight();
+//        store.x = ( ( tmp_quat.getX() + 1 ) * ( viewPortRight - viewPortLeft ) / 2 + viewPortLeft )
+//                  * getWidth();
+//        store.y = ( ( tmp_quat.getY() + 1 ) * ( viewPortTop - viewPortBottom ) / 2 + viewPortBottom )
+//                  * getHeight();
 //        store.z = ( tmp_quat.getZ() + 1 ) / 2;
 //        vars.release();
 
@@ -1480,6 +1555,8 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
+     * Returns the display width.
+     *
      * @return the width/resolution of the display.
      */
     public int getWidth() {
@@ -1487,6 +1564,8 @@ public class Camera implements Savable, Cloneable {
     }
 
     /**
+     * Returns the display height.
+     *
      * @return the height/resolution of the display.
      */
     public int getHeight() {

+ 201 - 150
jme3-core/src/main/java/com/jme3/renderer/Caps.java

@@ -41,41 +41,41 @@ import com.jme3.texture.Texture;
 import java.util.Collection;
 
 /**
- * <code>Caps</code> is an enum specifying a capability that the {@link Renderer}
+ * Specifies a capability that the {@link Renderer}
  * supports.
- * 
+ *
  * @author Kirill Vainer
  */
 public enum Caps {
 
     /**
      * Supports {@link FrameBuffer FrameBuffers}.
-     * <p>
-     * OpenGL: Renderer exposes the GL_EXT_framebuffer_object extension.<br>
+     *
+     * <p>OpenGL: Renderer exposes the GL_EXT_framebuffer_object extension.<br>
      * OpenGL ES: Renderer supports OpenGL ES 2.0.
      */
     FrameBuffer,
 
     /**
-     * Supports framebuffer Multiple Render Targets (MRT)
-     * <p>
-     * OpenGL: Renderer exposes the GL_ARB_draw_buffers extension
+     * Supports framebuffer Multiple Render Targets (MRT).
+     *
+     * <p>OpenGL: Renderer exposes the GL_ARB_draw_buffers extension
      */
     FrameBufferMRT,
 
     /**
-     * Supports framebuffer multi-sampling
-     * <p>
-     * OpenGL: Renderer exposes the GL EXT framebuffer multisample extension<br>
+     * Supports framebuffer multi-sampling.
+     *
+     * <p>OpenGL: Renderer exposes the GL EXT framebuffer multisample extension<br>
      * OpenGL ES: Renderer exposes GL_APPLE_framebuffer_multisample or
      * GL_ANGLE_framebuffer_multisample.
      */
     FrameBufferMultisample,
 
     /**
-     * Supports texture multi-sampling
-     * <p>
-     * OpenGL: Renderer exposes the GL_ARB_texture_multisample extension<br>
+     * Supports texture multi-sampling.
+     *
+     * <p>OpenGL: Renderer exposes the GL_ARB_texture_multisample extension<br>
      * OpenGL ES: Renderer exposes the GL_IMG_multisampled_render_to_texture
      * extension.
      */
@@ -85,118 +85,118 @@ public enum Caps {
      * Supports OpenGL 2.0 or OpenGL ES 2.0.
      */
     OpenGL20,
-    
+
     /**
-     * Supports OpenGL 2.1
+     * Supports OpenGL 2.1.
      */
     OpenGL21,
-    
+
     /**
-     * Supports OpenGL 3.0
+     * Supports OpenGL 3.0.
      */
     OpenGL30,
-    
+
     /**
-     * Supports OpenGL 3.1
+     * Supports OpenGL 3.1.
      */
     OpenGL31,
-    
+
     /**
-     * Supports OpenGL 3.2
+     * Supports OpenGL 3.2.
      */
     OpenGL32,
     /**
-     * Supports OpenGL 3.3
+     * Supports OpenGL 3.3.
      */
     OpenGL33,
     /**
-     * Supports OpenGL 4.0
+     * Supports OpenGL 4.0.
      */
     OpenGL40,
     /**
-     * Supports OpenGL 4.1
+     * Supports OpenGL 4.1.
      */
     OpenGL41,
     /**
-     * Supports OpenGL 4.2
+     * Supports OpenGL 4.2.
      */
     OpenGL42,
     /**
-     * Supports OpenGL 4.3
+     * Supports OpenGL 4.3.
      */
     OpenGL43,
     /**
-     * Supports OpenGL 4.4
+     * Supports OpenGL 4.4.
      */
     OpenGL44,
     /**
-     * Supports OpenGL 4.5
+     * Supports OpenGL 4.5.
      */
     OpenGL45,
     /**
      * Do not use.
-     * 
+     *
      * @deprecated do not use.
      */
     @Deprecated
     Reserved0,
-    
+
     /**
-     * Supports GLSL 1.0
+     * Supports GLSL 1.0.
      */
     GLSL100,
-    
+
     /**
-     * Supports GLSL 1.1
+     * Supports GLSL 1.1.
      */
     GLSL110,
-    
+
     /**
-     * Supports GLSL 1.2
+     * Supports GLSL 1.2.
      */
     GLSL120,
-    
+
     /**
-     * Supports GLSL 1.3
+     * Supports GLSL 1.3.
      */
     GLSL130,
-    
+
     /**
-     * Supports GLSL 1.4
+     * Supports GLSL 1.4.
      */
     GLSL140,
-    
+
     /**
-     * Supports GLSL 1.5
+     * Supports GLSL 1.5.
      */
     GLSL150,
-    
+
     /**
-     * Supports GLSL 3.3
+     * Supports GLSL 3.3.
      */
     GLSL330,
     /**
-     * Supports GLSL 4.0
+     * Supports GLSL 4.0.
      */
     GLSL400,
     /**
-     * Supports GLSL 4.1
+     * Supports GLSL 4.1.
      */
     GLSL410,
     /**
-     * Supports GLSL 4.2
+     * Supports GLSL 4.2.
      */
     GLSL420,
     /**
-     * Supports GLSL 4.3
+     * Supports GLSL 4.3.
      */
     GLSL430,
     /**
-     * Supports GLSL 4.4
+     * Supports GLSL 4.4.
      */
     GLSL440,
     /**
-     * Supports GLSL 4.5
+     * Supports GLSL 4.5.
      */
     GLSL450,
     /**
@@ -209,69 +209,69 @@ public enum Caps {
      */
     GeometryShader,
     /**
-     * Supports Tessellation shader
+     * Supports Tessellation shader.
      */
     TesselationShader,
     /**
-     * Supports texture arrays
+     * Supports texture arrays.
      */
     TextureArray,
 
     /**
-     * Supports texture buffers
+     * Supports texture buffers.
      */
     TextureBuffer,
 
     /**
-     * Supports floating point and half textures (Format.RGB16F)
+     * Supports floating point and half textures (Format.RGB16F).
      */
     FloatTexture,
-    
+
     /**
-     * Supports integer textures
+     * Supports integer textures.
      */
     IntegerTexture,
-    
+
     /**
-     * Supports floating point FBO color buffers (Format.RGB16F)
+     * Supports floating point FBO color buffers (Format.RGB16F).
      */
     FloatColorBuffer,
 
     /**
-     * Supports floating point depth buffer
+     * Supports floating point depth buffer.
      */
     FloatDepthBuffer,
 
     /**
-     * Supports Format.RGB111110F for textures
+     * Supports Format.RGB111110F for textures.
      */
     PackedFloatTexture,
 
     /**
-     * Supports Format.RGB9E5 for textures
+     * Supports Format.RGB9E5 for textures.
      */
     SharedExponentTexture,
 
     /**
-     * Supports Format.RGB111110F for FBO color buffers
+     * Supports Format.RGB111110F for FBO color buffers.
      */
     PackedFloatColorBuffer,
 
     /**
-     * Supports Format.RGB9E5 for FBO color buffers
+     * Supports Format.RGB9E5 for FBO color buffers.
      */
     SharedExponentColorBuffer,
-    
+
     /**
      * Do not use.
-     * 
+     *
      * @deprecated do not use.
      */
     @Deprecated
     Reserved1,
 
     /**
-     * Supports Non-Power-Of-Two (NPOT) textures and framebuffers
+     * Supports Non-Power-Of-Two (NPOT) textures and framebuffers.
      */
     NonPowerOfTwoTextures,
 
@@ -281,114 +281,114 @@ public enum Caps {
     MeshInstancing,
 
     /**
-     * Supports VAO, or vertex buffer arrays
+     * Supports VAO, or vertex buffer arrays.
      */
     VertexBufferArray,
 
     /**
-     * Supports multisampling on the screen
+     * Supports multisampling on the screen.
      */
     Multisample,
-    
+
     /**
-     * Supports FBO with Depth24Stencil8 image format
+     * Supports FBO with Depth24Stencil8 image format.
      */
     PackedDepthStencilBuffer,
-    
+
     /**
-     * Supports sRGB framebuffers and sRGB texture format
+     * Supports sRGB framebuffers and sRGB texture format.
      */
     Srgb,
-    
+
     /**
      * Supports blitting framebuffers.
      */
     FrameBufferBlit,
-    
+
     /**
      * Supports {@link Format#DXT1} and sister formats.
      */
     TextureCompressionS3TC,
-    
+
     /**
      * Supports anisotropic texture filtering.
      */
     TextureFilterAnisotropic,
-    
+
     /**
      * Supports {@link Format#ETC1} texture compression.
      */
     TextureCompressionETC1,
-    
+
     /**
      * Supports {@link Format#ETC1} texture compression by uploading
      * the texture as ETC2 (they are backwards compatible).
      */
     TextureCompressionETC2,
-    
+
     /**
      * Supports BPTC and sister formats.
      */
     TextureCompressionBPTC,
-    
+
     /**
      * Supports {@link Format#RGTC1} and other RGTC compressed formats.
      */
     TextureCompressionRGTC,
-    
+
     /**
-     * Supports OpenGL ES 2
+     * Supports OpenGL ES 2.
      */
     OpenGLES20,
-    
+
     /**
-     * Supports RGB8 / RGBA8 textures
+     * Supports RGB8 / RGBA8 textures.
      */
     Rgba8,
-    
+
     /**
      * Supports depth textures.
      */
     DepthTexture,
-    
+
     /**
      * Supports 32-bit index buffers.
      */
     IntegerIndexBuffer,
-    
+
     /**
      * Partial support for non-power-of-2 textures, typically found
      * on OpenGL ES 2 devices.
-     * <p>
-     * Use of NPOT textures is allowed iff:
+     *
+     * <p>Use of NPOT textures is allowed iff:
      * <ul>
-     * <li>The {@link com.jme3.texture.Texture.WrapMode} is set to 
+     * <li>The {@link com.jme3.texture.Texture.WrapMode} is set to
      * {@link com.jme3.texture.Texture.WrapMode#EdgeClamp}.</li>
-     * <li>Mip-mapping is not used, meaning 
+     * <li>Mip-mapping is not used, meaning
      * {@link com.jme3.texture.Texture.MinFilter} is set to
-     * {@link com.jme3.texture.Texture.MinFilter#BilinearNoMipMaps} or 
+     * {@link com.jme3.texture.Texture.MinFilter#BilinearNoMipMaps} or
      * {@link com.jme3.texture.Texture.MinFilter#NearestNoMipMaps}</li>
      * </ul>
      */
     PartialNonPowerOfTwoTextures,
-    
+
     /**
-     * When sampling cubemap edges, interpolate between the adjacent faces
+     * When sampling cubemap edges, interpolates between the adjacent faces
      * instead of just sampling one face.
-     * <p>
-     * Improves the quality of environment mapping.
+     *
+     * <p>Improves the quality of environment mapping.
      */
     SeamlessCubemap,
-    
+
     /**
      * Running with OpenGL 3.2+ core profile.
-     * 
+     *
      * Compatibility features will not be available.
      */
     CoreProfile,
-    
+
     /**
-     * GPU can provide and accept binary shaders.
+     * GPU support for binary shaders.
      */
     BinaryShader,
     /**
@@ -401,67 +401,71 @@ public enum Caps {
     ShaderStorageBufferObject,
 
     /**
-     * Supports OpenGL ES 3.0
+     * Supports OpenGL ES 3.0.
      */
     OpenGLES30,
 
     /**
-     * Supports GLSL 3.0
+     * Supports GLSL 3.0.
      */
     GLSL300,
 
     /**
-     * Supports OpenGL ES 3.1
+     * Supports OpenGL ES 3.1.
      */
     OpenGLES31,
 
     /**
-     * Supports GLSL 3.1
+     * Supports GLSL 3.1.
      */
     GLSL310,
 
     /**
-     * Supports OpenGL ES 3.2
+     * Supports OpenGL ES 3.2.
      */
     OpenGLES32,
 
     /**
-     * Supports GLSL 3.2
+     * Supports GLSL 3.2.
      */
     GLSL320,
 
     /**
-     * Explicit support of depth 24 textures
+     * Explicit support of depth 24 textures.
      */
-    Depth24,     
+    Depth24,
 
-    
+    /**
+     * Supports unpack row length (stride).
+     */
     UnpackRowLength
     ;
 
     /**
      * Returns true if given the renderer capabilities, the texture
      * can be supported by the renderer.
-     * <p>
-     * This only checks the format of the texture, non-power-of-2
-     * textures are scaled automatically inside the renderer 
+     *
+     * <p>This only checks the format of the texture, non-power-of-2
+     * textures are scaled automatically inside the renderer
      * if are not supported natively.
-     * 
+     *
      * @param caps The collection of renderer capabilities {@link Renderer#getCaps() }.
      * @param tex The texture to check
      * @return True if it is supported, false otherwise.
      */
-    public static boolean supports(Collection<Caps> caps, Texture tex){
+    public static boolean supports(Collection<Caps> caps, Texture tex) {
         if (tex.getType() == Texture.Type.TwoDimensionalArray
-         && !caps.contains(Caps.TextureArray))
+                && !caps.contains(Caps.TextureArray)) {
             return false;
+        }
 
         Image img = tex.getImage();
-        if (img == null)
+        if (img == null) {
             return true;
+        }
 
         Format fmt = img.getFormat();
-        switch (fmt){
+        switch (fmt) {
             case Depth24Stencil8:
                 return caps.contains(Caps.PackedDepthStencilBuffer);
             case Depth32F:
@@ -473,22 +477,25 @@ public enum Caps {
             case RGB9E5:
                 return caps.contains(Caps.SharedExponentTexture);
             default:
-                if (fmt.isFloatingPont())
+                if (fmt.isFloatingPont()) {
                     return caps.contains(Caps.FloatTexture);
-                        
+                }
+
                 return true;
         }
     }
-    
-    private static boolean supportsColorBuffer(Collection<Caps> caps, RenderBuffer colorBuf){
+
+    private static boolean supportsColorBuffer(Collection<Caps> caps, RenderBuffer colorBuf) {
         Format colorFmt = colorBuf.getFormat();
-        if (colorFmt.isDepthFormat())
+        if (colorFmt.isDepthFormat()) {
             return false;
+        }
 
-        if (colorFmt.isCompressed())
+        if (colorFmt.isCompressed()) {
             return false;
+        }
 
-        switch (colorFmt){
+        switch (colorFmt) {
             case RGB111110F:
                 return caps.contains(Caps.PackedFloatColorBuffer);
             case RGB16F_to_RGB111110F:
@@ -496,8 +503,9 @@ public enum Caps {
             case RGB9E5:
                 return false;
             default:
-                if (colorFmt.isFloatingPont())
+                if (colorFmt.isFloatingPont()) {
                     return caps.contains(Caps.FloatColorBuffer);
+                }
 
                 return true;
         }
@@ -506,36 +514,40 @@ public enum Caps {
     /**
      * Returns true if given the renderer capabilities, the framebuffer
      * can be supported by the renderer.
-     * 
+     *
      * @param caps The collection of renderer capabilities {@link Renderer#getCaps() }.
      * @param fb The framebuffer to check
      * @return True if it is supported, false otherwise.
      */
-    public static boolean supports(Collection<Caps> caps, FrameBuffer fb){
-        if (!caps.contains(Caps.FrameBuffer))
+    public static boolean supports(Collection<Caps> caps, FrameBuffer fb) {
+        if (!caps.contains(Caps.FrameBuffer)) {
             return false;
+        }
 
         if (fb.getSamples() > 1
-         && !caps.contains(Caps.FrameBufferMultisample))
+                && !caps.contains(Caps.FrameBufferMultisample)) {
             return false;
+        }
 
         RenderBuffer depthBuf = fb.getDepthBuffer();
-        if (depthBuf != null){
+        if (depthBuf != null) {
             Format depthFmt = depthBuf.getFormat();
-            if (!depthFmt.isDepthFormat()){
+            if (!depthFmt.isDepthFormat()) {
                 return false;
-            }else{
+            } else {
                 if (depthFmt == Format.Depth32F
-                 && !caps.contains(Caps.FloatDepthBuffer))
+                        && !caps.contains(Caps.FloatDepthBuffer)) {
                     return false;
-                
+                }
+
                 if (depthFmt == Format.Depth24Stencil8
-                 && !caps.contains(Caps.PackedDepthStencilBuffer))
+                        && !caps.contains(Caps.PackedDepthStencilBuffer)) {
                     return false;
+                }
             }
         }
-        for (int i = 0; i < fb.getNumColorBuffers(); i++){
-            if (!supportsColorBuffer(caps, fb.getColorBuffer(i))){
+        for (int i = 0; i < fb.getNumColorBuffers(); i++) {
+            if (!supportsColorBuffer(caps, fb.getColorBuffer(i))) {
                 return false;
             }
         }
@@ -545,42 +557,81 @@ public enum Caps {
     /**
      * Returns true if given the renderer capabilities, the shader
      * can be supported by the renderer.
-     * 
+     *
      * @param caps The collection of renderer capabilities {@link Renderer#getCaps() }.
      * @param shader The shader to check
      * @return True if it is supported, false otherwise.
      */
-    public static boolean supports(Collection<Caps> caps, Shader shader){
+    public static boolean supports(Collection<Caps> caps, Shader shader) {
         for (ShaderSource source : shader.getSources()) {
             if (source.getLanguage().startsWith("GLSL")) {
                 int ver = Integer.parseInt(source.getLanguage().substring(4));
                 switch (ver) {
                     case 100:
-                        if (!caps.contains(Caps.GLSL100)) return false;
+                        if (!caps.contains(Caps.GLSL100)) {
+                            return false;
+                        }
+                        // fall through
                     case 110:
-                        if (!caps.contains(Caps.GLSL110)) return false;
+                        if (!caps.contains(Caps.GLSL110)) {
+                            return false;
+                        }
+                        // fall through
                     case 120:
-                        if (!caps.contains(Caps.GLSL120)) return false;
+                        if (!caps.contains(Caps.GLSL120)) {
+                            return false;
+                        }
+                        // fall through
                     case 130:
-                        if (!caps.contains(Caps.GLSL130)) return false;
+                        if (!caps.contains(Caps.GLSL130)) {
+                            return false;
+                        }
+                        // fall through
                     case 140:
-                        if (!caps.contains(Caps.GLSL140)) return false;
+                        if (!caps.contains(Caps.GLSL140)) {
+                            return false;
+                        }
+                        // fall through
                     case 150:
-                        if (!caps.contains(Caps.GLSL150)) return false;
+                        if (!caps.contains(Caps.GLSL150)) {
+                            return false;
+                        }
+                        // fall through
                     case 330:
-                        if (!caps.contains(Caps.GLSL330)) return false;
+                        if (!caps.contains(Caps.GLSL330)) {
+                            return false;
+                        }
+                        // fall through
                     case 400:
-                        if (!caps.contains(Caps.GLSL400)) return false;
+                        if (!caps.contains(Caps.GLSL400)) {
+                            return false;
+                        }
+                        // fall through
                     case 410:
-                        if (!caps.contains(Caps.GLSL410)) return false;
+                        if (!caps.contains(Caps.GLSL410)) {
+                            return false;
+                        }
+                        // fall through
                     case 420:
-                        if (!caps.contains(Caps.GLSL420)) return false;
+                        if (!caps.contains(Caps.GLSL420)) {
+                            return false;
+                        }
+                        // fall through
                     case 430:
-                        if (!caps.contains(Caps.GLSL430)) return false;
+                        if (!caps.contains(Caps.GLSL430)) {
+                            return false;
+                        }
+                        // fall through
                     case 440:
-                        if (!caps.contains(Caps.GLSL440)) return false;
+                        if (!caps.contains(Caps.GLSL440)) {
+                            return false;
+                        }
+                        // fall through
                     case 450:
-                        if (!caps.contains(Caps.GLSL450)) return false;
+                        if (!caps.contains(Caps.GLSL450)) {
+                            return false;
+                        }
+                        // fall through
                     default:
                         return false;
                 }

+ 40 - 25
jme3-core/src/main/java/com/jme3/renderer/IDList.java

@@ -35,19 +35,31 @@ import java.util.Arrays;
 
 /**
  * A specialized data-structure used to optimize state changes of "slot"
- * based state. 
+ * based state.
  */
 public class IDList {
 
+    /**
+     * Indices belonging to the "new list". Valid data in elements 0 through newLen-1 only!
+     */
     public int[] newList = new int[16];
+    /**
+     * Indices belonging to the "old list". Valid data in elements 0 through oldLen-1 only!
+     */
     public int[] oldList = new int[16];
+    /**
+     * The number of valid elements in the new list.
+     */
     public int newLen = 0;
+    /**
+     * The number of valid elements in the old list.
+     */
     public int oldLen = 0;
 
     /**
-     * Reset all states to zero
+     * Resets all states to zero.
      */
-    public void reset(){
+    public void reset() {
         newLen = 0;
         oldLen = 0;
         Arrays.fill(newList, 0);
@@ -59,24 +71,25 @@ public class IDList {
      * If the index was not in the old list, false is returned,
      * if the index was in the old list, it is removed from the old
      * list and true is returned.
-     * 
+     *
      * @param idx The index to move
      * @return True if it existed in old list and was removed
-     * from there, false otherwise.
+     *     from there, false otherwise.
      */
-    public boolean moveToNew(int idx){
-        if (newLen == 0 || newList[newLen-1] != idx)
+    public boolean moveToNew(int idx) {
+        if (newLen == 0 || newList[newLen - 1] != idx) {
             // add item to newList first
             newList[newLen++] = idx;
+        }
 
         // find idx in oldList, if removed successfully, return true.
-        for (int i = 0; i < oldLen; i++){
-            if (oldList[i] == idx){
+        for (int i = 0; i < oldLen; i++) {
+            if (oldList[i] == idx) {
                 // found index in slot i
                 // delete index from old list
-                oldLen --;
-                for (int j = i; j < oldLen; j++){
-                    oldList[j] = oldList[j+1];
+                oldLen--;
+                for (int j = i; j < oldLen; j++) {
+                    oldList[j] = oldList[j + 1];
                 }
                 return true;
             }
@@ -87,32 +100,34 @@ public class IDList {
     /**
      * Copies the new list to the old list, and clears the new list.
      */
-    public void copyNewToOld(){
+    public void copyNewToOld() {
         System.arraycopy(newList, 0, oldList, 0, newLen);
         oldLen = newLen;
         newLen = 0;
     }
 
     /**
-     * Prints the contents of the lists
+     * Prints the contents of the lists.
      */
-    public void print(){
-        if (newLen > 0){
+    public void print() {
+        if (newLen > 0) {
             System.out.print("New List: ");
-            for (int i = 0; i < newLen; i++){
-                if (i == newLen -1)
+            for (int i = 0; i < newLen; i++) {
+                if (i == newLen - 1) {
                     System.out.println(newList[i]);
-                else
-                    System.out.print(newList[i]+", ");
+                } else {
+                    System.out.print(newList[i] + ", ");
+                }
             }
         }
-        if (oldLen > 0){
+        if (oldLen > 0) {
             System.out.print("Old List: ");
-            for (int i = 0; i < oldLen; i++){
-                if (i == oldLen -1)
+            for (int i = 0; i < oldLen; i++) {
+                if (i == oldLen - 1) {
                     System.out.println(oldList[i]);
-                else
-                    System.out.print(oldList[i]+", ");
+                } else {
+                    System.out.print(oldList[i] + ", ");
+                }
             }
         }
     }

+ 75 - 3
jme3-core/src/main/java/com/jme3/renderer/Limits.java

@@ -32,10 +32,10 @@
 package com.jme3.renderer;
 
 /**
- * <code>Limits</code> allows querying the limits of certain features in
+ * Allows querying the limits of certain features in
  * {@link Renderer}.
- * <p>
- * For example, maximum texture sizes or number of samples.
+ *
+ * <p>For example, maximum texture sizes or number of samples.
  *
  * @author Kirill Vainer
  */
@@ -50,32 +50,104 @@ public enum Limits {
      * be used in the fragment shader.
      */
     FragmentTextureUnits,
+    /**
+     * Maximum number of fragment uniform vectors.
+     */
     FragmentUniformVectors,
+    /**
+     * Maximum number of vertex uniform vectors.
+     */
     VertexUniformVectors,
+    /**
+     * Maximum number of vertex attributes.
+     */
     VertexAttributes,
+    /**
+     * Maximum number of FrameBuffer samples.
+     */
     FrameBufferSamples,
+    /**
+     * Maximum number of FrameBuffer attachments.
+     */
     FrameBufferAttachments,
+    /**
+     * Maximum number of FrameBuffer MRT attachments.
+     */
     FrameBufferMrtAttachments,
+    /**
+     * Maximum render buffer size.
+     */
     RenderBufferSize,
+    /**
+     * Maximum texture size.
+     */
     TextureSize,
+    /**
+     * Maximum cubemap size.
+     */
     CubemapSize,
+    /**
+     * Maximum number of color texture samples.
+     */
     ColorTextureSamples,
+    /**
+     * Maximum number of depth texture samples.
+     */
     DepthTextureSamples,
+    /**
+     * Maximum degree of texture anisotropy.
+     */
     TextureAnisotropy,
 
     // UBO
+    /**
+     * Maximum number of UBOs that may be accessed by a vertex shader.
+     */
     UniformBufferObjectMaxVertexBlocks,
+    /**
+     * Maximum number of UBOs that may be accessed by a fragment shader.
+     */
     UniformBufferObjectMaxFragmentBlocks,
+    /**
+     * Maximum number of UBOs that may be accessed by a geometry shader.
+     */
     UniformBufferObjectMaxGeometryBlocks,
+    /**
+     * Maximum block size of a UBO.
+     */
     UniformBufferObjectMaxBlockSize,
 
     // SSBO
+    /**
+     * Maximum size of an SSBO.
+     */
     ShaderStorageBufferObjectMaxBlockSize,
+    /**
+     * Maximum number of active SSBOs that may be accessed by a vertex shader.
+     */
     ShaderStorageBufferObjectMaxVertexBlocks,
+    /**
+     * Maximum number of active SSBOs that may be accessed by a fragment shader.
+     */
     ShaderStorageBufferObjectMaxFragmentBlocks,
+    /**
+     * Maximum number of active SSBOs that may be accessed by a geometry shader.
+     */
     ShaderStorageBufferObjectMaxGeometryBlocks,
+    /**
+     * Maximum number of active SSBOs that may be accessed by a tessellation control shader.
+     */
     ShaderStorageBufferObjectMaxTessControlBlocks,
+    /**
+     * Maximum number of active SSBOs that may be accessed by a tessellation evaluation shader.
+     */
     ShaderStorageBufferObjectMaxTessEvaluationBlocks,
+    /**
+     * Not implemented yet.
+     */
     ShaderStorageBufferObjectMaxComputeBlocks,
+    /**
+     * Maximum number shader storage blocks across all active programs.
+     */
     ShaderStorageBufferObjectMaxCombineBlocks,
 }

+ 115 - 26
jme3-core/src/main/java/com/jme3/renderer/RenderContext.java

@@ -31,14 +31,13 @@
  */
 package com.jme3.renderer;
 
-import java.lang.ref.WeakReference;
-
 import com.jme3.material.RenderState;
 import com.jme3.math.ColorRGBA;
 import com.jme3.scene.VertexBuffer;
 import com.jme3.shader.Shader;
 import com.jme3.texture.FrameBuffer;
 import com.jme3.texture.Image;
+import java.lang.ref.WeakReference;
 
 /**
  * Represents the current state of the graphics library. This class is used
@@ -46,130 +45,179 @@ import com.jme3.texture.Image;
  */
 public class RenderContext {
     /**
-     * number of texture units that JME supports
+     * Number of texture units that JME supports.
      */
-    final public static int maxTextureUnits = 16;
+    public static final int maxTextureUnits = 16;
 
     /**
+     * Criteria for culling faces.
+     *
      * @see RenderState#setFaceCullMode(com.jme3.material.RenderState.FaceCullMode)
      */
     public RenderState.FaceCullMode cullMode;
 
     /**
+     * Enables depth testing for color pixels.
+     *
      * @see RenderState#setDepthTest(boolean)
      */
     public boolean depthTestEnabled;
 
     /**
+     * Enables depth writing.
+     *
      * @see RenderState#setDepthWrite(boolean)
      */
     public boolean depthWriteEnabled;
 
     /**
+     * Enables color writing.
+     *
      * @see RenderState#setColorWrite(boolean)
      */
     public boolean colorWriteEnabled;
 
     /**
+     * Enables the clipping rectangle.
+     *
      * @see Renderer#setClipRect(int, int, int, int)
      */
     public boolean clipRectEnabled;
 
     /**
+     * Enables z-order offset for polygons.
+     *
      * @see RenderState#setPolyOffset(float, float)
      */
     public boolean polyOffsetEnabled;
 
     /**
+     * Maximum Z slope for z-order offset.
+     *
      * @see RenderState#setPolyOffset(float, float)
      */
     public float polyOffsetFactor;
 
     /**
+     * Minimum resolvable depth buffer value for z-order offset.
+     *
      * @see RenderState#setPolyOffset(float, float)
      */
     public float polyOffsetUnits;
 
+    /**
+     * No longer used.
+     */
     public float pointSize;
 
     /**
+     * Line width for meshes.
+     *
      * @see RenderState#setLineWidth(float)
      */
     public float lineWidth;
 
     /**
+     * How to blend input pixels with those already in the color buffer.
+     *
      * @see RenderState#setBlendMode(com.jme3.material.RenderState.BlendMode)
      */
     public RenderState.BlendMode blendMode;
 
     /**
+     * RGB blend equation for BlendMode.Custom.
+     *
      * @see RenderState#setBlendEquation(com.jme3.material.RenderState.BlendEquation)
      */
     public RenderState.BlendEquation blendEquation;
 
     /**
+     * Alpha blend equation for BlendMode.Custom.
+     *
      * @see RenderState#setBlendEquationAlpha(com.jme3.material.RenderState.BlendEquationAlpha)
      */
     public RenderState.BlendEquationAlpha blendEquationAlpha;
 
     /**
-     * @see RenderState#setCustomBlendFactors(com.jme3.material.RenderState.BlendFunc, com.jme3.material.RenderState.BlendFunc,
+     * RGB source blend factor for BlendMode.Custom.
+     *
+     * @see RenderState#setCustomBlendFactors(com.jme3.material.RenderState.BlendFunc,
+     *      com.jme3.material.RenderState.BlendFunc,
      *      com.jme3.material.RenderState.BlendFunc, com.jme3.material.RenderState.BlendFunc)
      */
     public RenderState.BlendFunc sfactorRGB;
 
     /**
-     * @see RenderState#setCustomBlendFactors(com.jme3.material.RenderState.BlendFunc, com.jme3.material.RenderState.BlendFunc,
+     * RGB destination blend factor for BlendMode.Custom.
+     *
+     * @see RenderState#setCustomBlendFactors(com.jme3.material.RenderState.BlendFunc,
+     *      com.jme3.material.RenderState.BlendFunc,
      *      com.jme3.material.RenderState.BlendFunc, com.jme3.material.RenderState.BlendFunc)
      */
     public RenderState.BlendFunc dfactorRGB;
 
     /**
-     * @see RenderState#setCustomBlendFactors(com.jme3.material.RenderState.BlendFunc, com.jme3.material.RenderState.BlendFunc,
+     * Alpha source blend factor for BlendMode.Custom.
+     *
+     * @see RenderState#setCustomBlendFactors(com.jme3.material.RenderState.BlendFunc,
+     *      com.jme3.material.RenderState.BlendFunc,
      *      com.jme3.material.RenderState.BlendFunc, com.jme3.material.RenderState.BlendFunc)
      */
     public RenderState.BlendFunc sfactorAlpha;
 
     /**
-     * @see RenderState#setCustomBlendFactors(com.jme3.material.RenderState.BlendFunc, com.jme3.material.RenderState.BlendFunc,
+     * Alpha destination blend factor for BlendMode.Custom.
+     *
+     * @see RenderState#setCustomBlendFactors(com.jme3.material.RenderState.BlendFunc,
+     *      com.jme3.material.RenderState.BlendFunc,
      *      com.jme3.material.RenderState.BlendFunc, com.jme3.material.RenderState.BlendFunc)
      */
     public RenderState.BlendFunc dfactorAlpha;
 
     /**
+     * Enables wireframe rendering of triangle meshes.
+     *
      * @see RenderState#setWireframe(boolean)
      */
     public boolean wireframe;
 
     /**
+     * ID of the shader for rendering.
+     *
      * @see Renderer#setShader(com.jme3.shader.Shader)
      */
     public int boundShaderProgram;
 
     /**
+     * Shader for rendering.
+     *
      * @see Renderer#setShader(com.jme3.shader.Shader)
      */
     public Shader boundShader;
 
     /**
+     * ID of the bound FrameBuffer.
+     *
      * @see Renderer#setFrameBuffer(com.jme3.texture.FrameBuffer)
      */
     public int boundFBO;
 
     /**
+     * Currently bound FrameBuffer.
+     *
      * @see Renderer#setFrameBuffer(com.jme3.texture.FrameBuffer)
      */
     public FrameBuffer boundFB;
 
     /**
-     * Currently bound Renderbuffer
+     * Currently bound Renderbuffer.
      *
      * @see Renderer#setFrameBuffer(com.jme3.texture.FrameBuffer)
      */
     public int boundRB;
 
     /**
-     * Currently bound draw buffer
+     * Currently bound draw buffer.
      * -2 = GL_NONE
      * -1 = GL_BACK
      *  0 = GL_COLOR_ATTACHMENT0
@@ -182,7 +230,7 @@ public class RenderContext {
     public int boundDrawBuf;
 
     /**
-     * Currently bound read buffer
+     * Currently bound read buffer.
      *
      * @see RenderContext#boundDrawBuf
      * @see Renderer#setFrameBuffer(com.jme3.texture.FrameBuffer)
@@ -192,20 +240,22 @@ public class RenderContext {
 
     /**
      * Currently bound element array vertex buffer.
-     * 
-     * @see Renderer#renderMesh(com.jme3.scene.Mesh, int, int, com.jme3.scene.VertexBuffer[]) 
+     *
+     * @see Renderer#renderMesh(com.jme3.scene.Mesh, int, int, com.jme3.scene.VertexBuffer[])
      */
     public int boundElementArrayVBO;
 
     /**
-     * @see Renderer#renderMesh(com.jme3.scene.Mesh, int, int, com.jme3.scene.VertexBuffer[]) 
+     * ID of the bound vertex array.
+     *
+     * @see Renderer#renderMesh(com.jme3.scene.Mesh, int, int, com.jme3.scene.VertexBuffer[])
      */
     public int boundVertexArray;
 
     /**
      * Currently bound array vertex buffer.
-     * 
-     * @see Renderer#renderMesh(com.jme3.scene.Mesh, int, int, com.jme3.scene.VertexBuffer[]) 
+     *
+     * @see Renderer#renderMesh(com.jme3.scene.Mesh, int, int, com.jme3.scene.VertexBuffer[])
      */
     public int boundArrayVBO;
 
@@ -214,6 +264,9 @@ public class RenderContext {
      */
     public int boundPixelPackPBO;
 
+    /**
+     * No longer used.
+     */
     public int numTexturesSet;
 
     /**
@@ -225,58 +278,94 @@ public class RenderContext {
             = new WeakReference[maxTextureUnits];
 
     /**
-     * IDList for texture units
+     * IDList for texture units.
      *
      * @see Renderer#setTexture(int, com.jme3.texture.Texture)
      */
     public final IDList textureIndexList = new IDList();
 
     /**
-     * Currently bound texture unit
+     * Currently bound texture unit.
      *
      * @see Renderer#setTexture(int, com.jme3.texture.Texture)
      */
     public int boundTextureUnit;
 
     /**
-     * Stencil Buffer state
+     * Stencil Buffer state.
      */
     public boolean stencilTest;
+    /**
+     * Action taken when the stencil test fails on a front-facing polygon.
+     */
     public RenderState.StencilOperation frontStencilStencilFailOperation;
+    /**
+     * Action taken when the stencil test passes but the depth test fails on a front-facing polygon.
+     */
     public RenderState.StencilOperation frontStencilDepthFailOperation;
+    /**
+     * Action taken when both tests pass on a front-facing polygon.
+     */
     public RenderState.StencilOperation frontStencilDepthPassOperation;
+    /**
+     * Action taken when the stencil test fails on a back-facing polygon.
+     */
     public RenderState.StencilOperation backStencilStencilFailOperation;
+    /**
+     * Action taken when the stencil test passes but the depth test fails on a back-facing polygon.
+     */
     public RenderState.StencilOperation backStencilDepthFailOperation;
+    /**
+     * Action taken when both tests pass on a back-facing polygon.
+     */
     public RenderState.StencilOperation backStencilDepthPassOperation;
+    /**
+     * Stencil test function for front-facing polygons.
+     */
     public RenderState.TestFunction frontStencilFunction;
+    /**
+     * Stencil test function for back-facing polygons.
+     */
     public RenderState.TestFunction backStencilFunction;
 
     /**
      * Vertex attribs currently bound and enabled. If a slot is null, then
      * it is disabled.
      */
-    public final WeakReference<VertexBuffer> [] boundAttribs = new WeakReference[16];
+    public final WeakReference<VertexBuffer>[] boundAttribs = new WeakReference[16];
 
     /**
-     * IDList for vertex attributes
+     * IDList for vertex attributes.
      */
     public final IDList attribIndexList = new IDList();
 
     /**
-     * depth test function
+     * Depth test function.
      */
     public RenderState.TestFunction depthFunc;
 
-     /**
-     * alpha test function
+    /**
+     * Alpha test function.
      */
     public RenderState.TestFunction alphaFunc;
 
+    /**
+     * ID of the initial draw buffer.
+     */
     public int initialDrawBuf;
+    /**
+     * ID of the initial read buffer.
+     */
     public int initialReadBuf;
 
+    /**
+     * Color applied when a color buffer is cleared.
+     */
     public ColorRGBA clearColor = new ColorRGBA(0, 0, 0, 0);
 
+    /**
+     * Instantiates a context with appropriate default values.
+     */
     public RenderContext() {
         init();
     }
@@ -334,9 +423,9 @@ public class RenderContext {
     }
 
     /**
-     * Reset the RenderContext to default GL state
+     * Resets the RenderContext to default GL state.
      */
-    public void reset(){
+    public void reset() {
         init();
 
         for (int i = 0; i < boundTextures.length; i++) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 246 - 197
jme3-core/src/main/java/com/jme3/renderer/RenderManager.java


+ 54 - 43
jme3-core/src/main/java/com/jme3/renderer/Renderer.java

@@ -48,8 +48,9 @@ import java.util.EnumMap;
 import java.util.EnumSet;
 
 /**
- * The <code>Renderer</code> is responsible for taking rendering commands and
+ * Responsible for taking rendering commands and
  * executing them on the underlying video hardware.
+ * executes them on the underlying video hardware.
  *
  * @author Kirill Vainer
  */
@@ -63,25 +64,28 @@ public interface Renderer {
     public void initialize();
 
     /**
-     * Get the capabilities of the renderer.
+     * Gets the capabilities of the renderer.
+     *
      * @return The capabilities of the renderer.
      */
     public EnumSet<Caps> getCaps();
 
     /**
-     * Get the limits of the renderer.
+     * Gets the limits of the renderer.
      *
      * @return The limits of the renderer.
      */
     public EnumMap<Limits, Integer> getLimits();
 
     /**
-     * The statistics allow tracking of how data
+     * Copies the render statistics.
+     *
+     * <p>The statistics allow tracking of how data
      * per frame, such as number of objects rendered, number of triangles, etc.
      * These are updated when the Renderer's methods are used, make sure
      * to call {@link Statistics#clearFrame() } at the appropriate time
      * to get accurate info per frame.
-     * 
+     *
      * @return a new instance
      */
     public Statistics getStatistics();
@@ -112,13 +116,13 @@ public interface Renderer {
     /**
      * Applies the given {@link RenderState}, making the necessary
      * GL calls so that the state is applied.
-     * 
+     *
      * @param state the RenderState to apply
      */
     public void applyRenderState(RenderState state);
 
     /**
-     * Set the range of the depth values for objects. All rendered
+     * Sets the range of the depth values for objects. All rendered
      * objects will have their depth clamped to this range.
      *
      * @param start The range start
@@ -135,7 +139,7 @@ public interface Renderer {
     public void postFrame();
 
     /**
-     * Set the viewport location and resolution on the screen.
+     * Sets the viewport location and resolution on the screen.
      *
      * @param x The x coordinate of the viewport
      * @param y The y coordinate of the viewport
@@ -191,15 +195,19 @@ public interface Renderer {
     /**
      * Copies contents from src to dst, scaling if necessary.
      * set copyDepth to false to only copy the color buffers.
-     * @deprecated  Use {@link Renderer#copyFrameBuffer(com.jme3.texture.FrameBuffer, com.jme3.texture.FrameBuffer, boolean, boolean)}.
+     *
      * @param src the source FrameBuffer (unaffected)
      * @param dst the destination FrameBuffer (modified)
      * @param copyDepth true&rarr;copy depth info, false&rarr;don't copy it
+     * @deprecated  Use {@link Renderer#copyFrameBuffer(com.jme3.texture.FrameBuffer,
+     *     com.jme3.texture.FrameBuffer, boolean, boolean)}.
      */
-    @Deprecated public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth);
+    @Deprecated
+    public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth);
 
     /**
      * Copies contents from src to dst, scaling if necessary.
+     *
      * @param src the source FrameBuffer (unaffected)
      * @param dst the destination FrameBuffer (modified)
      * @param copyColor true&rarr;copy color info, false&rarr;don't copy it
@@ -218,7 +226,7 @@ public interface Renderer {
     public void setFrameBuffer(FrameBuffer fb);
 
     /**
-     * Set the framebuffer that will be set instead of the main framebuffer
+     * Sets the framebuffer that will be set instead of the main framebuffer
      * when a call to setFrameBuffer(null) is made.
      *
      * @param fb The framebuffer to override the main framebuffer.
@@ -251,14 +259,14 @@ public interface Renderer {
     public void readFrameBufferWithFormat(FrameBuffer fb, ByteBuffer byteBuf, Image.Format format);
 
     /**
-     * Deletes a framebuffer and all attached renderbuffers
+     * Deletes a framebuffer and all attached renderbuffers.
      *
      * @param fb the FrameBuffer to be deleted
      */
     public void deleteFrameBuffer(FrameBuffer fb);
 
     /**
-     * Assign a Texture to the specified texture unit.
+     * Assigns a Texture to the specified texture unit.
      *
      * @param unit the index of the texture unit (&ge;0)
      * @param tex the Texture to assign
@@ -268,7 +276,7 @@ public interface Renderer {
             throws TextureUnitException;
 
     /**
-     * Modify the given Texture with the given Image.
+     * Modifies the given Texture with the given Image.
      * The image will be put at x and y into the texture.
      *
      * NOTE: this is only supported for uncompressed 2D images without mipmaps.
@@ -303,6 +311,7 @@ public interface Renderer {
 
     /**
      * Deletes a vertex buffer from the GPU.
+     *
      * @param vb The vertex buffer to delete
      */
     public void deleteBuffer(VertexBuffer vb);
@@ -329,7 +338,7 @@ public interface Renderer {
      * @param lod The LOD level to use, see {@link Mesh#setLodLevels(com.jme3.scene.VertexBuffer[]) }.
      * @param count Number of mesh instances to render
      * @param instanceData When count is greater than 1, these buffers provide
-     * the per-instance attributes.
+     *     the per-instance attributes.
      */
     public void renderMesh(Mesh mesh, int lod, int count, VertexBuffer[] instanceData);
 
@@ -353,9 +362,9 @@ public interface Renderer {
     public void cleanup();
 
     /**
-     * Set the default anisotropic filter level for textures.
+     * Sets the default anisotropic filter level for textures.
      *
-     * If the
+     * <p>If the
      * {@link Texture#setAnisotropicFilter(int) texture anisotropic filter} is
      * set to 0, then the default level is used. Otherwise if the texture level
      * is 1 or greater, then the texture's value overrides the default value.
@@ -368,31 +377,32 @@ public interface Renderer {
 
     /**
      * Sets the alpha to coverage state.
-     * <p>
-     * When alpha coverage and multi-sampling is enabled,
+     *
+     * <p>When alpha coverage and multi-sampling is enabled,
      * each pixel will contain alpha coverage in all
      * of its subsamples, which is then combined when
-     * other future alpha-blended objects are rendered.
-     * </p>
-     * <p>
-     * Alpha-to-coverage is useful for rendering transparent objects
+     * other future alpha-blended objects are rendered.</p>
+     *
+     * <p>Alpha-to-coverage is useful for rendering transparent objects
      * without having to worry about sorting them.
      * </p>
      *
      * @param value true to enable alpha coverage, otherwise false
      */
     public void setAlphaToCoverage(boolean value);
-    
+
     /**
-     * If enabled, color values rendered to the main framebuffer undergo
+     * Specifies whether color values in the main framebuffer are in SRGB format.
+     *
+     * <p>If enabled, color values rendered to the main framebuffer undergo
      * linear -&gt; sRGB conversion.
      *
-     * This is identical to {@link FrameBuffer#setSrgb(boolean)} except it is toggled
+     * <p>This is identical to {@link FrameBuffer#setSrgb(boolean)} except it is toggled
      * for the main framebuffer instead of an offscreen buffer.
      *
-     * This should be set together with {@link Renderer#setLinearizeSrgbImages(boolean)}
+     * <p>This should be set together with {@link Renderer#setLinearizeSrgbImages(boolean)}
      *
-     * As a shorthand, the user can set {@link AppSettings#setGammaCorrection(boolean)} to true
+     * <p>As a shorthand, the user can set {@link AppSettings#setGammaCorrection(boolean)} to true
      * to toggle both {@link Renderer#setLinearizeSrgbImages(boolean)} and
      * {@link Renderer#setMainFrameBufferSrgb(boolean)} if the
      * {@link Caps#Srgb} is supported by the GPU.
@@ -404,12 +414,13 @@ public interface Renderer {
      * @see Caps#Srgb
      */
     public void setMainFrameBufferSrgb(boolean srgb);
-     
+
     /**
-     * If enabled, all {@link Image images} with the {@link Image#setColorSpace(com.jme3.texture.image.ColorSpace) sRGB flag}
+     * If enabled, all {@link Image images} with the
+     * {@link Image#setColorSpace(com.jme3.texture.image.ColorSpace) sRGB flag}
      * set shall undergo an sRGB to linear RGB color conversion when read by a shader.
      *
-     * The conversion is performed for the following formats:
+     * <p>The conversion is performed for the following formats:
      *  - {@link com.jme3.texture.Image.Format#RGB8}
      *  - {@link com.jme3.texture.Image.Format#RGBA8}
      *  - {@link com.jme3.texture.Image.Format#Luminance8}
@@ -419,20 +430,19 @@ public interface Renderer {
      *  - {@link com.jme3.texture.Image.Format#DXT3}
      *  - {@link com.jme3.texture.Image.Format#DXT5}
      *
-     * For all other formats, no conversion is performed.
-     *
-     * If this option is toggled at runtime, textures must be reloaded for the change to take effect.
+     * <p>For all other formats, no conversion is performed.
      *
-     * @throws RendererException If the GPU hardware does not support sRGB.
+     * <p>If this option is toggled at runtime, textures must be reloaded for the change to take effect.
      *
      * @param linearize If sRGB images undergo sRGB -&gt; linear conversion prior to rendering.
+     * @throws RendererException If the GPU hardware does not support sRGB.
      *
      * @see Caps#Srgb
      */
     public void setLinearizeSrgbImages(boolean linearize);
 
     /**
-     * Generates a pool of gpu queries meant to use as profiling tasks
+     * Generates a pool of gpu queries meant to use as profiling tasks.
      *
      * @param numTasks the number of task ids to generate
      * @return an array of tasks ids.
@@ -448,7 +458,7 @@ public interface Renderer {
     public void startProfiling(int taskId);
 
     /**
-     * Will stop the last profiling task started with startProfiling
+     * Will stop the last profiling task started with startProfiling.
      */
     public void stopProfiling();
 
@@ -457,7 +467,8 @@ public interface Renderer {
      * Note that the result may not be available right after stopProfiling has been called.
      * You need to check if the result is available with isTaskResultAvailable.
      * Also note that it's guaranteed that the result will be available on next frame.
-     * If you use getProfilingTime on the next frame you called stopProfiling, you don't need to check the result availability with isTaskResultAvailable
+     * If you use getProfilingTime on the next frame you called stopProfiling,
+     * you don't need to check the result availability with isTaskResultAvailable
      *
      * @param taskId the id of the task given by startProfiling.
      * @return the time in nano second of the profiling task with the given id.
@@ -465,7 +476,7 @@ public interface Renderer {
     public long getProfilingTime(int taskId);
 
     /**
-     * Check if the profiling results are available
+     * Checks if the profiling results are available.
      *
      * @param taskId the id of the task provided by startProfiling
      * @return true if the results of the task with the given task id are available.
@@ -480,21 +491,21 @@ public interface Renderer {
     public boolean getAlphaToCoverage();
 
     /**
-     * Get the default anisotropic filter level for textures.
+     * Gets the default anisotropic filter level for textures.
      *
      * @return the default filter level
      */
     public int getDefaultAnisotropicFilter();
 
     /**
-     * Determine the maximum allowed width for lines.
+     * Determines the maximum allowed width for lines.
      *
      * @return the maximum width (in pixels)
      */
     public float getMaxLineWidth();
 
     /**
-     * Test whether images with the sRGB flag will be linearized when read by a
+     * Tests whether images with the sRGB flag will be linearized when read by a
      * shader.
      *
      * @return true for linearization, false for no linearization
@@ -502,7 +513,7 @@ public interface Renderer {
     public boolean isLinearizeSrgbImages();
 
     /**
-     * Test whether colors rendered to the main framebuffer undergo
+     * Tests whether colors rendered to the main framebuffer undergo
      * linear-to-sRGB conversion.
      *
      * @return true for conversion, false for no conversion

+ 6 - 6
jme3-core/src/main/java/com/jme3/renderer/RendererException.java

@@ -32,19 +32,19 @@
 package com.jme3.renderer;
 
 /**
- * <code>RendererException</code> is raised when a renderer encounters
+ * Raised when a renderer encounters
  * a fatal rendering error.
- * 
+ *
  * @author Kirill Vainer
  */
 public class RendererException extends RuntimeException {
-    
+
     /**
-     * Creates a new instance of <code>RendererException</code>
+     * Creates a new instance of <code>RendererException</code>.
      *
-     * @param message the desired message text 
+     * @param message the desired message text
      */
-    public RendererException(String message){
+    public RendererException(String message) {
         super(message);
     }
 }

+ 141 - 70
jme3-core/src/main/java/com/jme3/renderer/Statistics.java

@@ -38,40 +38,85 @@ import com.jme3.texture.Image;
 import com.jme3.util.IntMap;
 
 /**
- * The statistics class allows tracking of real-time rendering statistics.
- * <p>
- * The <code>Statistics</code> can be retrieved by using {@link Renderer#getStatistics() }.
- * 
+ * Allows tracking of real-time rendering statistics.
+ *
+ * <p>The <code>Statistics</code> can be retrieved by using {@link Renderer#getStatistics() }.
+ *
  * @author Kirill Vainer
  */
 public class Statistics {
 
+    /**
+     * Enables or disables updates.
+     */
     protected boolean enabled = false;
 
+    /**
+     * Number of object used during the current frame.
+     */
     protected int numObjects;
+    /**
+     * Number of mesh primitives rendered during the current frame.
+     */
     protected int numTriangles;
+    /**
+     * Number of mesh vertices rendered during the current frame.
+     */
     protected int numVertices;
+    /**
+     * Number of shader switches during the current frame.
+     */
     protected int numShaderSwitches;
+    /**
+     * Number of texture binds during the current frame.
+     */
     protected int numTextureBinds;
+    /**
+     * Number of FBO switches during the current frame.
+     */
     protected int numFboSwitches;
+    /**
+     * Number of uniforms set during the current frame.
+     */
     protected int numUniformsSet;
 
+    /**
+     * Number of active shaders.
+     */
     protected int memoryShaders;
+    /**
+     * Number of active frame buffers.
+     */
     protected int memoryFrameBuffers;
+    /**
+     * Number of active textures.
+     */
     protected int memoryTextures;
 
+    /**
+     * IDs of all shaders in use.
+     */
     protected IntMap<Void> shadersUsed = new IntMap<>();
+    /**
+     * IDs of all textures in use.
+     */
     protected IntMap<Void> texturesUsed = new IntMap<>();
+    /**
+     * IDs of all FBOs in use.
+     */
     protected IntMap<Void> fbosUsed = new IntMap<>();
 
+    /**
+     * ID of the most recently used shader.
+     */
     protected int lastShader = -1;
-    
+
     /**
      * Returns a list of labels corresponding to each statistic.
-     * 
+     *
      * @return a list of labels corresponding to each statistic.
-     * 
-     * @see #getData(int[]) 
+     *
+     * @see #getData(int[])
      */
     public String[] getLabels(){
         return new String[]{ "Vertices",
@@ -96,12 +141,12 @@ public class Statistics {
 
     /**
      * Retrieves the statistics data into the given array.
-     * The array should be as large as the array given in 
+     * The array should be as large as the array given in
      * {@link #getLabels() }.
-     * 
+     *
      * @param data The data array to write to
      */
-    public void getData(int[] data){
+    public void getData(int[] data) {
         data[0] = numVertices;
         data[1] = numTriangles;
         data[2] = numUniformsSet;
@@ -114,7 +159,7 @@ public class Statistics {
         data[7] = numTextureBinds;
         data[8] = texturesUsed.size();
         data[9] = memoryTextures;
-        
+
         data[10] = numFboSwitches;
         data[11] = fbosUsed.size();
         data[12] = memoryFrameBuffers;
@@ -127,37 +172,39 @@ public class Statistics {
      * @param lod which level of detail
      * @param count multiplier for triangles and vertices
      */
-    public void onMeshDrawn(Mesh mesh, int lod, int count){
-        if( !enabled )
+    public void onMeshDrawn(Mesh mesh, int lod, int count) {
+        if (!enabled) {
             return;
-            
+        }
+
         numObjects += 1;
         numTriangles += mesh.getTriangleCount(lod) * count;
         numVertices += mesh.getVertexCount() * count;
     }
-    
+
     /**
      * Called by the Renderer when a mesh has been drawn.
      *
      * @param mesh the Mesh that was drawn (not null)
      * @param lod which level of detail
      */
-    public void onMeshDrawn(Mesh mesh, int lod){
+    public void onMeshDrawn(Mesh mesh, int lod) {
         onMeshDrawn(mesh, lod, 1);
     }
 
     /**
      * Called by the Renderer when a shader has been utilized.
-     * 
+     *
      * @param shader The shader that was used
      * @param wasSwitched If true, the shader has required a state switch
      */
-    public void onShaderUse(Shader shader, boolean wasSwitched){
+    public void onShaderUse(Shader shader, boolean wasSwitched) {
         assert shader.getId() >= 1;
 
-        if( !enabled )
+        if (!enabled) {
             return;
-        
+        }
+
         // Reduces unnecessary hashmap lookups if
         // we already considered this shader.
         if (lastShader != shader.getId()) {
@@ -167,63 +214,71 @@ public class Statistics {
             }
         }
 
-        if (wasSwitched)
+        if (wasSwitched) {
             numShaderSwitches++;
+        }
     }
 
     /**
      * Called by the Renderer when a uniform was set.
      */
-    public void onUniformSet(){
-        if( !enabled )
+    public void onUniformSet() {
+        if (!enabled) {
             return;
-        numUniformsSet ++;
+        }
+        numUniformsSet++;
     }
 
     /**
      * Called by the Renderer when a texture has been set.
-     * 
+     *
      * @param image The image that was set
      * @param wasSwitched If true, the texture has required a state switch
      */
-    public void onTextureUse(Image image, boolean wasSwitched){
+    public void onTextureUse(Image image, boolean wasSwitched) {
         assert image.getId() >= 1;
 
-        if( !enabled )
+        if (!enabled) {
             return;
-            
-        if (!texturesUsed.containsKey(image.getId()))
+        }
+
+        if (!texturesUsed.containsKey(image.getId())) {
             texturesUsed.put(image.getId(), null);
+        }
 
-        if (wasSwitched)
-            numTextureBinds ++;
+        if (wasSwitched) {
+            numTextureBinds++;
+        }
     }
 
     /**
      * Called by the Renderer when a framebuffer has been set.
-     * 
+     *
      * @param fb The framebuffer that was set
      * @param wasSwitched If true, the framebuffer required a state switch
      */
-    public void onFrameBufferUse(FrameBuffer fb, boolean wasSwitched){
-        if( !enabled )
+    public void onFrameBufferUse(FrameBuffer fb, boolean wasSwitched) {
+        if (!enabled) {
             return;
-            
-        if (fb != null){
+        }
+
+        if (fb != null) {
             assert fb.getId() >= 1;
 
-            if (!fbosUsed.containsKey(fb.getId()))
+            if (!fbosUsed.containsKey(fb.getId())) {
                 fbosUsed.put(fb.getId(), null);
+            }
         }
 
-        if (wasSwitched)
-            numFboSwitches ++;
+        if (wasSwitched) {
+            numFboSwitches++;
+        }
     }
-    
+
     /**
      * Clears all frame-specific statistics such as objects used per frame.
      */
-    public void clearFrame(){
+    public void clearFrame() {
         shadersUsed.clear();
         texturesUsed.clear();
         fbosUsed.clear();
@@ -235,77 +290,93 @@ public class Statistics {
         numTextureBinds = 0;
         numFboSwitches = 0;
         numUniformsSet = 0;
-        
+
         lastShader = -1;
     }
 
     /**
-     * Called by the Renderer when it creates a new shader
+     * Called by the Renderer when it creates a new shader.
      */
-    public void onNewShader(){
-        if( !enabled )
+    public void onNewShader() {
+        if (!enabled) {
             return;
-        memoryShaders ++;
+        }
+        memoryShaders++;
     }
 
     /**
-     * Called by the Renderer when it creates a new texture
+     * Called by the Renderer when it creates a new texture.
      */
-    public void onNewTexture(){
-        if( !enabled )
+    public void onNewTexture() {
+        if (!enabled) {
             return;
-        memoryTextures ++;
+        }
+        memoryTextures++;
     }
 
     /**
-     * Called by the Renderer when it creates a new framebuffer
+     * Called by the Renderer when it creates a new framebuffer.
      */
-    public void onNewFrameBuffer(){
-        if( !enabled )
+    public void onNewFrameBuffer() {
+        if (!enabled) {
             return;
-        memoryFrameBuffers ++;
+        }
+        memoryFrameBuffers++;
     }
 
     /**
-     * Called by the Renderer when it deletes a shader
+     * Called by the Renderer when it deletes a shader.
      */
-    public void onDeleteShader(){
-        if( !enabled )
+    public void onDeleteShader() {
+        if (!enabled) {
             return;
-        memoryShaders --;
+        }
+        memoryShaders--;
     }
 
     /**
-     * Called by the Renderer when it deletes a texture
+     * Called by the Renderer when it deletes a texture.
      */
-    public void onDeleteTexture(){
-        if( !enabled )
+    public void onDeleteTexture() {
+        if (!enabled) {
             return;
-        memoryTextures --;
+        }
+        memoryTextures--;
     }
 
     /**
-     * Called by the Renderer when it deletes a framebuffer
+     * Called by the Renderer when it deletes a framebuffer.
      */
-    public void onDeleteFrameBuffer(){
-        if( !enabled )
+    public void onDeleteFrameBuffer() {
+        if (!enabled) {
             return;
-        memoryFrameBuffers --;
+        }
+        memoryFrameBuffers--;
     }
 
     /**
      * Called when video memory is cleared.
      */
-    public void clearMemory(){
+    public void clearMemory() {
         memoryFrameBuffers = 0;
         memoryShaders = 0;
         memoryTextures = 0;
     }
 
-    public void setEnabled( boolean f ) {
+    /**
+     * Enables or disables updates.
+     *
+     * @param f true to enable, false to disable
+     */
+    public void setEnabled(boolean f) {
         this.enabled = f;
     }
-    
+
+    /**
+     * Tests whether updates are enabled.
+     *
+     * @return true if enabled, otherwise false
+     */
     public boolean isEnabled() {
         return enabled;
     }

+ 146 - 113
jme3-core/src/main/java/com/jme3/renderer/ViewPort.java

@@ -40,23 +40,23 @@ import com.jme3.texture.FrameBuffer;
 import com.jme3.util.SafeArrayList;
 
 /**
- * A <code>ViewPort</code> represents a view inside the display
- * window or a {@link FrameBuffer} to which scenes will be rendered. 
- * <p>
- * A viewport has a {@link #ViewPort(java.lang.String, com.jme3.renderer.Camera) camera}
+ * Represents a view inside the display
+ * window or a {@link FrameBuffer} to which scenes will be rendered.
+ *
+ * <p>A viewport has a {@link #ViewPort(java.lang.String, com.jme3.renderer.Camera) camera}
  * which is used to render a set of {@link #attachScene(com.jme3.scene.Spatial) scenes}.
- * A view port has a location on the screen as set by the 
+ * A view port has a location on the screen as set by the
  * {@link Camera#setViewPort(float, float, float, float) } method.
  * By default, a view port does not clear the framebuffer, but it can be
  * set to {@link #setClearFlags(boolean, boolean, boolean) clear the framebuffer}.
- * The background color which the color buffer is cleared to can be specified 
+ * The background color which the color buffer is cleared to can be specified
  * via the {@link #setBackgroundColor(com.jme3.math.ColorRGBA)} method.
- * <p>
- * A ViewPort has a list of {@link SceneProcessor}s which can
+ *
+ * <p>A ViewPort has a list of {@link SceneProcessor}s which can
  * control how the ViewPort is rendered by the {@link RenderManager}.
- * 
+ *
  * @author Kirill Vainer
- * 
+ *
  * @see RenderManager
  * @see SceneProcessor
  * @see Spatial
@@ -64,28 +64,60 @@ import com.jme3.util.SafeArrayList;
  */
 public class ViewPort {
 
+    /**
+     * Name for this viewport.
+     */
     protected final String name;
+    /**
+     * Camera used for rendering.
+     */
     protected final Camera cam;
+    /**
+     * Geometries for rendering, sorted.
+     */
     protected final RenderQueue queue = new RenderQueue();
+    /**
+     * Scene-graph hierarchies for rendering.
+     */
     protected final SafeArrayList<Spatial> sceneList = new SafeArrayList<>(Spatial.class);
+    /**
+     * Scene processors currently applied.
+     */
     protected final SafeArrayList<SceneProcessor> processors = new SafeArrayList<>(SceneProcessor.class);
+    /**
+     * FrameBuffer for output.
+     */
     protected FrameBuffer out = null;
 
-    protected final ColorRGBA backColor = new ColorRGBA(0,0,0,0);
-    protected boolean clearDepth = false, clearColor = false, clearStencil = false;
+    /**
+     * Color applied when the color buffer is cleared.
+     */
+    protected final ColorRGBA backColor = new ColorRGBA(0, 0, 0, 0);
+    /**
+     * Enables clearing the depth buffer.
+     */
+    protected boolean clearDepth = false;
+    /**
+     * Enables clearing the color buffer.
+     */
+    protected boolean clearColor = false;
+    /**
+     * Enables clearing the stencil buffer.
+     */
+    protected boolean clearStencil = false;
     private boolean enabled = true;
 
     /**
-     * Create a new viewport. User code should generally use these methods instead:<br>
+     * Creates a new viewport. User code should generally use these methods instead:<br>
      * <ul>
      * <li>{@link RenderManager#createPreView(java.lang.String, com.jme3.renderer.Camera) }</li>
      * <li>{@link RenderManager#createMainView(java.lang.String, com.jme3.renderer.Camera)  }</li>
      * <li>{@link RenderManager#createPostView(java.lang.String, com.jme3.renderer.Camera)  }</li>
      * </ul>
-     * 
+     *
      * @param name The name of the viewport. Used for debugging only.
      * @param cam The camera through which the viewport is rendered. The camera
-     * cannot be swapped to a different one after creating the viewport.
+     *     cannot be swapped to a different one after creating the viewport.
      */
     public ViewPort(String name, Camera cam) {
         this.name = name;
@@ -94,65 +126,65 @@ public class ViewPort {
 
     /**
      * Returns the name of the viewport as set in the constructor.
-     * 
+     *
      * @return the name of the viewport
-     * 
-     * @see #ViewPort(java.lang.String, com.jme3.renderer.Camera) 
+     *
+     * @see #ViewPort(java.lang.String, com.jme3.renderer.Camera)
      */
     public String getName() {
         return name;
     }
 
     /**
-     * Get the list of {@link SceneProcessor scene processors} that were
-     * added to this <code>ViewPort</code>
-     * 
+     * Gets the list of {@link SceneProcessor scene processors} that were
+     * added to this <code>ViewPort</code>.
+     *
      * @return the list of processors attached to this ViewPort
-     * 
-     * @see #addProcessor(com.jme3.post.SceneProcessor) 
+     *
+     * @see #addProcessor(com.jme3.post.SceneProcessor)
      */
-    public SafeArrayList<SceneProcessor> getProcessors(){
+    public SafeArrayList<SceneProcessor> getProcessors() {
         return processors;
     }
 
     /**
      * Adds a {@link SceneProcessor} to this ViewPort.
-     * <p>
-     * SceneProcessors that are added to the ViewPort will be notified
+     *
+     * <p>SceneProcessors that are added to the ViewPort will be notified
      * of events as the ViewPort is being rendered by the {@link RenderManager}.
-     * 
+     *
      * @param processor The processor to add
-     * 
+     *
      * @see SceneProcessor
      */
-    public void addProcessor(SceneProcessor processor){
+    public void addProcessor(SceneProcessor processor) {
         if (processor == null) {
-            throw new IllegalArgumentException( "Processor cannot be null." );
+            throw new IllegalArgumentException("Processor cannot be null.");
         }
         processors.add(processor);
     }
 
     /**
      * Removes a {@link SceneProcessor} from this ViewPort.
-     * <p>
-     * The processor will no longer receive events occurring to this ViewPort.
-     * 
+     *
+     * <p>The processor will no longer receive events occurring to this ViewPort.
+     *
      * @param processor The processor to remove
-     * 
+     *
      * @see SceneProcessor
      */
-    public void removeProcessor(SceneProcessor processor){
+    public void removeProcessor(SceneProcessor processor) {
         if (processor == null) {
-            throw new IllegalArgumentException( "Processor cannot be null." );
+            throw new IllegalArgumentException("Processor cannot be null.");
         }
         processors.remove(processor);
         processor.cleanup();
     }
-    
+
     /**
      * Removes all {@link SceneProcessor scene processors} from this
-     * ViewPort. 
-     * 
+     * ViewPort.
+     *
      * @see SceneProcessor
      */
     public void clearProcessors() {
@@ -163,21 +195,21 @@ public class ViewPort {
     }
 
     /**
-     * Check if depth buffer clearing is enabled.
-     * 
+     * Checks if depth buffer clearing is enabled.
+     *
      * @return true if depth buffer clearing is enabled.
-     * 
-     * @see #setClearDepth(boolean) 
+     *
+     * @see #setClearDepth(boolean)
      */
     public boolean isClearDepth() {
         return clearDepth;
     }
 
     /**
-     * Enable or disable clearing of the depth buffer for this ViewPort.
-     * <p>
-     * By default depth clearing is disabled.
-     * 
+     * Enables or disables clearing of the depth buffer for this ViewPort.
+     *
+     * <p>By default depth clearing is disabled.
+     *
      * @param clearDepth Enable/disable depth buffer clearing.
      */
     public void setClearDepth(boolean clearDepth) {
@@ -185,21 +217,21 @@ public class ViewPort {
     }
 
     /**
-     * Check if color buffer clearing is enabled.
-     * 
+     * Checks if color buffer clearing is enabled.
+     *
      * @return true if color buffer clearing is enabled.
-     * 
-     * @see #setClearColor(boolean) 
+     *
+     * @see #setClearColor(boolean)
      */
     public boolean isClearColor() {
         return clearColor;
     }
 
     /**
-     * Enable or disable clearing of the color buffer for this ViewPort.
-     * <p>
-     * By default color clearing is disabled.
-     * 
+     * Enables or disables clearing of the color buffer for this ViewPort.
+     *
+     * <p>By default color clearing is disabled.
+     *
      * @param clearColor Enable/disable color buffer clearing.
      */
     public void setClearColor(boolean clearColor) {
@@ -207,21 +239,21 @@ public class ViewPort {
     }
 
     /**
-     * Check if stencil buffer clearing is enabled.
-     * 
+     * Checks if stencil buffer clearing is enabled.
+     *
      * @return true if stencil buffer clearing is enabled.
-     * 
-     * @see #setClearStencil(boolean) 
+     *
+     * @see #setClearStencil(boolean)
      */
     public boolean isClearStencil() {
         return clearStencil;
     }
 
     /**
-     * Enable or disable clearing of the stencil buffer for this ViewPort.
-     * <p>
-     * By default stencil clearing is disabled.
-     * 
+     * Enables or disables clearing of the stencil buffer for this ViewPort.
+     *
+     * <p>By default stencil clearing is disabled.
+     *
      * @param clearStencil Enable/disable stencil buffer clearing.
      */
     public void setClearStencil(boolean clearStencil) {
@@ -229,17 +261,17 @@ public class ViewPort {
     }
 
     /**
-     * Set the clear flags (color, depth, stencil) in one call.
-     * 
+     * Sets the clear flags (color, depth, stencil) in one call.
+     *
      * @param color If color buffer clearing should be enabled.
      * @param depth If depth buffer clearing should be enabled.
      * @param stencil If stencil buffer clearing should be enabled.
-     * 
-     * @see #setClearColor(boolean) 
-     * @see #setClearDepth(boolean) 
-     * @see #setClearStencil(boolean) 
+     *
+     * @see #setClearColor(boolean)
+     * @see #setClearDepth(boolean)
+     * @see #setClearStencil(boolean)
      */
-    public void setClearFlags(boolean color, boolean depth, boolean stencil){
+    public void setClearFlags(boolean color, boolean depth, boolean stencil) {
         this.clearColor = color;
         this.clearDepth = depth;
         this.clearStencil = stencil;
@@ -248,11 +280,11 @@ public class ViewPort {
     /**
      * Returns the framebuffer where this ViewPort's scenes are
      * rendered to.
-     * 
+     *
      * @return the framebuffer where this ViewPort's scenes are
-     * rendered to.
-     * 
-     * @see #setOutputFrameBuffer(com.jme3.texture.FrameBuffer) 
+     *     rendered to.
+     *
+     * @see #setOutputFrameBuffer(com.jme3.texture.FrameBuffer)
      */
     public FrameBuffer getOutputFrameBuffer() {
         return out;
@@ -260,13 +292,13 @@ public class ViewPort {
 
     /**
      * Sets the output framebuffer for the ViewPort.
-     * <p>
-     * The output framebuffer specifies where the scenes attached
+     *
+     * <p>The output framebuffer specifies where the scenes attached
      * to this ViewPort are rendered to. By default this is <code>null</code>
      * which indicates the scenes are rendered to the display window.
-     * 
+     *
      * @param out The framebuffer to render scenes to, or null if to render
-     * to the screen.
+     *     to the screen.
      */
     public void setOutputFrameBuffer(FrameBuffer out) {
         this.out = out;
@@ -274,9 +306,9 @@ public class ViewPort {
 
     /**
      * Returns the camera which renders the attached scenes.
-     * 
+     *
      * @return the camera which renders the attached scenes.
-     * 
+     *
      * @see Camera
      */
     public Camera getCamera() {
@@ -285,7 +317,7 @@ public class ViewPort {
 
     /**
      * Internal use only.
-     * 
+     *
      * @return the pre-existing instance
      */
     public RenderQueue getQueue() {
@@ -294,14 +326,14 @@ public class ViewPort {
 
     /**
      * Attaches a new scene to render in this ViewPort.
-     * 
+     *
      * @param scene The scene to attach
-     * 
+     *
      * @see Spatial
      */
-    public void attachScene(Spatial scene){
+    public void attachScene(Spatial scene) {
         if (scene == null) {
-            throw new IllegalArgumentException( "Scene cannot be null." );
+            throw new IllegalArgumentException("Scene cannot be null.");
         }
         sceneList.add(scene);
         if (scene instanceof Geometry) {
@@ -311,14 +343,14 @@ public class ViewPort {
 
     /**
      * Detaches a scene from rendering.
-     * 
+     *
      * @param scene The scene to detach
-     * 
-     * @see #attachScene(com.jme3.scene.Spatial) 
+     *
+     * @see #attachScene(com.jme3.scene.Spatial)
      */
-    public void detachScene(Spatial scene){
+    public void detachScene(Spatial scene) {
         if (scene == null) {
-            throw new IllegalArgumentException( "Scene cannot be null." );
+            throw new IllegalArgumentException("Scene cannot be null.");
         }
         sceneList.remove(scene);
         if (scene instanceof Geometry) {
@@ -328,8 +360,8 @@ public class ViewPort {
 
     /**
      * Removes all attached scenes.
-     * 
-     * @see #attachScene(com.jme3.scene.Spatial) 
+     *
+     * @see #attachScene(com.jme3.scene.Spatial)
      */
     public void clearScenes() {
         sceneList.clear();
@@ -337,56 +369,57 @@ public class ViewPort {
 
     /**
      * Returns a list of all attached scenes.
-     * 
+     *
      * @return a list of all attached scenes.
-     * 
-     * @see #attachScene(com.jme3.scene.Spatial) 
+     *
+     * @see #attachScene(com.jme3.scene.Spatial)
      */
-    public SafeArrayList<Spatial> getScenes(){
+    public SafeArrayList<Spatial> getScenes() {
         return sceneList;
     }
 
     /**
      * Sets the background color.
-     * <p>
-     * When the ViewPort's color buffer is cleared 
-     * (if {@link #setClearColor(boolean) color clearing} is enabled), 
+     *
+     * <p>When the ViewPort's color buffer is cleared
+     * (if {@link #setClearColor(boolean) color clearing} is enabled),
      * this specifies the color to which the color buffer is set to.
      * By default the background color is black without alpha.
-     * 
+     *
      * @param background the background color.
      */
-    public void setBackgroundColor(ColorRGBA background){
+    public void setBackgroundColor(ColorRGBA background) {
         backColor.set(background);
     }
 
     /**
-     * Returns the background color of this ViewPort
-     * 
+     * Returns the background color of this ViewPort.
+     *
      * @return the background color of this ViewPort
-     * 
-     * @see #setBackgroundColor(com.jme3.math.ColorRGBA) 
+     *
+     * @see #setBackgroundColor(com.jme3.math.ColorRGBA)
      */
-    public ColorRGBA getBackgroundColor(){
+    public ColorRGBA getBackgroundColor() {
         return backColor;
     }
-    
+
     /**
-     * Enable or disable this ViewPort.
-     * <p>
-     * Disabled ViewPorts are skipped by the {@link RenderManager} when
+     * Enables or disables this ViewPort.
+     *
+     * <p>Disabled ViewPorts are skipped by the {@link RenderManager} when
      * rendering. By default all ViewPorts are enabled.
-     * 
+     *
      * @param enable If the viewport should be disabled or enabled.
      */
     public void setEnabled(boolean enable) {
         this.enabled = enable;
     }
-    
+
     /**
      * Returns true if the viewport is enabled, false otherwise.
+     *
      * @return true if the viewport is enabled, false otherwise.
-     * @see #setEnabled(boolean) 
+     * @see #setEnabled(boolean)
      */
     public boolean isEnabled() {
         return enabled;

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.