我想在我的纹理(包含精灵表)的运行时交换我的纹理。但是,我很难理解什么是光栅化器,而且我不知道应该传入什么样的矩阵。
class CUSTOMVERTEXBEN
{
public:
FLOAT x, y, z, rhw; // The transformed position for the vertex
DWORD color; // The vertex color
`enter code here`FLOAT tu, tv;
};
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
D3DXMATRIX m_mtxTexture;
D3DXMatrixIdentity(&m_mtxTexture);
m_mtxTexture._41= 1.0f;
m_mtxTexture._42= 1.0f;
g_pd3dDevice->SetStreamSource( 0, g_pVB, 0, sizeof( CUSTOMVERTEX ) );
g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
g_pd3dDevice->SetIndices(g_pIB);
m_mtxTexture._11= 0.f;
m_mtxTexture._12= 0.f;
//m_mtxTexture._33= 1.f;
g_pd3dDevice->SetTexture(0, g_pTexture );
g_pd3dDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);
g_pd3dDevice->SetTransform(D3DTS_TEXTURE0, &m_mtxTexture);
g_pd3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, 4, 0, 2);