view src/com/aurellem/capture/hello/HelloVideo.java @ 6:0634e72bad3e

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