annotate src/com/aurellem/capture/hello/HelloVideo.java @ 9:5dfc9e768816

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