CameraImageToDisplayImagePass::CameraImageToDisplayImagePass(Poco::Path shader_dir,
                                                             osg::ref_ptr<osg::Texture> live_camera_texture,
                                                             std::string p2c_filename,
															 bool UseHDR) :
	_live_camera_texture(live_camera_texture), _UseHDR(UseHDR)
{
	double scale_width = live_camera_texture->getTextureWidth();
	double scale_height = live_camera_texture->getTextureHeight();
	osg::ref_ptr<osg::Image> image = load_exr( p2c_filename, _display_width, _display_height, scale_width, scale_height );
	_p2c_texture = new osg::Texture2D;
	_p2c_texture->setTextureSize( _display_width, _display_height);
	_p2c_texture->setInternalFormat(GL_RGB32F);
	_p2c_texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
	_p2c_texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);

	_p2c_texture->setImage(image);

	create_output_texture();
	_camera = new osg::Camera;
	setup_camera();
	osg::ref_ptr<osg::Group> g = create_input_geometry();
	_camera->addChild( g.get() );

	_top = new osg::Group;
	_top->addDescription("CameraImageToDisplayImagePass top node");
	_top->addChild( _camera );
	set_shader( shader_dir.absolute().append("CameraImageToDisplayImagePass.vert").toString(),
				shader_dir.absolute().append("CameraImageToDisplayImagePass.frag").toString() );

}
Ejemplo n.º 2
0
 Camera::Camera(osg::ref_ptr<GLContextManager> pContext, osg::ref_ptr<osg::Texture2D> ptex)
     : pContext(pContext),
     ptex(ptex)
 {
     minimalz = 1.0;
     pContext->makeCurrent();
     CHECK_GL();
     fbo = new FBO(GL_TEXTURE_2D, pContext->getTextureID(ptex.get()), ptex->getTextureWidth(), ptex->getTextureHeight());
     fov = 30.0;
     aspectRatio = 4.0 / 3.0;
     bDoublePrecisionMode = false;
 }