annotate src/com/aurellem/capture/examples/AdvancedVideo.java @ 26:95648b0c12bc

code reformating
author Robert McIntyre <rlm@mit.edu>
date Sun, 30 Oct 2011 04:43:39 -0700
parents e299cd89074d
children
rev   line source
rlm@14 1 package com.aurellem.capture.examples;
rlm@14 2
rlm@14 3 import java.io.File;
rlm@14 4 import java.io.IOException;
rlm@14 5
rlm@14 6 import com.aurellem.capture.Capture;
rlm@14 7 import com.aurellem.capture.IsoTimer;
rlm@14 8 import com.aurellem.capture.video.AbstractVideoRecorder;
rlm@14 9 import com.jme3.app.SimpleApplication;
rlm@14 10 import com.jme3.material.Material;
rlm@14 11 import com.jme3.math.ColorRGBA;
rlm@14 12 import com.jme3.math.Vector3f;
rlm@14 13 import com.jme3.scene.Geometry;
rlm@14 14 import com.jme3.scene.shape.Box;
rlm@14 15
rlm@14 16 /** Recording Video from an application suitable for upload to youtube.*/
rlm@14 17 public class AdvancedVideo extends SimpleApplication {
rlm@14 18
rlm@14 19 /*File staticVideo =
rlm@14 20 new File("/home/r/bullshit.avi");
rlm@14 21 */
rlm@14 22 File movingVideo =
rlm@14 23 new File("/home/r/tmp/bullshit2.flv");
rlm@14 24
rlm@14 25 AbstractVideoRecorder movingRecorder ;
rlm@14 26
rlm@14 27 public static void main(String[] args){
rlm@14 28 AdvancedVideo app = new AdvancedVideo();
rlm@14 29 app.start();
rlm@14 30 }
rlm@14 31
rlm@14 32 public void initVideo(){
rlm@14 33 this.setTimer(new IsoTimer(60));
rlm@14 34 /*try{
rlm@14 35 // set the timer to 30fps lock-step
rlm@14 36 this.setTimer(new IsoTimer(30));
rlm@14 37
rlm@14 38 //ViewPort compositeViewPort = renderManager.createFinalView("composite", cam);
rlm@14 39 //compositeViewPort.attachScene(this.rootNode);
rlm@14 40 //compositeViewPort.attachScene(this.guiNode);
rlm@14 41 this.viewPort.setClearFlags(true, true, true);
rlm@14 42 this.viewPort.setBackgroundColor(ColorRGBA.Black);
rlm@14 43 movingRecorder = new AVIVideoRecorder(movingVideo);
rlm@14 44 this.stateManager.attach(movingRecorder);
rlm@14 45 this.viewPort.addFinalProcessor(movingRecorder);
rlm@14 46 this.viewPort.attachScene(this.guiNode);
rlm@14 47
rlm@14 48 }catch (IOException e) {
rlm@14 49 e.printStackTrace();}
rlm@14 50 */
rlm@14 51 try {Capture.captureVideo(this, movingVideo);}
rlm@14 52 catch (IOException e) {e.printStackTrace();}
rlm@14 53
rlm@14 54 }
rlm@14 55 protected Geometry player;
rlm@14 56
rlm@14 57 public void simpleInitApp() {
rlm@14 58 initVideo(); // begin recording!
rlm@14 59 /** this blue box is our player character */
rlm@14 60 Box b = new Box(Vector3f.ZERO, 1, 1, 1);
rlm@14 61 player = new Geometry("blue cube", b);
rlm@14 62 Material mat = new Material(assetManager,
rlm@14 63 "Common/MatDefs/Misc/Unshaded.j3md");
rlm@14 64 mat.setColor("Color", ColorRGBA.Blue);
rlm@14 65 player.setMaterial(mat);
rlm@14 66 rootNode.attachChild(player);
rlm@14 67 }
rlm@14 68
rlm@14 69 /* Use the main event loop to trigger repeating actions. */
rlm@14 70 public void simpleUpdate(float tpf) {
rlm@14 71 // make the player rotate:
rlm@14 72 player.rotate(0, 2*tpf, 0);
rlm@14 73 }
rlm@14 74
rlm@14 75 }