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


C++ CShader::CreateDefault方法代码示例

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


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

示例1: QERApp_Shader_ForName

IShader* WINAPI QERApp_Shader_ForName(const char* name)
{
	//++timo FIXME: do we allow NULL and "" calling?
	// how does it deal with notexture? can we simply replace by "textures/radiant/notex"?
	if (name == NULL || strlen(name) == 0)
	{
		Sys_Printf("FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName\n");
		return QERApp_Shader_ForName("radiant/notex"); //++timo ???
	}

	// entities that should be represented with plain colors instead of textures
	// request a texture name with (r g b) (it's stored in their class_t)
	if (name[0]=='(')
	{
		return QERApp_ColorShader_ForName(name);
	}

	CShader* pShader = static_cast<CShader*>(QERApp_Try_Shader_ForName( name ));
	if (pShader)
	{
		pShader->SetDisplayed( true );
		return pShader;
	}
	// we don't know this shader, maybe it's a straight texture 
	pShader = new CShader;
	pShader->CreateDefault( name );
  // hook it into the shader list
	g_Shaders.Add( (LPVOID)pShader );
	pShader->IncRef();
	// if it can't find the texture, "textures/radiant/notex" will be used
  pShader->Activate();
  pShader->SetDisplayed( true );
	return pShader;
}
开发者ID:FS-NulL,项目名称:Q3Radiant,代码行数:34,代码来源:IShaders.cpp

示例2:

IShader *WINAPI QERApp_CreateShader_ForTextureName( const char *name ){
	CShader *pShader;
	pShader = new CShader;
	// CreateDefault expects a texture / shader name relative to the "textures" directory
	// (cause shader names are reletive to "textures/")
	pShader->CreateDefault( name );
	// hook it into the shader list
	g_Shaders.Add( (void *) pShader );
	pShader->IncRef();
	// if it can't find the texture, SHADER_NOT_FOUND will be used
	// Hydra: display an error message, so the user can quickly find a list of missing
	// textures by looking at the console.
	if ( !pShader->Activate() ) {
		Sys_Printf( "WARNING: Activate shader failed for %s\n",pShader->getName() );
	}
	pShader->SetDisplayed( true );

	return pShader;
}
开发者ID:0bsidian,项目名称:GtkRadiant,代码行数:19,代码来源:shaders.cpp


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