本文整理汇总了C++中IDirect3DDevice9::MultiplyTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9::MultiplyTransform方法的具体用法?C++ IDirect3DDevice9::MultiplyTransform怎么用?C++ IDirect3DDevice9::MultiplyTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DDevice9
的用法示例。
在下文中一共展示了IDirect3DDevice9::MultiplyTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
bool CSprite::Render(const SFloatPoint & _pos) const
{
HRESULT hr;
CGraphicsManager *pGraphicsManager = CGraphicsManager::GetInstance();
IDirect3DDevice9 *pDevice = pGraphicsManager->GetDevice();
D3DXMATRIX matWorld, matTranslation;
hr = pDevice->GetTransform(D3DTS_WORLD, &matWorld);
if(FAILED(hr))
{
LogErrorHr("Failed to get world transform", hr);
return false;
}
D3DXMatrixTranslation(&matTranslation, _pos.m_fX, _pos.m_fY, 0.0f);
hr = pDevice->MultiplyTransform(D3DTS_WORLD, &matTranslation);
if(FAILED(hr))
{
LogErrorHr("Failed to multiply world transform", hr);
return false;
}
hr = pDevice->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(SFaceVertex));
if(FAILED(hr))
{
LogErrorHr("Failed to set stream source", hr);
return false;
}
hr = pDevice->SetFVF(SFaceVertex::_fvf);
if(FAILED(hr))
{
LogErrorHr("Failed to set FVF", hr);
return false;
}
hr = pDevice->SetTexture(0, m_pTexture);
if(FAILED(hr))
{
LogErrorHr("Failed to set texture", hr);
return false;
}
hr = pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
if(FAILED(hr))
{
LogErrorHr("Failed to draw primitive", hr);
return false;
}
hr = pDevice->SetTexture(0, NULL);
if(FAILED(hr))
{
LogErrorHr("Failed to reset texture", hr);
return false;
}
hr = pDevice->SetTransform(D3DTS_WORLD, &matWorld);
if(FAILED(hr))
{
LogErrorHr("Failed to restore world transform", hr);
return false;
}
return true;
}