本文整理汇总了C++中LPDIRECT3DDEVICE7::SetMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE7::SetMaterial方法的具体用法?C++ LPDIRECT3DDEVICE7::SetMaterial怎么用?C++ LPDIRECT3DDEVICE7::SetMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE7
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE7::SetMaterial方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawBillBoard
HRESULT CImageHandler::DrawBillBoard(LPDIRECT3DDEVICE7 lpDevice, D3DVECTOR vTrans, D3DVECTOR vScale, /*D3DVECTOR vRot, */D3DMATERIAL7 mtrl, /*FLOAT fRotRad, */LPDIRECTDRAWSURFACE7 lpddsTextr)
{
if ( lpDevice )
{
if( SUCCEEDED(lpDevice->BeginScene()) )
{
D3DMATRIX matTrans;
D3DMATRIX matScale;
D3DMATRIX matRot;
D3DMATRIX matWorld;
D3DMATRIX matTempWorld;
D3DMATRIX matWorldOriginal;
lpDevice->GetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
vTrans.x = vTrans.x+vScale.x/2-400;
vTrans.y = -vTrans.y-vScale.y/2+300;
D3DUtil_SetTranslateMatrix(matTrans, vTrans);
D3DUtil_SetScaleMatrix(matScale, vScale.x, vScale.y, vScale.z);
// D3DUtil_SetRotationMatrix(matRot, vRot, fRotRad);
D3DMath_MatrixMultiply(/*matTempWorld*/matWorld, matScale, matTrans);
// D3DMath_MatrixMultiply(matWorld, matRot, matTempWorld);
lpDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
SetBlendRenderState(lpDevice, _BLEND_NORMAL, mtrl);
lpDevice->SetMaterial(&mtrl);
lpDevice->SetTexture(0, lpddsTextr);
lpDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX, m_avBillBoard, 4, NULL);
// 원상복귀.
ZeroMemory(&mtrl, sizeof(mtrl));
mtrl.diffuse.r = mtrl.diffuse.g = mtrl.diffuse.b = 0.1f;
mtrl.ambient.r = mtrl.ambient.g = mtrl.ambient.b = 1.0f;
lpDevice->SetMaterial(&mtrl);
ResetBlendenderState(lpDevice);
lpDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
}
lpDevice->EndScene();
return S_OK;
}
return E_FAIL;
}
示例2: wSetMaterial
/// <summary>
/// <c>wSetMaterial</c>
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="d3dDevice7"></param>
/// <param name="pMaterial"></param>
/// <returns></returns>
HRESULT __stdcall wSetMaterial(
LPDIRECT3DDEVICE7 d3dDevice7, LPD3DMATERIAL7 pMaterial)
{
PSTR pszMaterialInfo;
PSTR pszErrorMessage;
HRESULT hResult;
pszMaterialInfo = GetMaterialInfo(pMaterial);
InternalFunctionSpew("GameOS_Direct3D", "SetMaterial(%s)", pszMaterialInfo);
hResult = d3dDevice7->SetMaterial(pMaterial);
if (FAILED(hResult))
{
pszMaterialInfo = GetMaterialInfo(pMaterial);
pszErrorMessage = ErrorNumberToMessage(hResult);
if ( InternalFunctionPause("FAILED (0x%x - %s) - SetMaterial(%s)",
hResult, pszErrorMessage, pszMaterialInfo) )
ENTER_DEBUGGER;
}
return hResult;
}