Direct3D 9学习笔记(7)纹理实例

纹理寻址

D3DSAMP_ADDRESSU

Texture-address mode for the u coordinate. The default is D3DTADDRESS_WRAP. For more information, see D3DTEXTUREADDRESS.

D3DSAMP_ADDRESSV

Texture-address mode for the v coordinate. The default is D3DTADDRESS_WRAP. For more information, see D3DTEXTUREADDRESS.

image

// set wrap address mode
if( ::GetAsyncKeyState('W') & 0x8000f )
{
    Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
    Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
}

// set border color address mode
if( ::GetAsyncKeyState('B') & 0x8000f )
{
    Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
    Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
    Device->SetSamplerState(0,  D3DSAMP_BORDERCOLOR, 0x000000ff);
}

// set clamp address mode
if( ::GetAsyncKeyState('C') & 0x8000f )
{
    Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
    Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
}

// set mirror address mode
if( ::GetAsyncKeyState('M') & 0x8000f )
{
    Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_MIRROR);
    Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_MIRROR);
}    
原文地址:https://www.cnblogs.com/Clingingboy/p/2629118.html