コード例 #1
0
ファイル: Demo.cpp プロジェクト: dkoerner/sandbox
void Demo::render( base::ContextPtr context )
{
	if( m_shots.empty() )
		return;


	float time = context->time();

	// find current shot
	Shot *shot = &m_shots[0];
	for( int i=0, numShots = (int)m_shots.size();i<numShots;++i )
	{
		Shot &s = m_shots[i];
		if( ( time > s.start)&&( time < s.end) )
		{
			shot = &s;
			break;
		}
	}

	//std::cout << shot->scene->getName() << std::endl;
	//std::cout << time << std::endl;
	

	float localTime = shot->getLocalTime(time);
	
	// update camera from shot camera
	if( shot->camera )
	{
		m_camera->m_transform = shot->camera->xform.eval(localTime);
		m_camera->m_fov = math::degToRad(shot->camera->fov);
		m_camera->update();
	}
	//context->setCamera( m_camera );

	m_renderFBO->begin();
	shot->scene->render(context);
	m_renderFBO->end();
	
	m_post->render();



	// debug
	//m_visualiser->render();
}