Mercurial > jmeCapture
view src/com/aurellem/capture/Capture.java @ 11:8a6b1684f536
refactored.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 27 Oct 2011 02:27:02 -0700 |
parents | 4c5fc53778c1 |
children | d10f4d4ff15a |
line wrap: on
line source
1 package com.aurellem.capture;3 import java.io.File;4 import java.io.IOException;6 import com.aurellem.capture.video.AVIVideoRecorder;7 import com.aurellem.capture.video.AbstractVideoRecorder;8 import com.aurellem.capture.video.XuggleVideoRecorder;9 import com.jme3.app.Application;10 import com.jme3.math.ColorRGBA;12 public class Capture {14 public static void SimpleCaptureVideo(Application app, File file) throws IOException{15 app.getViewPort().setClearFlags(true, true, true);16 // this prevents pixels from staying in the render buffer between frames17 // and messing the video up. It's not a problem since Black is the default, and this18 // can be overridden by user code.19 app.getViewPort().setBackgroundColor(ColorRGBA.Black);21 // The XuggleVideoRecorder is better than the AVIVideoRecorder in every way22 // except for ease of installation. The excellent work by Werner Randelshofer23 // is used as a fallback option. Please visit http://www.xuggle.com/ to learn24 // how to set up the XuggleVideoRecorder.26 AbstractVideoRecorder videoRecorder;28 if (file.getCanonicalPath().endsWith(".avi")){29 videoRecorder = new AVIVideoRecorder(file);}30 else { videoRecorder = new XuggleVideoRecorder(file);}32 app.getStateManager().attach(videoRecorder);33 app.getViewPort().addFinalProcessor(videoRecorder);34 }35 }