本文整理汇总了C++中LPDIRECT3DDEVICE7::SetTextureStageState方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE7::SetTextureStageState方法的具体用法?C++ LPDIRECT3DDEVICE7::SetTextureStageState怎么用?C++ LPDIRECT3DDEVICE7::SetTextureStageState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE7
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE7::SetTextureStageState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: ResetBlendenderState
/******************************************************************************************************************
함수명 : ResetBlendenderState()
작성자 :
작성일 :
목적 : 렌더링스테이트를 기본상태로 복구한다.
입력 : LPDIRECT3DDEVICE7 pd3dDevice
출력 : void
[일자][수정자] : 수정내용
*******************************************************************************************************************/
void ResetBlendenderState(LPDIRECT3DDEVICE7 pd3dDevice)
{
pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, FALSE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND , D3DBLEND_ONE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
}
示例3: wSetTextureStageState
/// <summary>
/// <c>wSetTextureStageState</c>
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="d3dDevice7"></param>
/// <param name="dwStage"></param>
/// <param name="dwState"></param>
/// <param name="dwValue"></param>
/// <returns></returns>
HRESULT __stdcall wSetTextureStageState(
LPDIRECT3DDEVICE7 d3dDevice7, ULONG dwStage, D3DTEXTURESTAGESTATETYPE dwState, ULONG dwValue)
{
PSTR pszStageSet;
PSTR pszErrorMessage;
HRESULT hResult;
++TotalRenderStateChanges;
pszStageSet = GetStageSet(dwState, dwValue);
InternalFunctionSpew("GameOS_Direct3D", "SetTextureStageState(%d,%s)", dwStage, pszStageSet);
hResult = d3dDevice7->SetTextureStageState(dwStage, dwState, dwValue);
if (FAILED(hResult))
{
if ( hResult != DDERR_SURFACELOST)
{
pszStageSet = GetStageSet(dwState, dwValue);
pszErrorMessage = ErrorNumberToMessage(hResult);
if ( InternalFunctionPause("FAILED (0x%x - %s) - SetTextureStageState(%d,%s)",
hResult, pszErrorMessage, dwStage, pszStageSet) )
ENTER_DEBUGGER;
}
}
return hResult;
}
示例4: 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);
}
示例5: DrawUI
void CRadar::DrawUI(LPDIRECT3DDEVICE7 lpDevice)
{
if (!Enabled)return;
if ((lpSurface==NULL)||(lpSurface->IsLost()))
{
UpdateSurface();
Update();
}
const float w=130.0f*game->width/640.0f;
const float h=130.0f*game->width/640.0f;
const float x=game->width-20-w;
const float y=game->height-20-h;
const int c=D3DRGBA(1,1,1,0.45f);
const float r=0.9f;
D3DTLVERTEX v[4]={
D3DTLVERTEX(D3DVECTOR(x,y,0),r,c,0,0,0),
D3DTLVERTEX(D3DVECTOR(x+w,y,0),r,c,0,1,0),
D3DTLVERTEX(D3DVECTOR(x,y+h,0),r,c,0,0,1),
D3DTLVERTEX(D3DVECTOR(x+w,y+h,0),r,c,0,1,1)
};
if (Config.alpha)
{
// lpDevice->SetRenderState(D3DRENDERSTATE_ZENABLE,FALSE);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE,TRUE);
lpDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,D3DBLEND_SRCALPHA);
lpDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND,D3DBLEND_INVSRCALPHA);
lpDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE,TRUE);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHAREF,8);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHAFUNC,D3DCMP_GREATEREQUAL);
}
lpDevice->SetTexture(0,lpSurface);
lpDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_TLVERTEX,v,4,0);
lpDevice->SetTexture(0,NULL);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE,0);
lpDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE,0);
// lpDevice->SetRenderState(D3DRENDERSTATE_ZENABLE,TRUE);
}
示例6: DrawShadow
void DrawShadow(LPDIRECT3DDEVICE7 lpDevice)
{
lpDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE );
lpDevice->SetRenderState( D3DRENDERSTATE_STENCILENABLE, TRUE );
// Turn on alphablending
lpDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
lpDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
lpDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
lpDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_DIFFUSE);
// Only write where the stencil value == 1
lpDevice->SetRenderState( D3DRENDERSTATE_STENCILREF, 0x1 );
lpDevice->SetRenderState( D3DRENDERSTATE_STENCILFUNC, D3DCMP_EQUAL );
lpDevice->SetRenderState( D3DRENDERSTATE_STENCILPASS, D3DSTENCILOP_KEEP );
// Get viewport dimensions for big, gray square
D3DVIEWPORT7 vp;
lpDevice->GetViewport(&vp);
FLOAT sx = (FLOAT)vp.dwWidth;
FLOAT sy = (FLOAT)vp.dwHeight;
D3DCOLOR color=D3DRGBA(0,0,0,0.5f);
// Draw a big, gray square
D3DTLVERTEX vBigGraySquare[4];
vBigGraySquare[0] = D3DTLVERTEX( D3DVECTOR( 0,sy,0.0f),1.0f,color,0,0,0 );
vBigGraySquare[1] = D3DTLVERTEX( D3DVECTOR( 0, 0,0.0f),1.0f,color,0,0,0 );
vBigGraySquare[2] = D3DTLVERTEX( D3DVECTOR(sx,sy,0.0f),1.0f,color,0,0,0 );
vBigGraySquare[3] = D3DTLVERTEX( D3DVECTOR(sx, 0,0.0f),1.0f,color,0,0,0 );
lpDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX,
vBigGraySquare, 4, NULL );
// Restore render states
lpDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, TRUE );
lpDevice->SetRenderState( D3DRENDERSTATE_STENCILENABLE, FALSE );
lpDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
}
示例7: SetBlendRenderState
/******************************************************************************************************************
함수명 : SetBlendRenderState()
작성자 :
작성일 :
목적 : 렌더링스테이트를 셋팅한다.
입력 : LPDIRECT3DDEVICE7 pd3dDevice
BYTE bBlendFlag
D3DMATERIAL7 mtrlGetMtrl
출력 : void
[일자][수정자] : 수정내용
*******************************************************************************************************************/
void SetBlendRenderState(LPDIRECT3DDEVICE7 pd3dDevice, BYTE bBlendFlag, D3DMATERIAL7 mtrlGetMtrl)
{
pd3dDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, TRUE);
switch ( bBlendFlag )
{
case 0:
if ( mtrlGetMtrl.diffuse.a < 1.0f || mtrlGetMtrl.emissive.a < 1.0f )
{
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
}
else
{
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
}
break;
case 1:
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE);
break;
case 2:
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCCOLOR);
break;
case 3:
if( mtrlGetMtrl.diffuse.a < 1.0f || mtrlGetMtrl.emissive.a < 1.0f )
{
pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE | D3DTA_COMPLEMENT);
pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
}
else
{
pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE | D3DTA_COMPLEMENT);
pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA);
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
}
break;
case 4:
pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE | D3DTA_COMPLEMENT);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE|D3DTA_COMPLEMENT);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVDESTCOLOR);
break;
case 5:
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE|D3DTA_COMPLEMENT);
pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE | D3DTA_COMPLEMENT);
pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVDESTCOLOR);
break;
}
}
示例8: ARX_MINIMAP_Show
//.........这里部分代码省略.........
if (_px < 0.f) v = 0.f;
else if (_px < MOD20) v *= _px * MOD20DIV;
}
if (fl2) verts[3].color = D3DRGB(v * DIV2, v * DIV2, v * DIV2);
else
verts[3].color = D3DRGB(v, v, v);
oo += v;
if (oo > 0.f)
{
if (fl2)
{
verts[0].sx += DECALX * Xratio;
verts[0].sy += DECALY * Yratio;
verts[1].sx += DECALX * Xratio;
verts[1].sy += DECALY * Yratio;
verts[2].sx += DECALX * Xratio;
verts[2].sy += DECALY * Yratio;
verts[3].sx += DECALX * Xratio;
verts[3].sy += DECALY * Yratio;
}
EERIEDRAWPRIM(GDevice, D3DPT_TRIANGLEFAN, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, 4, 0);
}
}
}
}
}
if (flag != 2)
{
m_pd3dDevice->SetTextureStageState(0, D3DTSS_ADDRESS , D3DTADDRESS_WRAP);
m_pd3dDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESSEQUAL);
SETALPHABLEND(m_pd3dDevice, FALSE);
if ((SHOWLEVEL == ARX_LEVELS_GetRealNum(CURRENTLEVEL)))
{
// Now Draws Playerpos/angle
verts[0].color = 0xFFFF0000;
verts[1].color = 0xFFFF0000;
verts[2].color = 0xFFFF0000;
float val;
if (flag == 1) val = 6.f;
else val = 3.f;
float rx = 0.f;
float ry = -val * 1.8f;
float rx2 = -val * DIV2;
float ry2 = val;
float rx3 = val * DIV2;
float ry3 = val;
float angle = DEG2RAD(player.angle.b);
float ca = EEcos(angle);
float sa = EEsin(angle);
verts[0].sx = (px + rx2 * ca + ry2 * sa) * Xratio;
verts[0].sy = (py + ry2 * ca - rx2 * sa) * Yratio;
verts[1].sx = (px + rx * ca + ry * sa) * Xratio;
verts[1].sy = (py + ry * ca - rx * sa) * Yratio;
verts[2].sx = (px + rx3 * ca + ry3 * sa) * Xratio;
verts[2].sy = (py + ry3 * ca - rx3 * sa) * Yratio;