当前位置: 首页>>代码示例>>C++>>正文


C++ IDriver::PushRenderTarget方法代码示例

本文整理汇总了C++中IDriver::PushRenderTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ IDriver::PushRenderTarget方法的具体用法?C++ IDriver::PushRenderTarget怎么用?C++ IDriver::PushRenderTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDriver的用法示例。


在下文中一共展示了IDriver::PushRenderTarget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Process

//-------------------------------------------------------------------------------------------------------
void BloomPS::Process(IDriver& driver, const RenderTarget* const org, const RenderTarget* const scene, RenderTarget* const out, bool& isSwitch)
{
	float Range = 2; //控制模糊度

	//降采样
	//driver.PushRenderTarget(m_pDownSimple_1);
	//driver.Clear( IDriver::COLOR_BUFFER );
	//QuadShader& qs = driver.GetShaderManage().GetShader<QuadShader>(ShaderManage::QuadShader);
	//driver.Draw( *m_pRendBuffer, qs, scene->GetColorBuffer() );
	//driver.PopRenderTarget();

	//流明化
	driver.PushRenderTarget(m_pDownSimple_1);
	driver.Clear( IDriver::COLOR_BUFFER );
	Luminance& le = driver.GetShaderManage().GetShader<Luminance>(ShaderManage::Luminance);
	driver.Draw( *m_pRendBuffer, le, scene->GetColorBuffer() );
	driver.PopRenderTarget();

	//x方向模糊
	driver.PushRenderTarget(m_pDownSimple_2);
	driver.Clear( IDriver::COLOR_BUFFER );
	Gaussian& gauss = driver.GetShaderManage().GetShader<Gaussian>(ShaderManage::Gaussian);
	gauss.SetParamStep( vector2f( Range / m_pDownSimple_1->GetSize().m_x, 0.0f ) );
	driver.Draw( *m_pRendBuffer, gauss, m_pDownSimple_1->GetColorBuffer() );
	driver.PopRenderTarget();

	//y方向模糊
	driver.PushRenderTarget(m_pDownSimple_1);
	driver.Clear( IDriver::COLOR_BUFFER );
	gauss.SetParamStep( vector2f( 0.0f, Range / m_pDownSimple_2->GetSize().m_y ) );
	driver.Draw( *m_pRendBuffer, gauss, m_pDownSimple_2->GetColorBuffer() );
	driver.PopRenderTarget();

	driver.PushRenderTarget( out );//如果画在了输出上面,则需要更换输出,下一个pe就用另外一张rt
	isSwitch = true;
	driver.Clear( IDriver::COLOR_BUFFER );
	//if( 0 )
	{
		driver.EnableAlphaBlend(IDriver::BL_SRC_ALPHA, IDriver::BL_ONE_MINUS_SRC_ALPHA, IDriver::BL_SRC_ALPHA, IDriver::BL_ONE_MINUS_SRC_ALPHA );
		Combine& ce = driver.GetShaderManage().GetShader<Combine>(ShaderManage::Combine);
		ce.SetParamOrginial( scene->GetColorBuffer() );
		ce.SetParamSecen( m_pDownSimple_1->GetColorBuffer() );
		ce.SetParamOrginialWeight(1.0f);
		ce.SetParamSecenWeight(0.0f);//was 0.75
		driver.Draw( *m_pRendBuffer, ce, NULL );
	}
	//else
	//{
	//	QuadShader& qs = driver.GetShaderManage().GetShader<QuadShader>(ShaderManage::QuadShader);
	//	driver.Draw( *m_pRendBuffer, qs, m_pDownSimple_1->GetColorBuffer() );
	//	//driver.Draw( *m_pRendBuffer, ui, org->GetDepthBuffer() );
	//}
	driver.PopRenderTarget( );
}
开发者ID:RichardOpenGL,项目名称:Bohge_Engine,代码行数:55,代码来源:BloomPS.cpp

示例2: Render

void WaterManager::Render( IDriver& driver, TerrainManager* world )
{
	if( m_isRender )
	{
		RenderTarget* now = driver.PopRenderTarget( );
		driver.PushRenderTarget( m_Refraction );
		driver.Clear( IDriver::COLOR_BUFFER | IDriver::DEPTH_BUFFER | IDriver::STENCIL_BUFFER );
		world->Render( driver );
		driver.PopRenderTarget( );
		driver.PushRenderTarget( now );
	}
}
开发者ID:RichardOpenGL,项目名称:Bohge_Engine,代码行数:12,代码来源:WaterManager.cpp


注:本文中的IDriver::PushRenderTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。