本文整理汇总了C++中TexturePtr::GetSurfaceLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::GetSurfaceLevel方法的具体用法?C++ TexturePtr::GetSurfaceLevel怎么用?C++ TexturePtr::GetSurfaceLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TexturePtr
的用法示例。
在下文中一共展示了TexturePtr::GetSurfaceLevel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CGSH_Direct3D9::CopyRenderTargetToBitmap(Framework::CBitmap& outputBitmap, const TexturePtr& renderTarget, uint32 renderTargetWidth, uint32 renderTargetHeight, uint32 width, uint32 height)
{
HRESULT result = S_OK;
SurfacePtr offscreenSurface, renderTargetSurface;
result = renderTarget->GetSurfaceLevel(0, &renderTargetSurface);
assert(SUCCEEDED(result));
result = m_device->CreateOffscreenPlainSurface(renderTargetWidth, renderTargetHeight, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &offscreenSurface, nullptr);
assert(SUCCEEDED(result));
result = m_device->GetRenderTargetData(renderTargetSurface, offscreenSurface);
assert(SUCCEEDED(result));
outputBitmap = Framework::CBitmap(width, height, 32);
D3DLOCKED_RECT lockedRect = {};
result = offscreenSurface->LockRect(&lockedRect, nullptr, D3DLOCK_READONLY);
assert(SUCCEEDED(result));
uint8* srcPtr = reinterpret_cast<uint8*>(lockedRect.pBits);
uint8* dstPtr = reinterpret_cast<uint8*>(outputBitmap.GetPixels());
uint32 copyWidth = std::min<uint32>(renderTargetWidth, width);
uint32 copyHeight = std::min<uint32>(renderTargetHeight, height);
for(unsigned int y = 0; y < copyHeight; y++)
{
memcpy(dstPtr, srcPtr, copyWidth * 4);
dstPtr += outputBitmap.GetPitch();
srcPtr += lockedRect.Pitch;
}
result = offscreenSurface->UnlockRect();
assert(SUCCEEDED(result));
}
示例2: SetRTOverride
void DisplayRenderTarget::SetRTOverride(DisplayTexturePtr _RTOverride)
{
if (m_pRTOverrideTex != _RTOverride)
{
if (NULL != m_pRTOverrideSurf)
{
m_pRTOverrideSurf->Release();
m_pRTOverrideSurf = NULL;
}
m_pRTOverrideTex = _RTOverride;
if (NULL != m_pRTOverrideTex)
{
TexturePtr pTexture = static_cast<TexturePtr>(m_pRTOverrideTex->GetBase());
pTexture->GetSurfaceLevel(0, &m_pRTOverrideSurf);
}
}
}
示例3: Create
bool DisplayRenderTarget::Create(const boost::any& _rConfig)
{
CreateInfo* pInfo = boost::any_cast<CreateInfo*>(_rConfig);
bool bResult = (NULL != pInfo);
if (false != bResult)
{
Release();
m_strName = pInfo->m_strName;
m_uRTIndex = pInfo->m_uIndex;
m_bImmediateWrite = pInfo->m_bImmediateWrite;
m_eRenderState = ERenderState_UNKNOWN;
m_eMode = ERenderMode_UNKNOWNPROCESS;
m_pCurrentBufferTex = NULL;
m_uCurrentBuffer = 0;
string strSemanticName = boost::str(boost::format("RT2D0%1%") % m_uRTIndex);
m_uRTSemanticNameKey = MakeKey(strSemanticName);
strSemanticName = boost::str(boost::format("ORT2D0%1%") % m_uRTIndex);
m_uORTSemanticNameKey = MakeKey(strSemanticName);
for (UInt i = 0 ; c_uBufferCount > i ; ++i)
{
string strTexName = boost::str(boost::format("%1%_%2%") % m_strName % i);
bResult = m_rDisplay.GetTextureManager()->New(strTexName, pInfo->m_uWidth, pInfo->m_uHeight, pInfo->m_uFormat, false, DisplayTexture::EType_2D, DisplayTexture::EUsage_RENDERTARGET);
if (false == bResult)
{
vsoutput(__FUNCTION__" : %s, could not create texture\n", strTexName.c_str());
break;
}
m_pDoubleBufferTex[i] = m_rDisplay.GetTextureManager()->Get(strTexName);
TexturePtr pTexture = static_cast<TexturePtr>(m_pDoubleBufferTex[i]->GetBase());
pTexture->GetSurfaceLevel(0, &m_pDoubleBufferSurf[i]);
}
}
return bResult;
}