本文整理汇总了C++中LPDIRECT3DDEVICE7::SetTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE7::SetTransform方法的具体用法?C++ LPDIRECT3DDEVICE7::SetTransform怎么用?C++ LPDIRECT3DDEVICE7::SetTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE7
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE7::SetTransform方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Draw
void CDrescher::Draw(LPDIRECT3DDEVICE7 lpDevice)
{
if (!box2->IsVisible())return;
lpDevice->SetTexture(0,NULL);
D3DMATRIX matrix,m;
D3DUtil_SetTranslateMatrix(matrix,pos.x,pos.y+hoehe,pos.z);
{ // Mähdrescher gemäß Steigung kippen
D3DUtil_SetRotateYMatrix(m,beta);
D3DMath_MatrixMultiply(matrix,m,matrix);
D3DUtil_SetRotateXMatrix(m,alpha);
D3DMath_MatrixMultiply(matrix,m,matrix);
D3DUtil_SetRotateYMatrix(m,-beta);
D3DMath_MatrixMultiply(matrix,m,matrix);
}
D3DUtil_SetRotateYMatrix(m,ang.y);
D3DMath_MatrixMultiply(matrix,m,matrix);
if (schaukelphase>0.0f)
{ // schaukeln
const float mittelpunkt=2.0f;
D3DUtil_SetTranslateMatrix(m,0,0,-mittelpunkt);
D3DMath_MatrixMultiply(matrix,m,matrix);
D3DUtil_SetRotateXMatrix(m,schaukelwinkel());
D3DMath_MatrixMultiply(matrix,m,matrix);
D3DUtil_SetTranslateMatrix(m,0,0,mittelpunkt);
D3DMath_MatrixMultiply(matrix,m,matrix);
}
lpDevice->SetTransform(D3DTRANSFORMSTATE_WORLD,&matrix);
mesh1->Render(lpDevice,FALSE);
// Rolle
D3DUtil_SetRotateXMatrix(m,rolle);
D3DMath_MatrixMultiply(matrix,m,matrix);
lpDevice->SetTransform(D3DTRANSFORMSTATE_WORLD,&matrix);
mesh2->Render(lpDevice,FALSE);
}
示例3: DrawUI
void CGras::DrawUI(LPDIRECT3DDEVICE7 lpDevice)
{
if (lpVertices==NULL)return;
if (game->lpTexture[40]==NULL)
{ // Gras Textur nachladen
game->lpTexture[40]=CreateTextureFromResource(lpDevice,game->lpDD,NULL,"grass.bmp",4,FALSE,TRUE);
MakeTransparent(game->lpTexture[40],FALSE); // Gras
}
lpDevice->SetRenderState(D3DRENDERSTATE_LIGHTING,FALSE);
DWORD old;
lpDevice->GetRenderState(D3DRENDERSTATE_CULLMODE,&old);
lpDevice->SetRenderState(D3DRENDERSTATE_CULLMODE,D3DCULL_NONE);
if (Config.alpha)
{
lpDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE,TRUE);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHAREF,192);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHAFUNC,D3DCMP_GREATEREQUAL);
}
lpDevice->SetTexture(0,game->lpTexture[40]);
D3DMATRIX m;
D3DUtil_SetIdentityMatrix(m);
lpDevice->SetTransform(D3DTRANSFORMSTATE_WORLD,&m);
for (int i=0;i<vertexbuffers;i++)
lpDevice->DrawIndexedPrimitiveVB(D3DPT_TRIANGLELIST,lpVertices[i],0,vertexnum[i],Indices,vertexnum[i]/4*6,0);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE,0);
lpDevice->SetRenderState(D3DRENDERSTATE_LIGHTING,TRUE);
lpDevice->SetRenderState(D3DRENDERSTATE_CULLMODE,old);
}
示例4: Draw
void CGolfer::Draw(LPDIRECT3DDEVICE7 lpDevice)
{
if ((parent==NULL)&&(!box->IsVisible()))return;
D3DMATRIX m=BerechneSchlag();
lpDevice->SetTexture(0,NULL);
lpDevice->SetTransform(D3DTRANSFORMSTATE_WORLD,&m);
mesh->Render(lpDevice,FALSE);
}
示例5: DrawSmooth
void CSprite::DrawSmooth(LPDIRECT3DDEVICE7 lpDevice,const D3DVECTOR pos,const float w,const float h,const DWORD color,const int spritenr)
{
D3DVECTOR rightVect,upVect;
D3DMATRIX mat;
{
lpDevice->GetTransform(D3DTRANSFORMSTATE_VIEW,&mat);
rightVect=Normalize(D3DVECTOR(mat._11,mat._21,mat._31))*w*0.5f;
upVect=Normalize(D3DVECTOR(mat._12,mat._22,mat._32))*h*0.5f;
}
const D3DVECTOR n=D3DVECTOR(0,0,0);
D3DLVERTEX verts[4]=
{
D3DLVERTEX(pos-rightVect+upVect, color,0, 1.0f, 0.0f),
D3DLVERTEX(pos+rightVect+upVect, color,0, 0.0f, 0.0f),
D3DLVERTEX(pos-rightVect-upVect, color,0, 1.0f, 1.0f),
D3DLVERTEX(pos+rightVect-upVect, color,0, 0.0f, 1.0f)
};
D3DUtil_SetIdentityMatrix(mat);
lpDevice->SetTransform(D3DTRANSFORMSTATE_WORLD,&mat);
if (Config.alpha)
{
lpDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE,FALSE);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
lpDevice->SetRenderState(D3DRENDERSTATE_LIGHTING,FALSE);
lpDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
lpDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
lpDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
lpDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,D3DBLEND_SRCCOLOR);
lpDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND,D3DBLEND_INVSRCCOLOR);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE,TRUE);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHAREF,0x08);
}
lpDevice->SetTexture(0,GetSurface(spritenr));
lpDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_LVERTEX,verts,4,0);
lpDevice->SetTexture(0,NULL);
if (Config.alpha)
{
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
lpDevice->SetRenderState(D3DRENDERSTATE_LIGHTING,TRUE);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE,FALSE);
lpDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE,TRUE);
}
}
示例6: Draw
void CEi::Draw(LPDIRECT3DDEVICE7 lpDevice)
{
if (!CBoundingTube::IsSphereVisible(pos,EGG_SIZE))return;
D3DMATRIX m,m2;
D3DUtil_SetTranslateMatrix(m,pos);
D3DUtil_SetRotateYMatrix(m2,ang.y);
D3DMath_MatrixMultiply(m,m2,m);
D3DUtil_SetRotateXMatrix(m2,-ang.x+g_PI*0.5f);
D3DMath_MatrixMultiply(m,m2,m);
lpDevice->SetTexture(0,NULL);
lpDevice->SetTransform(D3DTRANSFORMSTATE_WORLD,&m);
lpMesh->Render(lpDevice,FALSE);
}
示例7: wSetTransform
/// <summary>
/// <c>wSetTransform</c>
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="d3dDevice7"></param>
/// <param name="dtstTransformStateType"></param>
/// <param name="lpD3DMatrix"></param>
/// <returns></returns>
HRESULT __stdcall wSetTransform(
LPDIRECT3DDEVICE7 d3dDevice7, D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix)
{
PSTR pszTransformType;
PSTR pszErrorMessage;
HRESULT hResult;
pszTransformType = GetTransformType(dtstTransformStateType);
InternalFunctionSpew("GameOS_Direct3D", "SetTransform(%s)", pszTransformType);
hResult = d3dDevice7->SetTransform(dtstTransformStateType, lpD3DMatrix);
if (FAILED(hResult))
{
pszTransformType = GetTransformType(dtstTransformStateType);
pszErrorMessage = ErrorNumberToMessage(hResult);
if ( InternalFunctionPause("FAILED (0x%x - %s) - SetTransform(%s)",
hResult, pszErrorMessage, pszTransformType) )
ENTER_DEBUGGER;
}
return hResult;
}