Mercurial > jmeCapture
comparison src/com/aurellem/capture/examples/AdvancedVideo.java @ 14:e299cd89074d
creating Advanced Audio documentation.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 27 Oct 2011 21:55:51 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13:6dc62c7866c2 | 14:e299cd89074d |
---|---|
1 package com.aurellem.capture.examples; | |
2 | |
3 import java.io.File; | |
4 import java.io.IOException; | |
5 | |
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; | |
15 | |
16 /** Recording Video from an application suitable for upload to youtube.*/ | |
17 public class AdvancedVideo extends SimpleApplication { | |
18 | |
19 /*File staticVideo = | |
20 new File("/home/r/bullshit.avi"); | |
21 */ | |
22 File movingVideo = | |
23 new File("/home/r/tmp/bullshit2.flv"); | |
24 | |
25 AbstractVideoRecorder movingRecorder ; | |
26 | |
27 public static void main(String[] args){ | |
28 AdvancedVideo app = new AdvancedVideo(); | |
29 app.start(); | |
30 } | |
31 | |
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)); | |
37 | |
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); | |
47 | |
48 }catch (IOException e) { | |
49 e.printStackTrace();} | |
50 */ | |
51 try {Capture.captureVideo(this, movingVideo);} | |
52 catch (IOException e) {e.printStackTrace();} | |
53 | |
54 } | |
55 protected Geometry player; | |
56 | |
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 } | |
68 | |
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 } | |
74 | |
75 } |