青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當(dāng)自強(qiáng)而不息

紋理映射基礎(chǔ)(3)

當(dāng)Direct3D渲染一個(gè)圖元時(shí),必須將它通過(guò)坐標(biāo)變換映射到二維屏幕上。如果圖元有紋理,Direct3D就需要用紋理來(lái)產(chǎn)生圖元的二維渲染圖像上每個(gè)像素的顏色。對(duì)于圖元在二維屏幕上圖像的每個(gè)像素來(lái)說(shuō),都必須從紋理中獲得一個(gè)顏色,從紋理中為每個(gè)像素獲取顏色的過(guò)程稱(chēng)為紋理過(guò)濾(texture filtering)。

大多數(shù)情況下,屏幕顯示的圖形大小與紋理貼圖大小不相同,換句話(huà)說(shuō),這個(gè)紋理將被映射到一個(gè)比它大或小的圖元的圖像上,這樣紋理常常會(huì)被放大或縮小。對(duì)紋理的放大會(huì)造成許多像素被映射到同一個(gè)紋理元素,圖形渲染結(jié)果會(huì)有色塊的感覺(jué)。縮小一個(gè)紋理意味著一個(gè)像素被映射到許多紋理元素,圖形看上去會(huì)閃爍失真或有鋸齒。為了解決這些問(wèn)題,可以將相關(guān)紋理元素的顏色融合到一個(gè)像素上,如何將多個(gè)紋理元素的顏色融合到一個(gè)像素上取決于紋理過(guò)濾方式。

Direct3D支持4種紋理過(guò)濾方式,分別是:最近點(diǎn)采樣(nearest-point sampling)、線(xiàn)性紋理過(guò)濾(linear texture filtering)、各向異性紋理過(guò)濾(anisotropic texture filtering)和多級(jí)漸進(jìn)紋理過(guò)濾(texture filtering with mipmaps)。不同的紋理過(guò)濾方式產(chǎn)生的圖像效果差別可能很大。

4種紋理過(guò)濾方法各有優(yōu)缺點(diǎn)。例如,線(xiàn)性過(guò)濾生成的圖像較粗糙,但計(jì)算量小。多級(jí)漸進(jìn)紋理過(guò)濾的效果通常最好,特別是和各項(xiàng)異性過(guò)濾聯(lián)合使用時(shí)效果更好,但是它需要Direct3D提供的內(nèi)存空間最多,計(jì)算量也最大。

紋理采樣屬性設(shè)置函數(shù)IDirect3DDevice9::SetSamplerState()可以用來(lái)設(shè)置紋理過(guò)濾方式。該函數(shù)的聲明如下:

Sets the sampler state value.

HRESULT SetSamplerState(
DWORD Sampler,
D3DSAMPLERSTATETYPE Type,
DWORD Value
);

Parameters

Sampler
[in] The sampler stage index.
Type
[in] This parameter can be any member of the D3DSAMPLERSTATETYPE enumerated type.
Value
[in] State value to set. The meaning of this value is determined by the Type parameter.

Return Values

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.

參數(shù)Type屬于D3DSAMPLERSTATETYPE類(lèi)型,用來(lái)指定對(duì)哪種紋理采樣屬性賦值。

D3DSAMPLERSTATETYPE

Sampler states define texture sampling operations such as texture addressing and texture filtering. Some sampler states set-up vertex processing, and some set-up pixel processing. Sampler states can be saved and restored using stateblocks (see State Blocks Save and Restore State (Direct3D 9)).

typedef enum D3DSAMPLERSTATETYPE
{
D3DSAMP_ADDRESSU = 1,
D3DSAMP_ADDRESSV = 2,
D3DSAMP_ADDRESSW = 3,
D3DSAMP_BORDERCOLOR = 4,
D3DSAMP_MAGFILTER = 5,
D3DSAMP_MINFILTER = 6,
D3DSAMP_MIPFILTER = 7,
D3DSAMP_MIPMAPLODBIAS = 8,
D3DSAMP_MAXMIPLEVEL = 9,
D3DSAMP_MAXANISOTROPY = 10,
D3DSAMP_SRGBTEXTURE = 11,
D3DSAMP_ELEMENTINDEX = 12,
D3DSAMP_DMAPOFFSET = 13,
D3DSAMP_FORCE_DWORD = 0x7fffffff,
} D3DSAMPLERSTATETYPE, *LPD3DSAMPLERSTATETYPE;

Constants

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.
D3DSAMP_ADDRESSW
Texture-address mode for the w coordinate. The default is D3DTADDRESS_WRAP. For more information, see D3DTEXTUREADDRESS.
D3DSAMP_BORDERCOLOR
Border color or type D3DCOLOR. The default color is 0x00000000.
D3DSAMP_MAGFILTER
Magnification filter of type D3DTEXTUREFILTERTYPE. The default value is D3DTEXF_POINT.
D3DSAMP_MINFILTER
Minification filter of type D3DTEXTUREFILTERTYPE. The default value is D3DTEXF_POINT.
D3DSAMP_MIPFILTER
Mipmap filter to use during minification. See D3DTEXTUREFILTERTYPE. The default value is D3DTEXF_NONE.
D3DSAMP_MIPMAPLODBIAS
Mipmap level-of-detail bias. The default value is zero.
D3DSAMP_MAXMIPLEVEL
level-of-detail index of largest map to use. Values range from 0 to (n - 1) where 0 is the largest. The default value is zero.
D3DSAMP_MAXANISOTROPY
DWORD maximum anisotropy. The default value is 1.
D3DSAMP_SRGBTEXTURE
Gamma correction value. The default value is 0, which means gamma is 1.0 and no correction is required. Otherwise, this value means that the sampler should assume gamma of 2.2 on the content and convert it to linear (gamma 1.0) before presenting it to the pixel shader.
D3DSAMP_ELEMENTINDEX
When a multielement texture is assigned to the sampler, this indicates which element index to use. The default value is 0.
D3DSAMP_DMAPOFFSET
Vertex offset in the presampled displacement map. This is a constant used by the tessellator, its default value is 0.
D3DSAMP_FORCE_DWORD
Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

其中,D3DSAMP_MAGFILTER、D3DSAMP_MINFILTER、D3DSAMP_MIPFILTER、D3DSAMP_MIPMAPLODBIAS、D3DSAMP_MAXMIPLEVEL和D3DSAMP_MAXANISOTROPY用來(lái)控制紋理過(guò)濾方式。

D3DTEXTUREFILTERTYPE

Defines texture filtering modes for a texture stage.

typedef enum D3DTEXTUREFILTERTYPE
{
D3DTEXF_NONE = 0,
D3DTEXF_POINT = 1,
D3DTEXF_LINEAR = 2,
D3DTEXF_ANISOTROPIC = 3,
D3DTEXF_PYRAMIDALQUAD = 6,
D3DTEXF_GAUSSIANQUAD = 7,
D3DTEXF_CONVOLUTIONMONO = 8,
D3DTEXF_FORCE_DWORD = 0x7fffffff,
} D3DTEXTUREFILTERTYPE, *LPD3DTEXTUREFILTERTYPE;

Constants

D3DTEXF_NONE
Mipmapping disabled. The rasterizer should use the magnification filter instead.
D3DTEXF_POINT
Point filtering used as a texture magnification or minification filter. The texel with coordinates nearest to the desired pixel value is used. The texture filter to be used between mipmap levels is nearest-point mipmap filtering. The rasterizer uses the color from the texel of the nearest mipmap texture.
D3DTEXF_LINEAR
Bilinear interpolation filtering used as a texture magnification or minification filter. A weighted average of a 2 x 2 area of texels surrounding the desired pixel is used. The texture filter to use between mipmap levels is trilinear mipmap interpolation. The rasterizer linearly interpolates pixel color, using the texels of the two nearest mipmap textures.
D3DTEXF_ANISOTROPIC
Anisotropic texture filtering used as a texture magnification or minification filter. Compensates for distortion caused by the difference in angle between the texture polygon and the plane of the screen.
D3DTEXF_PYRAMIDALQUAD
A 4-sample tent filter used as a texture magnification or minification filter.
D3DTEXF_GAUSSIANQUAD
A 4-sample Gaussian filter used as a texture magnification or minification filter.
D3DTEXF_CONVOLUTIONMONO
Convolution filter for monochrome textures. See D3DFMT_A1.
Differences between Direct3D 9 and Direct3D 9Ex:

This flag is available in Direct3D 9Ex only.

D3DTEXF_FORCE_DWORD
Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

Remarks

To check if a format supports texture filter types other than D3DTEXF_POINT (which is always supported), call IDirect3D9::CheckDeviceFormat with D3DUSAGE_QUERY_FILTER.

Set a texture stage's magnification filter by calling IDirect3DDevice9::SetSamplerState with the D3DSAMP_MAGFILTER value as the second parameter and one member of this enumeration as the third parameter.

Set a texture stage's minification filter by calling IDirect3DDevice9::SetSamplerState with the D3DSAMP_MINFILTER value as the second parameter and one member of this enumeration as the third parameter.

Set the texture filter to use between-mipmap levels by calling IDirect3DDevice9::SetSamplerState with the D3DSAMP_MIPFILTER value as the second parameter and one member of this enumeration as the third parameter.

Not all valid filtering modes for a device will apply to volume maps. In general, D3DTEXF_POINT and D3DTEXF_LINEAR magnification filters will be supported for volume maps. If D3DPTEXTURECAPS_MIPVOLUMEMAP is set, then the D3DTEXF_POINT mipmap filter and D3DTEXF_POINT and D3DTEXF_LINEAR minification filters will be supported for volume maps. The device may or may not support the D3DTEXF_LINEAR mipmap filter for volume maps. Devices that support anisotropic filtering for 2D maps do not necessarily support anisotropic filtering for volume maps. However, applications that enable anisotropic filtering will receive the best available filtering (probably linear) if anisotropic filtering is not supported.

Unsigned Formats

Data in an unsigned format must be positive. Unsigned formats use combinations of (R)ed, (G)reen, (B)lue, (A)lpha, (L)uminance, and (P)alette data. Palette data is also referred to as color indexed data because the data is used to index a color palette.

Unsigned format flags Value Format
D3DFMT_R8G8B8 20 24-bit RGB pixel format with 8 bits per channel.
D3DFMT_A8R8G8B8 21 32-bit ARGB pixel format with alpha, using 8 bits per channel.
D3DFMT_X8R8G8B8 22 32-bit RGB pixel format, where 8 bits are reserved for each color.
D3DFMT_R5G6B5 23 16-bit RGB pixel format with 5 bits for red, 6 bits for green, and 5 bits for blue.
D3DFMT_X1R5G5B5 24 16-bit pixel format where 5 bits are reserved for each color.
D3DFMT_A1R5G5B5 25 16-bit pixel format where 5 bits are reserved for each color and 1 bit is reserved for alpha.
D3DFMT_A4R4G4B4 26 16-bit ARGB pixel format with 4 bits for each channel.
D3DFMT_R3G3B2 27 8-bit RGB texture format using 3 bits for red, 3 bits for green, and 2 bits for blue.
D3DFMT_A8 28 8-bit alpha only.
D3DFMT_A8R3G3B2 29 16-bit ARGB texture format using 8 bits for alpha, 3 bits each for red and green, and 2 bits for blue.
D3DFMT_X4R4G4B4 30 16-bit RGB pixel format using 4 bits for each color.
D3DFMT_A2B10G10R10 31 32-bit pixel format using 10 bits for each color and 2 bits for alpha.
D3DFMT_A8B8G8R8 32 32-bit ARGB pixel format with alpha, using 8 bits per channel.
D3DFMT_X8B8G8R8 33 32-bit RGB pixel format, where 8 bits are reserved for each color.
D3DFMT_G16R16 34 32-bit pixel format using 16 bits each for green and red.
D3DFMT_A2R10G10B10 35 32-bit pixel format using 10 bits each for red, green, and blue, and 2 bits for alpha.
D3DFMT_A16B16G16R16 36 64-bit pixel format using 16 bits for each component.
D3DFMT_A8P8 40 8-bit color indexed with 8 bits of alpha.
D3DFMT_P8 41 8-bit color indexed.
D3DFMT_L8 50 8-bit luminance only.
D3DFMT_L16 81 16-bit luminance only.
D3DFMT_A8L8 51 16-bit using 8 bits each for alpha and luminance.
D3DFMT_A4L4 52 8-bit using 4 bits each for alpha and luminance.
D3DFMT_A1 118 1-bit monochrome.
Differences between Direct3D 9 and Direct3D 9Ex:

This flag is available in Direct3D 9Ex only.

D3DFMT_BINARYBUFFER 199 Binary format indicating that the data has no inherent type.
Differences between Direct3D 9 and Direct3D 9Ex:

This flag is available in Direct3D 9Ex only.


posted on 2008-05-07 08:16 lovedday 閱讀(2939) 評(píng)論(1)  編輯 收藏 引用

評(píng)論

# re: 紋理映射基礎(chǔ)(3) 2008-12-03 16:57

垃圾  回復(fù)  更多評(píng)論   


只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(lèi)(178)

3D游戲編程相關(guān)鏈接

搜索

最新評(píng)論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            一本一道久久综合狠狠老精东影业| 欧美激情亚洲视频| 亚洲精品免费在线观看| 久久一区二区三区超碰国产精品| 亚洲最新在线| 久久裸体艺术| 久久精品国内一区二区三区| 欧美日韩一区在线播放| 欧美黄色小视频| 欧美精品系列| 亚洲综合三区| 欧美调教视频| 一本久久综合亚洲鲁鲁五月天| 国产精品久久久久影院色老大 | 欧美理论在线播放| 亚洲一区二区三区乱码aⅴ| 一区二区欧美激情| 国产亚洲精品福利| 亚洲综合丁香| 亚洲国产精品va在线看黑人动漫 | 欧美一级二区| 久久久久国产免费免费| 亚洲巨乳在线| 免费观看一区| 亚洲精品美女| 亚洲午夜伦理| 久久精品在这里| 亚洲九九九在线观看| 在线视频日韩精品| 一区在线免费观看| 99精品久久久| 永久域名在线精品| 久久综合狠狠综合久久综合88| 久久综合色8888| 在线国产日韩| 亚洲性夜色噜噜噜7777| 欧美亚洲免费电影| 国内在线观看一区二区三区| 久久久久国产成人精品亚洲午夜| 一区二区三区黄色| 久久精品国产免费观看| 亚洲视频电影图片偷拍一区| 欧美精品一区二区三区久久久竹菊 | 在线观看视频一区| 欧美成人免费网| 久久国产色av| 欧美理论在线| 欧美高清视频在线| 一本一本久久| 欧美高清在线精品一区| 久久裸体艺术| 亚洲欧洲精品一区二区三区| 欧美激情免费在线| 亚洲一区国产一区| 欧美成人dvd在线视频| 一区二区三区精品国产| 国产精品专区h在线观看| 99re6这里只有精品| 午夜精品国产更新| 影音先锋久久久| 欧美三级日韩三级国产三级| 亚洲人成网在线播放| 亚洲一区二区三区精品视频| 国产最新精品精品你懂的| 亚洲欧洲99久久| 欧美激情成人在线| 欧美一区二区福利在线| 亚洲欧洲日韩在线| 国产一区二区三区久久久久久久久| 一区二区三区精密机械公司| 99在线精品免费视频九九视| 国产视频观看一区| 欧美精品在线免费播放| 亚洲国产另类 国产精品国产免费| 亚洲一区二区在| 欧美亚日韩国产aⅴ精品中极品| 亚洲国产三级| 99热在线精品观看| 狠狠久久婷婷| 国产精品视频导航| 亚洲在线观看| 午夜性色一区二区三区免费视频| 欧美日韩亚洲系列| 一本久久综合| 亚洲国产日韩欧美一区二区三区| 亚洲欧洲精品成人久久奇米网| 鲁大师影院一区二区三区| 欧美大片第1页| 久久久精品动漫| 性色av一区二区三区在线观看 | 日韩视频在线观看| 久久综合久久久久88| 午夜久久一区| 亚洲综合色网站| 国产一区二区三区av电影| 久久精品中文字幕免费mv| 亚洲欧美日韩精品一区二区| 99国产精品视频免费观看| 亚洲国产毛片完整版| 亚洲午夜精品福利| 国产日本欧美视频| 久久先锋影音av| 亚洲欧洲在线播放| 欧美激情在线观看| 欧美电影在线观看| 亚洲视频一区| 国产在线麻豆精品观看| 鲁大师成人一区二区三区| 久久精品系列| 亚洲欧洲精品一区| 亚洲精品欧美| 亚洲免费播放| 久久综合网色—综合色88| 久久久夜精品| 欧美国产丝袜视频| 午夜精品福利一区二区三区av| 亚洲综合国产精品| 亚洲第一精品福利| 亚洲国产成人在线视频| 国产精品毛片大码女人| 久久亚洲综合| 欧美激情1区2区| 久久精品夜色噜噜亚洲a∨| 日韩亚洲欧美高清| 亚洲图片在线| 亚洲精品视频啊美女在线直播| 久久久精品一区| 久久综合综合久久综合| 亚洲字幕在线观看| 亚洲精品欧美专区| 一本色道久久综合亚洲91| 亚洲欧美日韩综合国产aⅴ| 久久成人18免费网站| 亚洲天堂男人| 亚洲精品久久久一区二区三区| 亚洲裸体视频| 亚洲黄色免费电影| 亚洲小视频在线| 久久久久久久欧美精品| 亚洲福利视频三区| 亚洲视频欧美视频| 久久蜜桃精品| 欧美日韩国产综合视频在线观看 | 欧美性色综合| 欧美日韩国产成人精品| 国产噜噜噜噜噜久久久久久久久| 欧美人与禽性xxxxx杂性| 国产精品久久久久久亚洲毛片| 欧美日韩高清一区| 欧美精品日韩一本| 国产一区二区高清不卡| 亚洲精品午夜精品| 久久精品1区| 亚洲精品一级| 一本色道久久综合亚洲精品小说 | 一区二区三区精品| 亚洲一区免费| 老司机一区二区三区| 一区二区三区国产精品| 欧美日韩精品欧美日韩精品一| 欧美不卡福利| 亚洲视频axxx| 模特精品裸拍一区| 国产一区二区三区精品欧美日韩一区二区三区| 国产精品九九| 亚洲精品乱码久久久久久蜜桃91| 欧美亚洲一级| 99国产精品久久久久久久成人热| 久久综合色天天久久综合图片| 免费不卡欧美自拍视频| 免费久久99精品国产| 国产一区二区三区无遮挡| 国内在线观看一区二区三区| 红桃视频亚洲| 欧美在线一级视频| 一区二区久久| 欧美日韩国产麻豆| 亚洲精品久久久久中文字幕欢迎你| 亚洲精品中文字| 亚洲一级高清| 久久久久久久久久久一区| 模特精品裸拍一区| 亚洲精品免费在线| 美日韩精品视频| 亚洲第一精品福利| 媚黑女一区二区| 亚洲精品在线一区二区| 亚洲午夜精品17c| 久久精品视频在线观看| 国产日韩欧美中文| 亚洲欧美日韩直播| 亚洲一区二区在| 国产精品一级在线| 久久精品日韩欧美| 亚洲黄色av一区| 欧美巨乳在线观看| 国产一区二区| 久热国产精品| 牛牛国产精品| 国产亚洲a∨片在线观看|