Selaa lähdekoodia

- cleanup VideoRecorderAppState

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8707 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 14 vuotta sitten
vanhempi
commit
0420b4121e
1 muutettua tiedostoa jossa 43 lisäystä ja 47 poistoa
  1. 43 47
      engine/src/desktop/com/jme3/app/state/VideoRecorderAppState.java

+ 43 - 47
engine/src/desktop/com/jme3/app/state/VideoRecorderAppState.java

@@ -47,53 +47,16 @@ public class VideoRecorderAppState extends AbstractAppState {
         super.cleanup();
     }
 
-    public static final class IsoTimer extends com.jme3.system.Timer {
-
-        private float framerate;
-        private int ticks;
-
-        public IsoTimer(float framerate) {
-            this.framerate = framerate;
-            this.ticks = 0;
-        }
-
-        public long getTime() {
-            return (long) (this.ticks * (1.0f / this.framerate));
-        }
-
-        public long getResolution() {
-            return 1000000000L;
-        }
-
-        public float getFrameRate() {
-            return this.framerate;
-        }
-
-        public float getTimePerFrame() {
-            return (float) (1.0f / this.framerate);
-        }
-
-        public void update() {
-            this.ticks++;
-        }
-
-        public void reset() {
-            this.ticks = 0;
-        }
-    }
-
     public class VideoProcessor implements SceneProcessor {
 
-        Camera camera;
-        int width;
-        int height;
-        FrameBuffer frameBuffer;
-        RenderManager renderManager;
-        ByteBuffer byteBuffer;
-        BufferedImage rawFrame;
-        int videoChannel = 0;
-        long currentTimeStamp = 0;
-        boolean isInitilized = false;
+        private Camera camera;
+        private int width;
+        private int height;
+        private FrameBuffer frameBuffer;
+        private RenderManager renderManager;
+        private ByteBuffer byteBuffer;
+        private BufferedImage rawFrame;
+        private boolean isInitilized = false;
 
         public void initialize(RenderManager rm, ViewPort viewPort) {
             this.camera = viewPort.getCamera();
@@ -130,7 +93,6 @@ public class VideoRecorderAppState extends AbstractAppState {
             byteBuffer.clear();
             renderManager.getRenderer().readFrameBuffer(out, byteBuffer);
             synchronized (rawFrame) {
-                rawFrame.getGraphics().clearRect(0, 0, width, height);
                 Screenshots.convertScreenShot(byteBuffer, rawFrame);
                 try {
                     writer.addImage(rawFrame);
@@ -138,7 +100,6 @@ public class VideoRecorderAppState extends AbstractAppState {
                     Logger.getLogger(VideoRecorderAppState.class.getName()).log(Level.SEVERE, "Error writing frame: {0}", ex);
                 }
             }
-            currentTimeStamp += (long) (1000000000.0 / (double) framerate);
         }
 
         public void cleanup() {
@@ -149,4 +110,39 @@ public class VideoRecorderAppState extends AbstractAppState {
             }
         }
     }
+
+    public static final class IsoTimer extends com.jme3.system.Timer {
+
+        private float framerate;
+        private int ticks;
+
+        public IsoTimer(float framerate) {
+            this.framerate = framerate;
+            this.ticks = 0;
+        }
+
+        public long getTime() {
+            return (long) (this.ticks * (1.0f / this.framerate));
+        }
+
+        public long getResolution() {
+            return 1000000000L;
+        }
+
+        public float getFrameRate() {
+            return this.framerate;
+        }
+
+        public float getTimePerFrame() {
+            return (float) (1.0f / this.framerate);
+        }
+
+        public void update() {
+            this.ticks++;
+        }
+
+        public void reset() {
+            this.ticks = 0;
+        }
+    }
 }