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


C++ ITexture::Apply方法代码示例

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


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

示例1: _FlushAllHelperDeferred

void gkAuxRenderer::_FlushAllHelperDeferred( LPDIRECT3DDEVICE9 pDevice, bool clean )
{

	gkShaderPtr pShader = gkShaderManager::ms_AuxRenderer;

	Matrix44 viewMat = gkRendererD3D9::getShaderContent().getViewMatrix();
	Matrix44 projMat = gkRendererD3D9::getShaderContent().getProjectionMatrix();

	getRenderer()->SetRenderState(D3DRS_ZENABLE, FALSE);
	getRenderer()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
	getRenderer()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	getRenderer()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
	getRenderer()->getDevice()->SetVertexDeclaration( gkRendererD3D9::m_generalDeclPt4F4 );

	// Bloommerge
	GKHANDLE hTech = pShader->FX_GetTechniqueByName("Render2D");
	pShader->FX_SetTechnique( hTech );
	{
		UINT cPasses;
		pShader->FX_Begin( &cPasses, 0 );
		for( UINT p = 0; p < cPasses; ++p )
		{
			pShader->FX_BeginPass( p );

			

			if (!m_vecScreenBoxVertexBuffer_Render.empty())
			{
				int size = m_vecScreenBoxVertexBuffer_Render.size();
				pDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, m_vecScreenBoxVertexBuffer_Render.size() / 3, &(m_vecScreenBoxVertexBuffer_Render[0]), sizeof(GK_HELPER_2DVERTEX));
			}

			if (!m_vecScreenLineVertexBuffer_Render.empty())
			{
				int size = m_vecScreenLineVertexBuffer_Render.size();
				pDevice->DrawPrimitiveUP(D3DPT_LINELIST, m_vecScreenLineVertexBuffer_Render.size() / 2, &(m_vecScreenLineVertexBuffer_Render[0]), sizeof(GK_HELPER_2DVERTEX));
			}

			if (clean)
			{
				m_vecScreenBoxVertexBuffer_Render.clear();
				m_vecScreenLineVertexBuffer_Render.clear();
			}


			pShader->FX_EndPass();
		}
		pShader->FX_End();
	}

	//getRenderer()->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
	//getRenderer()->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);


	

	GKHANDLE hTechT = pShader->FX_GetTechniqueByName("Render2DTexture");
	GKHANDLE hTechA = pShader->FX_GetTechniqueByName("Render2DTextureAlpha");
	GKHANDLE hTechD = pShader->FX_GetTechniqueByName("Render2DTextureDirect");
	

	getRenderer()->SetRenderState(D3DRS_ZENABLE, FALSE);
	if (!m_vecScreenBoxTexturedVertexBuffer_Render.empty())
	{
		int count = m_vecScreenBoxTexturedVertexBuffer_Render.size() / 6;
		//pDevice->SetFVF( D3DFVF_XYZRHW | D3DFVF_TEX1 );

		for (int i=0; i < count; ++i)
		{

			ITexture* tex = m_vecScreenBoxTexture_Render[i];

			if (tex->format() == eTF_A8)
			{
				pShader->FX_SetTechnique( hTechA );
			}
			else if(!tex->dynamic())
			{
				pShader->FX_SetTechnique( hTechT );
			}
			else
			{
				pShader->FX_SetTechnique( hTechD );
			}

			
			{
				UINT cPasses;
				pShader->FX_Begin( &cPasses, 0 );
				for( UINT p = 0; p < cPasses; ++p )
				{
					pShader->FX_BeginPass( p );

					getRenderer()->getDevice()->SetVertexDeclaration( gkRendererD3D9::m_generalDeclPt4F2 );


					getRenderer()->getDevice()->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
					getRenderer()->getDevice()->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
					tex->Apply(0,0);

//.........这里部分代码省略.........
开发者ID:bxs3514,项目名称:gkEngine,代码行数:101,代码来源:gkAuxRenderer.cpp

示例2:

 FOR_EACH_COLLECTION(i, mTextures)
 {
     ITexture* texture = i->Value;
     texture->Apply();
 }
开发者ID:whztt07,项目名称:Medusa,代码行数:5,代码来源:IMaterial.cpp


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