Game Development Reference
In-Depth Information
6.4.1 Mipmap Filter
The mipmap filter is used to control how Direct3D uses the mipmaps.
You can set the mipmap filter by writing:
Device->SetSamplerState(0, D3DSAMP_MIPFILTER, Filter);
where Filter is one of the following three options:
D3DTEXF_NONE —Disables mipmapping
D3DTEXF_POINT —By using this filter, Direct3D will choose the
mipmap level that is closest in size to the screen triangle. Once
that level is chosen, Direct3D will filter that level based on the
specified min and mag filters.
D3DTEXF_LINEAR —By using this filter, Direct3D will take the two
closest mipmap levels, filter each level with the min and mag fil-
ters, and linearly combine these two levels to form the final color
values.
6.4.2 Using Mipmaps with Direct3D
Using mipmaps with Direct3D is easy. If the device supports mipmaps,
D3DXCreateTextureFromFile will generate a mipmap chain for
you. In addition, Direct3D automatically selects the mipmap that
matches the screen triangle the best. So mipmapping is pretty much
used and set up automatically.
6.5 Address Modes
Previously, we stated that texture coordinates must be specified in the
range [0, 1]. Technically, that is not correct; they can go outside that
range. The behavior for texture coordinates that go outside the [0, 1]
range is defined by the Direct3D address mode. There are four types of
address modes: wrap , border color , clamp , and mirror , which are illus-
trated in Figures 6.5, 6.6, 6.7, and 6.8, respectively.
Figure 6.5:
Wrap mode
Search WWH ::




Custom Search