Game Development Reference
In-Depth Information
Figure 6.6:
Border
color mode
Figure 6.7:
Clamp
mode
Figure 6.8:
Mirror mode
In these figures, the texture coordinates for the four unique quad verti-
ces are defined as (0, 0), (0, 3), (3, 0), and (3, 3). From the three in both
the u-axis and v-axis direction, the quad is subdivided into a 3 3area
matrix. If, for instance, you wanted the texture to be tiled 5 5 across
the quad, you would specify the wrap address mode and texture coordi-
nates (0, 0), (0, 5), (5, 0), and (5, 5).
The following code snippet taken from the AddressModes sample
illustrates how the four address modes are set:
// 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);
Search WWH ::




Custom Search