コード例 #1
0
ファイル: svvimApp.cpp プロジェクト: mattvvhat/svvim
void svvimApp::update() {
  float noise = mPerlinGenerator.fBm(Vec2f(0., app::getElapsedSeconds()));
  
  app::console() << noise << "\n";
  // Update alpha values
  getAlpha();

  if (mPoolWaterMovie)
    mMaskTexture = mPoolWaterMovie.getTexture();
  
  if (mCurrentMovie.isDone()) {
    incrementMovie();
  }
  
  app::console() << 10 * app::getElapsedSeconds() << "\n";
  

  mImageTexture = mCurrentMovie.getTexture();
  
  //mImageTexture = mCurrentBgTexture;
  
  // ...
  
  

}
コード例 #2
0
void QuickTimeSampleApp::loadMovieFile( const fs::path& moviePath )
{
	try {
		// load up the movie, set it to loop, and begin playing
		mMovie = qtime::MovieGl( moviePath );
		mMovie.setLoop();
		mMovie.play();
		
		// create a texture for showing some info about the movie
		TextLayout infoText;
		infoText.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) );
		infoText.setColor( Color::white() );
		infoText.addCenteredLine( getPathFileName( moviePath.string() ) );
		infoText.addLine( toString( mMovie.getWidth() ) + " x " + toString( mMovie.getHeight() ) + " pixels" );
		infoText.addLine( toString( mMovie.getDuration() ) + " seconds" );
		infoText.addLine( toString( mMovie.getNumFrames() ) + " frames" );
		infoText.addLine( toString( mMovie.getFramerate() ) + " fps" );
		infoText.setBorder( 4, 2 );
		mInfoTexture = gl::Texture( infoText.render( true ) );
	}
	catch( ... ) {
		console() << "Unable to load the movie." << std::endl;
		mMovie.reset();
		mInfoTexture.reset();
	}

	mFrameTexture.reset();
}
コード例 #3
0
ファイル: VideoPanApp.cpp プロジェクト: flimshaw/VideoPan
void VideoPanApp::update()
{
	if( mMovie.checkNewFrame() ) {
		mMovieFrame = gl::Texture(mMovie.getTexture());
		if( particleCount < maxParticles ) {
			mParticleController.addParticle( gl::Texture(mMovie.getTexture()) );
			particleCount++;
			mMovie.stepForward();
		}
	} else {
		mParticleController.setWidth(mParticleWidth);
		mParticleController.setPixelOffset(mPixelOffset);
		mParticleController.update();
	}
}
コード例 #4
0
void ProjectionMappingApp::update()
{
	this->updateBezierMesh();// update

	gl::setMatricesWindow(getWindowSize(), false); // 画像の表示を上向きにする
	mFbo.bindFramebuffer();
	gl::clear(Color(0, 0, 0));

	mShader.bind();
	mShader.uniform("diffuseMap", 0);

#if 0
	mMovie.getTexture().bind(0);
#else 
	if (mEditMode == EditMode_EDIT) {
		if (mDispMode == DispMode_MOVIE && mHasMovie) {
			mMovie.getTexture().bind(0);
		} else {
			mDiffuseTex[mDispMode].bind(0);
		}
	} else if (mEditMode == EditMode_RECORD) {
		if (mFrame <= mDuration) {
			gl::Texture::Format texformat;
			texformat.setTargetRect();

			std::string imgName = (boost::format("%s\\%s_%05d.png") % mInImageFolder % mInImageName % mFrame).str();
			if (boost::filesystem::exists(boost::filesystem::path(imgName))) {
				mDiffuseTex[mDispMode] = gl::Texture(loadImage(imgName.c_str()), texformat);
			}
			else {
				mDispMode = DispMode_GUIDE;
				mEditMode = EditMode_EDIT;
			}
		} else {
			mEditMode = EditMode_EDIT;
		}
	}
#endif

	gl::draw(mMesh);
	mShader.unbind();

	mFbo.unbindFramebuffer();
}
コード例 #5
0
ファイル: svvimApp.cpp プロジェクト: mattvvhat/svvim
/**
 * Increment Movie
 * Restarts and stpos current movie, then begins playing next movie in mMovieList without volumne.
 */
void svvimApp::incrementMovie () {
  mCurrentMovie.setLoop(true);
  /*
  // If movie is on, seek to start and stop
  if (mCurrentMovie) {
    mCurrentMovie.seekToStart();
    mCurrentMovie.setLoop(false);
    mCurrentMovie.stop();
  }
  
  // Increment movie index
  mMovieIndex = (mMovieIndex + 1) % 6;
  
  // Get the next movie from the list, start it from the beginning, and turn the volume off
  mCurrentMovie = mMovieList[mMovieIndex];
  mCurrentMovie.setVolume(0.);
  mCurrentMovie.play();
  mCurrentMovie.seekToStart();
   */
}
コード例 #6
0
ファイル: svvimApp.cpp プロジェクト: mattvvhat/svvim
void svvimApp::prepareSettings (Settings *settings) {
  app::console() << "prepareSettings (entering)\n";
  
  mCurrentMovie = qtime::MovieGl(getResourcePath("water-under.m4v"));
  mCurrentMovie.play();
  mCurrentMovie.setVolume(0.);
  
  mFrameTexture = mCurrentMovie.getTexture();
  
  //
  settings->setWindowSize(mCurrentMovie.getWidth(), mCurrentMovie.getHeight());
  settings->setFrameRate(mCurrentMovie.getFramerate()*2);
  settings->setFullScreen(true);
  
  // ...
  app::console() << "prepareSettings (leaving)\n";
}
コード例 #7
0
ファイル: svvimApp.cpp プロジェクト: mattvvhat/svvim
void svvimApp::setup() {
  mLastElapsedSecondsSwitch = 0;
  mPerlinGenerator = Perlin();
  
  mBgTextureList = new gl::Texture [3];
  
  
  
  mPoolWaterMovie = qtime::MovieGl(getResourcePath("water-over.m4v"));
  mPoolWaterMovie.setLoop();
  mPoolWaterMovie.play();
  
  mMovieList = new qtime::MovieGl [13];
  
  mMovieList[ 0] = qtime::MovieGl(getResourcePath("SVVIM4_VIS_04.mov"));
  mMovieList[ 1] = qtime::MovieGl(getResourcePath("SVVIM4_VIS_08.mov"));
  mMovieList[ 2] = qtime::MovieGl(getResourcePath("SVVIM4_VIS_10.mov"));
  mMovieList[ 3] = qtime::MovieGl(getResourcePath("SVVIM4_VIS_11.mov"));
  mMovieList[ 4] = qtime::MovieGl(getResourcePath("SVVIM4_VIS_07.mov"));
  mMovieList[ 5] = qtime::MovieGl(getResourcePath("movie-006.mov"));
  mMovieList[ 6] = qtime::MovieGl(getResourcePath("movie-002.mov"));
  mMovieList[ 7] = qtime::MovieGl(getResourcePath("movie-008.mov"));
  mMovieList[ 8] = qtime::MovieGl(getResourcePath("movie-009.mov"));
  mMovieList[ 9] = qtime::MovieGl(getResourcePath("movie-010.mov"));
  mMovieList[10] = qtime::MovieGl(getResourcePath("movie-011.mov"));
  mMovieList[11] = qtime::MovieGl(getResourcePath("movie-012.mov"));
  mMovieList[12] = qtime::MovieGl(getResourcePath("movie-013.mov"));
  
  // Load Svvim Logo from PNG
  
  app::console() << "setup\n";
  
  // Compile shader
  try {
    mShader = gl::GlslProg(loadResource(RES_VERT_GLSL), loadResource(RES_FRAG_GLSL));
  }
  catch (const std::exception & e) {
    mShader = gl::GlslProg();
    console() << "Compile error in shader: " << e.what() << "\n";
  }
  
  // Begin reading MIC
  mInput = audio::Input();
  mInput.start();
  
  //
  mMovieIndex = 4;
  
  mCurrentMovie = mMovieList[mMovieIndex];
  
  mCurrentMovie.play();
  mCurrentMovie.setVolume(0.);
  
  gl::Texture::Format format;
  format.setTargetRect();
  
  mImageTexture = gl::Texture(loadImage(loadResource("saturday-night.jpg")), format);
  mSvvimLogoPng = gl::Texture(loadImage(loadResource(RES_SVVIM_LOGO_PNG)), format);
  mCurrentBgTexture = gl::Texture(loadImage(loadResource("bgMarble.png")), format);
  
  mCurrentMovie.seekToTime(82.);
  
  gl::enableAlphaBlending();
}
コード例 #8
0
void QuickTimeSampleApp::update()
{
	if( mMovie )
		mFrameTexture = mMovie.getTexture();
}
コード例 #9
0
ファイル: VideoPanApp.cpp プロジェクト: flimshaw/VideoPan
void VideoPanApp::loadMovieFile( const string &moviePath )
{
	try {
		mMovie = qtime::MovieGl( moviePath );
		
		console() << "Dimensions:" << mMovie.getWidth() << " x " << mMovie.getHeight() << std::endl;
		console() << "Duration:  " << mMovie.getDuration() << " seconds" << std::endl;
		console() << "Frames:    " << mMovie.getNumFrames() << std::endl;
		console() << "Framerate: " << mMovie.getFramerate() << std::endl;
		console() << "Alpha channel: " << mMovie.hasAlpha() << std::endl;		
		console() << "Has audio: " << mMovie.hasAudio() << " Has visuals: " << mMovie.hasVisuals() << std::endl;
		
		
		mMovie.setLoop( true, true );
		mMovie.seekToFrame(24000);
		mMovie.setVolume(0);
		mMovie.play();
		mMovie.stop();
	}
	catch( ... ) {
		console() << "Unable to load the movie." << std::endl;
	}	
}