rlm@0: package com.aurellem.capture.hello; rlm@0: rlm@0: import java.io.File; rlm@0: import java.io.IOException; rlm@0: rlm@3: import com.aurellem.capture.Capture; rlm@4: import com.aurellem.capture.IsoTimer; rlm@9: import com.aurellem.capture.video.AVIVideoRecorder; rlm@9: import com.aurellem.capture.video.AbstractVideoRecorder; rlm@0: import com.jme3.app.SimpleApplication; rlm@0: import com.jme3.material.Material; rlm@0: import com.jme3.math.ColorRGBA; rlm@0: import com.jme3.math.Vector3f; rlm@0: import com.jme3.renderer.ViewPort; rlm@0: import com.jme3.scene.Geometry; rlm@0: import com.jme3.scene.shape.Box; rlm@0: rlm@0: /** Recording Video from an application suitable for upload to youtube.*/ rlm@0: public class HelloVideo extends SimpleApplication { rlm@0: rlm@0: /*File staticVideo = rlm@0: new File("/home/r/bullshit.avi"); rlm@0: */ rlm@0: File movingVideo = rlm@0: new File("/home/r/tmp/bullshit2.avi"); rlm@0: rlm@0: AbstractVideoRecorder movingRecorder ; rlm@0: rlm@0: public static void main(String[] args){ rlm@0: HelloVideo app = new HelloVideo(); rlm@0: app.start(); rlm@0: } rlm@0: rlm@0: public void initVideo(){ rlm@0: this.setTimer(new IsoTimer(60)); rlm@0: /*try{ rlm@0: // set the timer to 30fps lock-step rlm@0: this.setTimer(new IsoTimer(30)); rlm@0: rlm@0: //ViewPort compositeViewPort = renderManager.createFinalView("composite", cam); rlm@0: //compositeViewPort.attachScene(this.rootNode); rlm@0: //compositeViewPort.attachScene(this.guiNode); rlm@0: this.viewPort.setClearFlags(true, true, true); rlm@0: this.viewPort.setBackgroundColor(ColorRGBA.Black); rlm@0: movingRecorder = new AVIVideoRecorder(movingVideo); rlm@0: this.stateManager.attach(movingRecorder); rlm@0: this.viewPort.addFinalProcessor(movingRecorder); rlm@0: this.viewPort.attachScene(this.guiNode); rlm@0: rlm@0: }catch (IOException e) { rlm@0: e.printStackTrace();} rlm@0: */ rlm@0: try {Capture.SimpleCaptureVideo(this, movingVideo);} rlm@0: catch (IOException e) {e.printStackTrace();} rlm@0: rlm@0: } rlm@0: protected Geometry player; rlm@0: rlm@0: public void simpleInitApp() { rlm@0: initVideo(); // begin recording! rlm@0: /** this blue box is our player character */ rlm@0: Box b = new Box(Vector3f.ZERO, 1, 1, 1); rlm@0: player = new Geometry("blue cube", b); rlm@0: Material mat = new Material(assetManager, rlm@0: "Common/MatDefs/Misc/Unshaded.j3md"); rlm@0: mat.setColor("Color", ColorRGBA.Blue); rlm@0: player.setMaterial(mat); rlm@0: rootNode.attachChild(player); rlm@0: } rlm@0: rlm@0: /* Use the main event loop to trigger repeating actions. */ rlm@0: public void simpleUpdate(float tpf) { rlm@0: // make the player rotate: rlm@0: player.rotate(0, 2*tpf, 0); rlm@0: } rlm@0: rlm@0: }