本文整理汇总了C++中Texture::GetFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::GetFormat方法的具体用法?C++ Texture::GetFormat怎么用?C++ Texture::GetFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::GetFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrepareSpriteInternal
void UIStaticText::PrepareSpriteInternal(DAVA::BaseObject *caller, void *param, void *callerData)
{
if (textBlock->IsSpriteReady())
{
Sprite *sprite = textBlock->GetSprite();
shadowBg->SetSprite(sprite, 0);
textBg->SetSprite(sprite, 0);
Texture *tex = sprite->GetTexture();
if(tex && tex->GetFormat() == FORMAT_A8)
{
textBg->SetShader(RenderManager::TEXTURE_MUL_FLAT_COLOR_IMAGE_A8);
shadowBg->SetShader(RenderManager::TEXTURE_MUL_FLAT_COLOR_IMAGE_A8);
}
else
{
textBg->SetShader(RenderManager::TEXTURE_MUL_FLAT_COLOR);
shadowBg->SetShader(RenderManager::TEXTURE_MUL_FLAT_COLOR);
}
}
else
{
shadowBg->SetSprite(NULL, 0);
textBg->SetSprite(NULL, 0);
}
}
示例2: CopyFrom
void GenericBuffer::CopyFrom(vk::CommandBuffer commandBuffer, Texture& srcTexture)
{
auto textureSize =
srcTexture.GetWidth() * srcTexture.GetHeight() * GetBytesPerPixel(srcTexture.GetFormat());
if (textureSize != mSize)
{
throw std::runtime_error("Cannot copy texture of different sizes");
}
srcTexture.Barrier(commandBuffer,
vk::ImageLayout::eGeneral,
vk::AccessFlagBits::eShaderWrite | vk::AccessFlagBits::eColorAttachmentWrite,
vk::ImageLayout::eTransferSrcOptimal,
vk::AccessFlagBits::eTransferRead);
auto info = vk::BufferImageCopy()
.setImageSubresource({vk::ImageAspectFlagBits::eColor, 0, 0, 1})
.setImageExtent({srcTexture.GetWidth(), srcTexture.GetHeight(), 1});
commandBuffer.copyImageToBuffer(
srcTexture.mImage, vk::ImageLayout::eTransferSrcOptimal, mBuffer, info);
srcTexture.Barrier(commandBuffer,
vk::ImageLayout::eTransferSrcOptimal,
vk::AccessFlagBits::eTransferRead,
vk::ImageLayout::eGeneral,
vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eColorAttachmentRead);
Barrier(commandBuffer, vk::AccessFlagBits::eTransferWrite, vk::AccessFlagBits::eShaderRead);
}