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


C++ IMaterialVar::IsTexture方法代码示例

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


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

示例1: OnBind

//-----------------------------------------------------------------------------
// Called when the texture is bound...
//-----------------------------------------------------------------------------
void CZZMaterialProxy::OnBind( C_BaseEntity *pEntity )
{
	if( !m_pTextureVar )
	{
		return;
	}
	
	if(!m_pTextureVar->IsTexture())  // Make sure it is a texture
		return;

	//ITexture *pTexture = m_pTextureVar->GetTextureValue();
	m_pTexture->Download();

	// Mark it so it doesn't get regenerated on task switch
	//m_pEnt = NULL;
}
开发者ID:Zbyl,项目名称:StealthSpyGame,代码行数:19,代码来源:zzprocmat.cpp

示例2: R_StudioSetupSkinAndLighting

IMaterial* CStudioRender::R_StudioSetupSkinAndLighting( IMatRenderContext *pRenderContext, int index, IMaterial **ppMaterials, int materialFlags,  
	void /*IClientRenderable*/ *pClientRenderable, ColorMeshInfo_t *pColorMeshes, StudioModelLighting_t &lighting )
{
	VPROF( "R_StudioSetupSkin" );
	IMaterial *pMaterial = NULL;
	bool bCheckForConVarDrawTranslucentSubModels = false;
	if( m_pRC->m_Config.bWireframe && !m_pRC->m_pForcedMaterial )
	{
		if ( m_pRC->m_Config.bDrawZBufferedWireframe )
			pMaterial = m_pMaterialMRMWireframeZBuffer;
		else
			pMaterial = m_pMaterialMRMWireframe;
	}
	else if( m_pRC->m_Config.bShowEnvCubemapOnly )
	{
		pMaterial = m_pMaterialModelEnvCubemap;
	}
	else
	{
		if ( !m_pRC->m_pForcedMaterial && ( m_pRC->m_nForcedMaterialType != OVERRIDE_DEPTH_WRITE ) )
		{
			pMaterial = ppMaterials[index];
			if ( !pMaterial )
			{
				Assert( 0 );
				return 0;
			}
		}
		else
		{
			materialFlags = 0;
			pMaterial = m_pRC->m_pForcedMaterial;
			if (m_pRC->m_nForcedMaterialType == OVERRIDE_BUILD_SHADOWS)
			{
				// Connect the original material up to the shadow building material
				// Also bind the original material so its proxies are in the correct state
				static unsigned int translucentCache = 0;
				IMaterialVar* pOriginalMaterialVar = pMaterial->FindVarFast( "$translucent_material", &translucentCache );
				Assert( pOriginalMaterialVar );
				IMaterial *pOriginalMaterial = ppMaterials[index];
				if ( pOriginalMaterial )
				{
					// Disable any alpha modulation on the original material that was left over from when it was last rendered
					pOriginalMaterial->AlphaModulate( 1.0f );
					pRenderContext->Bind( pOriginalMaterial, pClientRenderable );
					if ( pOriginalMaterial->IsTranslucent() || pOriginalMaterial->IsAlphaTested() )
					{
						pOriginalMaterialVar->SetMaterialValue( pOriginalMaterial );
					}
					else
					{
						pOriginalMaterialVar->SetMaterialValue( NULL );
					}
				}
				else
				{
					pOriginalMaterialVar->SetMaterialValue( NULL );
				}
			}
			else if( m_pRC->m_nForcedMaterialType == OVERRIDE_DEPTH_WRITE )
			{
				// Disable any alpha modulation on the original material that was left over from when it was last rendered
				ppMaterials[index]->AlphaModulate( 1.0f );

				// Bail if the material is still considered translucent after setting the AlphaModulate to 1.0
				if ( ppMaterials[index]->IsTranslucent() )
				{
					return NULL;
				}

				static unsigned int originalTextureVarCache = 0;
				IMaterialVar *pOriginalTextureVar = ppMaterials[index]->FindVarFast( "$basetexture", &originalTextureVarCache );

				// Select proper override material
				int nAlphaTest = (int) ( ppMaterials[index]->IsAlphaTested() && pOriginalTextureVar->IsTexture() ); // alpha tested base texture
				int nNoCull = (int) ppMaterials[index]->IsTwoSided();
				pMaterial = m_pDepthWrite[nAlphaTest][nNoCull];

				// If we're alpha tested, we should set up the texture variables from the original material
				if ( nAlphaTest != 0 )
				{
					static unsigned int originalTextureFrameVarCache = 0;
					IMaterialVar *pOriginalTextureFrameVar = ppMaterials[index]->FindVarFast( "$frame", &originalTextureFrameVarCache );
					static unsigned int originalAlphaRefCache = 0;
					IMaterialVar *pOriginalAlphaRefVar = ppMaterials[index]->FindVarFast( "$AlphaTestReference", &originalAlphaRefCache );

					static unsigned int textureVarCache = 0;
					IMaterialVar *pTextureVar = pMaterial->FindVarFast( "$basetexture", &textureVarCache );
					static unsigned int textureFrameVarCache = 0;
					IMaterialVar *pTextureFrameVar = pMaterial->FindVarFast( "$frame", &textureFrameVarCache );
					static unsigned int alphaRefCache = 0;
					IMaterialVar *pAlphaRefVar = pMaterial->FindVarFast( "$AlphaTestReference", &alphaRefCache );

					if ( pOriginalTextureVar->IsTexture() ) // If $basetexture is defined
					{
						if( pTextureVar && pOriginalTextureVar )
						{
							pTextureVar->SetTextureValue( pOriginalTextureVar->GetTextureValue() );
						}

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


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