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