Fixed git clone URL
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / gui / ViewPanel.java
index f6603a0..e068bf5 100755 (executable)
@@ -28,11 +28,18 @@ public class ViewPanel extends JPanel implements ComponentListener {
     private final ShapeCollection rootShapeCollection = new ShapeCollection();
     private final Set<ViewRenderListener> viewRenderListeners = ConcurrentHashMap.newKeySet();
     public Color backgroundColor = Color.BLACK;
+
     /**
-     * Last time this view was updated.
+     * Stores milliseconds when last frame was updated. This is needed to calculate time delta between frames.
+     * Time delta is used to calculate smooth animation.
      */
     private long lastUpdateMillis = 0;
+
+    /**
+     * Timer that is used to update canvas at target FPS rate.
+     */
     private Timer canvasUpdateTimer;
+
     private ViewUpdateTimerTask canvasUpdateTimerTask;
     private RenderingContext renderingContext = null;
 
@@ -192,7 +199,7 @@ public class ViewPanel extends JPanel implements ComponentListener {
      * It tells view to update itself. View can decide if actual re-rendering of
      * graphics is needed.
      */
-    void updateView() {
+    void ensureThatViewIsUpToDate() {
         maintainRenderingContext();
 
         final int millisecondsPassedSinceLastUpdate = getMillisecondsPassedSinceLastUpdate();
@@ -221,6 +228,7 @@ public class ViewPanel extends JPanel implements ComponentListener {
             return;
         }
 
+        // create new rendering context if window size has changed
         if ((renderingContext == null)
                 || (renderingContext.width != panelWidth)
                 || (renderingContext.height != panelHeight)) {