changeset 4:edaa7e7806e4

migrated IsoTimer
author Robert McIntyre <rlm@mit.edu>
date Tue, 25 Oct 2011 12:03:01 -0700
parents a92de00f0414
children 0e966c8a3e3d
files src/com/aurellem/capture/AbstractVideoRecorder.java src/com/aurellem/capture/IsoTimer.java src/com/aurellem/capture/PrintTimer.java src/com/aurellem/capture/hello/HelloAudio.java src/com/aurellem/capture/hello/HelloVideo.java
diffstat 5 files changed, 49 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/src/com/aurellem/capture/AbstractVideoRecorder.java	Tue Oct 25 11:55:55 2011 -0700
     1.2 +++ b/src/com/aurellem/capture/AbstractVideoRecorder.java	Tue Oct 25 12:03:01 2011 -0700
     1.3 @@ -13,7 +13,6 @@
     1.4  import com.jme3.renderer.RenderManager;
     1.5  import com.jme3.renderer.ViewPort;
     1.6  import com.jme3.renderer.queue.RenderQueue;
     1.7 -import com.jme3.system.IsoTimer;
     1.8  import com.jme3.texture.FrameBuffer;
     1.9  import com.jme3.util.BufferUtils;
    1.10  import com.jme3.util.Screenshots;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/com/aurellem/capture/IsoTimer.java	Tue Oct 25 12:03:01 2011 -0700
     2.3 @@ -0,0 +1,30 @@
     2.4 +package com.aurellem.capture;
     2.5 +
     2.6 +import com.jme3.system.Timer;
     2.7 +
     2.8 +public class IsoTimer extends Timer {
     2.9 +
    2.10 +	private float framerate;
    2.11 +	private int ticks;
    2.12 +	
    2.13 +	public IsoTimer(float framerate){
    2.14 +		this.framerate = framerate;
    2.15 +		this.ticks = 0;}
    2.16 +	
    2.17 +	public long getTime() {
    2.18 +		return (long) (this.ticks / this.framerate);}
    2.19 +	
    2.20 +	public long getResolution() {
    2.21 +		return 1000000000L;}
    2.22 +	
    2.23 +	public float getFrameRate() {
    2.24 +		return this.framerate;}
    2.25 +	
    2.26 +	public float getTimePerFrame() {
    2.27 +		return (float) (1.0f / this.framerate);}
    2.28 +
    2.29 +	public void update() {this.ticks++;}
    2.30 +	
    2.31 +	public void reset() {this.ticks = 0;}
    2.32 +
    2.33 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/com/aurellem/capture/PrintTimer.java	Tue Oct 25 12:03:01 2011 -0700
     3.3 @@ -0,0 +1,17 @@
     3.4 +package com.aurellem.capture;
     3.5 +
     3.6 +import com.jme3.system.NanoTimer;
     3.7 +
     3.8 +public class PrintTimer extends NanoTimer{
     3.9 +
    3.10 +	public PrintTimer(){
    3.11 +		super();
    3.12 +		System.out.println("hi");}
    3.13 +	
    3.14 +		
    3.15 +	public float getTimePerFrame() {
    3.16 +		System.out.println("RLM: I'm a timer!");
    3.17 +		return super.getTimePerFrame();
    3.18 +	}	
    3.19 +
    3.20 +}
     4.1 --- a/src/com/aurellem/capture/hello/HelloAudio.java	Tue Oct 25 11:55:55 2011 -0700
     4.2 +++ b/src/com/aurellem/capture/hello/HelloAudio.java	Tue Oct 25 12:03:01 2011 -0700
     4.3 @@ -4,6 +4,7 @@
     4.4  import java.util.logging.Level;
     4.5  import java.util.logging.Logger;
     4.6  
     4.7 +import com.aurellem.capture.IsoTimer;
     4.8  import com.aurellem.capture.MultiListener;
     4.9  import com.aurellem.capture.WaveFileWriter;
    4.10  import com.jme3.app.SimpleApplication;
    4.11 @@ -18,7 +19,6 @@
    4.12  import com.jme3.scene.Geometry;
    4.13  import com.jme3.scene.shape.Box;
    4.14  import com.jme3.system.AppSettings;
    4.15 -import com.jme3.system.IsoTimer;
    4.16  
    4.17  /** Sample 11 - playing 3D audio. */
    4.18  public class HelloAudio extends SimpleApplication {
     5.1 --- a/src/com/aurellem/capture/hello/HelloVideo.java	Tue Oct 25 11:55:55 2011 -0700
     5.2 +++ b/src/com/aurellem/capture/hello/HelloVideo.java	Tue Oct 25 12:03:01 2011 -0700
     5.3 @@ -6,6 +6,7 @@
     5.4  import com.aurellem.capture.AVIVideoRecorder;
     5.5  import com.aurellem.capture.AbstractVideoRecorder;
     5.6  import com.aurellem.capture.Capture;
     5.7 +import com.aurellem.capture.IsoTimer;
     5.8  import com.jme3.app.SimpleApplication;
     5.9  import com.jme3.material.Material;
    5.10  import com.jme3.math.ColorRGBA;
    5.11 @@ -13,7 +14,6 @@
    5.12  import com.jme3.renderer.ViewPort;
    5.13  import com.jme3.scene.Geometry;
    5.14  import com.jme3.scene.shape.Box;
    5.15 -import com.jme3.system.IsoTimer;
    5.16  
    5.17  /** Recording Video from an application suitable for upload to youtube.*/
    5.18  public class HelloVideo extends SimpleApplication {