本文整理汇总了C++中MaterialInfo::UpdateConstantbuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialInfo::UpdateConstantbuffer方法的具体用法?C++ MaterialInfo::UpdateConstantbuffer怎么用?C++ MaterialInfo::UpdateConstantbuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaterialInfo
的用法示例。
在下文中一共展示了MaterialInfo::UpdateConstantbuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/** Binds the texture for the given mesh-key.
- Returns false if not cached in */
bool D3D11GraphicsEngineTest::BindShaderForKey(const MeshKey& key)
{
zCTexture* tx = key.Texture;
if(!tx)
return false; // FIXME: Gregs hat has this! Returning here causes it to not render at all
// Bind texture
if(tx->CacheIn(0.6f) == zRES_CACHED_IN) // FIXME: Don't always use a texture in a z-pre-pass!
{
MyDirectDrawSurface7* surface = tx->GetSurface();
ID3D11ShaderResourceView* srv[2];
// Get diffuse and normalmap
srv[0] = ((D3D11Texture *)surface->GetEngineTexture())->GetShaderResourceView();
srv[1] = surface->GetNormalmap() ? ((D3D11Texture *)surface->GetNormalmap())->GetShaderResourceView() : NULL;
// Bind both
Context->PSSetShaderResources(0,2, srv);
if(RenderingStage == DES_Z_PRE_PASS)
{
// Force alphatest on vobs for now
BindShaderForTexturePrePass(tx, true);
}else
{
BindShaderForTextureDiffusePass(tx);
}
// Get and update info if neccessary
MaterialInfo* info = key.Info;
if(!info->Constantbuffer)
info->UpdateConstantbuffer();
// Bind info to pixel shader
info->Constantbuffer->BindToPixelShader(2);
}
}