本文整理汇总了C++中Texture::GetShaderView方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::GetShaderView方法的具体用法?C++ Texture::GetShaderView怎么用?C++ Texture::GetShaderView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::GetShaderView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resource
bool Prism::Surface::SetTexture(const std::string& aResourceName, const std::string& aFileName, bool aUseSRGB)
{
aUseSRGB;
DL_ASSERT_EXP(aFileName != ""
, CU::Concatenate("Shader resource ( %s ) tried to use invalid filePath", aResourceName.c_str()));
Texture* tex = Engine::GetInstance()->GetTextureContainer()->GetTexture(aFileName);
ID3DX11EffectShaderResourceVariable* shaderVar = myEffect->GetEffect()->GetVariableByName(aResourceName.c_str())->AsShaderResource();
if (shaderVar->IsValid() == false)
{
std::string errorMsg = "Failed to get ShaderResource: " + aResourceName;
//DL_MESSAGE_BOX(errorMsg.c_str(), "Surface Error", MB_ICONWARNING);
RESOURCE_LOG(errorMsg.c_str());
return false;
}
if (aResourceName == "EmissiveTexture")
{
myEmissive = true;
}
myTextures.Add(tex);
myShaderResources.Add(tex->GetShaderView());
myShaderResourceViews.Add(shaderVar);
myFilePaths.Add(aFileName);
myShaderResourceNames.Add(aResourceName);
return true;
}
示例2:
void Prism::Surface::ReloadSurface()
{
myTextures.RemoveAll();
myShaderResourceViews.RemoveAll();
myShaderResources.RemoveAll();
for (int i = 0; i < myFilePaths.Size(); ++i)
{
Texture* tex = Engine::GetInstance()->GetTextureContainer()->GetTexture(myFilePaths[i]);
ID3DX11EffectShaderResourceVariable* shaderVar = myEffect->GetEffect()->GetVariableByName(myShaderResourceNames[i].c_str())->AsShaderResource();
if (shaderVar->IsValid() == false)
{
std::string errorMsg = "Failed to get ShaderResource: " + myShaderResourceNames[i];
//DL_MESSAGE_BOX(errorMsg.c_str(), "Surface Error", MB_ICONWARNING);
RESOURCE_LOG(errorMsg.c_str());
}
myTextures.Add(tex);
myShaderResources.Add(tex->GetShaderView());
myShaderResourceViews.Add(shaderVar);
}
}