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

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

頂點(diǎn)坐標(biāo)變換(6)

視區(qū)變換

視區(qū)(視口)變換是Direct3D頂點(diǎn)變換流水線的最后一步,它通過定義視區(qū)信息(屏幕顯示區(qū)域的實(shí)際寬和高等參數(shù)),完成頂點(diǎn)裁剪以及將頂點(diǎn)坐標(biāo)從投影坐標(biāo)變換為最終顯示的以像素為單位的屏幕坐標(biāo)等操作。裁剪過程保證不渲染完全在觀察平截面以外的對象,還確保對于與觀察平截面相交的對象,可以如下方式進(jìn)行渲染:即在視口指定范圍以外的部分不繪制像素。

 

1、定義視區(qū)

視區(qū)結(jié)構(gòu)D3DVIEWPORT9定義了Direct3D用以進(jìn)行視區(qū)變換的各項(xiàng)參數(shù):

Defines the window dimensions of a render-target surface onto which a 3D volume projects.

typedef struct D3DVIEWPORT9 {
DWORD X;
DWORD Y;
DWORD Width;
DWORD Height;
float MinZ;
float MaxZ;
} D3DVIEWPORT9, *LPD3DVIEWPORT9;

Members

X
Pixel coordinate of the upper-left corner of the viewport on the render-target surface. Unless you want to render to a subset of the surface, this member can be set to 0.
Y
Pixel coordinate of the upper-left corner of the viewport on the render-target surface. Unless you want to render to a subset of the surface, this member can be set to 0.
Width
Width dimension of the clip volume, in pixels. Unless you are rendering only to a subset of the surface, this member should be set to the width dimension of the render-target surface.
Height
Height dimension of the clip volume, in pixels. Unless you are rendering only to a subset of the surface, this member should be set to the height dimension of the render-target surface.
MinZ
Together with MaxZ, value describing the range of depth values into which a scene is to be rendered, the minimum and maximum values of the clip volume. Most applications set this value to 0.0. Clipping is performed after applying the projection matrix.
MaxZ
Together with MinZ, value describing the range of depth values into which a scene is to be rendered, the minimum and maximum values of the clip volume. Most applications set this value to 1.0. Clipping is performed after applying the projection matrix.

Remarks

The X, Y, Width, and Height members describe the position and dimensions of the viewport on the render-target surface. Usually, applications render to the entire target surface; when rendering on a 640 x 480 surface, these members should be 0, 0, 640, and 480, respectively. The MinZ and MaxZ are typically set to 0.0 and 1.0 but can be set to other values to achieve specific effects. For example, you might set them both to 0.0 to force the system to render objects to the foreground of a scene, or both to 1.0 to force the objects into the background.

When the viewport parameters for a device change (because of a call to the IDirect3DDevice9::SetViewport method), the driver builds a new transformation matrix.

 

2、視區(qū)設(shè)置

使用函數(shù)IDirect3DDevice9::SetViewport()設(shè)置Direct3D的視區(qū),其聲明如下:

HRESULT SetViewport(
CONST D3DVIEWPORT9 * pViewport
);

SetViewport()的作用相當(dāng)于把投影空間的頂點(diǎn)P(x, y, z, 1)乘以下面的矩陣:

因此,屏幕上的二維坐標(biāo)P'(x', y')的坐標(biāo)等于:

x' = x * width/2 + startx + width/2

y' = y * (-height/2) + starty + height/2

z' = z * (maxz - minz) + minz

這些坐標(biāo)被Direct3D用來進(jìn)行裁剪。

與SetViewport()相對應(yīng),可以通過函數(shù)IDirect3DDevice9::GetViewport()獲得當(dāng)前視區(qū)的相關(guān)信息,該函數(shù)聲明如下:

Retrieves the viewport parameters currently set for the device.

HRESULT GetViewport(
D3DVIEWPORT9 * pViewport
);

Parameters

pViewport
[out] Pointer to a D3DVIEWPORT9 structure, representing the returned viewport parameters.

Return Values

If the method succeeds, the return value is D3D_OK. D3DERR_INVALIDCALL is returned if the pViewport parameter is invalid.

Remarks

Typically, methods that return state will not work on a device that is created using D3DCREATE_PUREDEVICE. This method however, will work even on a pure device.

 

3、清空視區(qū)

一般情況下,在繪制每一幀圖形前都要先清空視區(qū),即清空渲染目標(biāo)表面上的視區(qū)矩形的內(nèi)容:顏色緩沖區(qū)、深度緩沖區(qū)或者模板緩沖區(qū)。使用函數(shù)IDirect3DDevice9::Clear()來清空視區(qū),該函數(shù)聲明如下:

Clears one or more surfaces such as a render target, multiple render targets, a stencil buffer, and a depth buffer.

HRESULT Clear(
DWORD Count,
CONST D3DRECT * pRects,
DWORD Flags,
D3DCOLOR Color,
float Z,
DWORD Stencil
);

Parameters

Count
[in] Number of rectangles in the array at pRects. Must be set to 0 if pRects is NULL. May not be 0 if pRects is a valid pointer.
pRects
[in] Pointer to an array of D3DRECT structures that describe the rectangles to clear. Set a rectangle to the dimensions of the rendering target to clear the entire surface. Each rectangle uses screen coordinates that correspond to points on the render target. Coordinates are clipped to the bounds of the viewport rectangle. To indicate that the entire viewport rectangle is to be cleared, set this parameter to NULL and Count to 0.
Flags
[in] Combination of one or more D3DCLEAR flags that specify the surface(s) that will be cleared.
Color
[in] Clear a render target to this ARGB color.
Z
[in] Clear the depth buffer to this new z value which ranges from 0 to 1. See remarks.
Stencil
[in] Clear the stencil buffer to this new value which ranges from 0 to 2n - 1 (n is the bit depth of the stencil buffer). See remarks.

Return Values

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

Remarks

Use this method to clear a surface including: a render target, all render targets in an MRT, a stencil buffer, or a depth buffer. Flags determines how many surfaces are cleared. Use pRects to clear a subset of a surface defined by an array of rectangles.

IDirect3DDevice9::Clear will fail if you:

  • Try to clear either the depth buffer or the stencil buffer of a render target that does not have an attached depth buffer.
  • Try to clear the stencil buffer when the depth buffer does not contain stencil data.

D3DCLEAR

These flags identify a surface to reset when calling IDirect3DDevice9::Clear.

#define Description
D3DCLEAR_STENCIL Clear the stencil buffer.
D3DCLEAR_TARGET Clear a render target, or all targets in a multiple render target. See Multiple Render Targets (Direct3D 9).
D3DCLEAR_ZBUFFER Clear the depth buffer.

 

獲取Direct3D坐標(biāo)變換矩陣

在Direct3D中,可以通過IDirect3DDevice9::GetTransform()獲取當(dāng)前的世界變換矩陣、觀察變換矩陣以及投影變換矩陣,該函數(shù)聲明如下:

Retrieves a matrix describing a transformation state.

HRESULT GetTransform(
D3DTRANSFORMSTATETYPE State,
D3DMATRIX * pMatrix
);

Parameters

State
[in] Device state variable that is being modified. This parameter can be any member of the D3DTRANSFORMSTATETYPE enumerated type, or the D3DTS_WORLDMATRIX macro.
pMatrix
[out] Pointer to a D3DMATRIX structure, describing the returned transformation state.

Return Values

If the method succeeds, the return value is D3D_OK. D3DERR_INVALIDCALL if one of the arguments is invalid.

Remarks

This method will not return device state for a device that is created using D3DCREATE_PUREDEVICE. If you want to use this method, you must create your device with any of the other flag values in D3DCREATE.


posted on 2008-05-02 13:54 lovedday 閱讀(1744) 評論(0)  編輯 收藏 引用


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


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(178)

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

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            久久综合九色九九| 久久影院午夜片一区| 欧美视频四区| 亚洲欧美国产va在线影院| 一区二区不卡在线视频 午夜欧美不卡在 | 欧美乱在线观看| 亚洲一区成人| 欧美在线free| 亚洲国产精品久久久久秋霞蜜臀| 欧美国产精品一区| 欧美日韩国产一区二区| 欧美一区二区日韩| 久久综合电影一区| 亚洲一区二区成人| 久久精品国产欧美亚洲人人爽| 亚洲国产高清视频| 亚洲视频网站在线观看| 在线观看日韩| 亚洲婷婷综合色高清在线| 一区一区视频| 亚洲视频日本| 91久久综合| 羞羞色国产精品| 日韩亚洲欧美成人一区| 午夜精品久久久久久久久久久久久| 一色屋精品视频在线看| 中国av一区| 亚洲精品久久久久久下一站| 亚洲免费视频一区二区| 亚洲精品之草原avav久久| 午夜国产精品影院在线观看| 亚洲精品国产精品国自产观看| 亚洲一区二区三区涩| 亚洲日本欧美日韩高观看| 欧美一区二区三区喷汁尤物| 一区二区三区久久| 久热精品视频在线观看一区| 性做久久久久久| 欧美激情2020午夜免费观看| 久久久久久高潮国产精品视| 欧美日韩亚洲天堂| 亚洲第一区在线观看| 国产乱码精品一区二区三区忘忧草| 欧美黄色视屏| 在线观看日韩一区| 欧美一区二区三区在线看| 亚洲午夜一级| 欧美美女bbbb| 亚洲高清久久| 在线观看欧美一区| 久久九九电影| 久久久最新网址| 国产主播喷水一区二区| 亚洲欧美美女| 欧美一区二区三区四区在线观看| 欧美日韩一二区| 99综合在线| 亚洲影院免费| 国产精品久久久免费| 中文精品视频| 亚洲视频在线一区观看| 欧美日韩一区二区三区四区在线观看 | 亚洲一级网站| 羞羞漫画18久久大片| 国产精品欧美日韩一区| 一区二区三区成人精品| 亚洲天堂网站在线观看视频| 欧美日韩一级片在线观看| 一本色道久久综合精品竹菊 | 久久久久久久成人| 影音先锋国产精品| 女人香蕉久久**毛片精品| 亚洲二区免费| 一本久道久久综合狠狠爱| 欧美日韩亚洲一区在线观看| 亚洲午夜未删减在线观看| 久久国产精品99国产精| 在线观看日韩欧美| 欧美精品一区二区三区在线播放| 亚洲伦理精品| 欧美制服第一页| 在线观看欧美日本| 欧美人交a欧美精品| 亚洲欧美精品在线| 欧美成人精品高清在线播放| av成人手机在线| 国产欧美日韩免费看aⅴ视频| 久久久久久久一区二区三区| 亚洲黄色成人| 欧美一区二区三区视频免费播放| 精品动漫一区| 欧美视频一区二区在线观看| 欧美诱惑福利视频| 亚洲三级影院| 久久九九久久九九| 99精品视频免费观看视频| 国产精品一区二区在线观看| 久久婷婷人人澡人人喊人人爽 | 欧美aⅴ99久久黑人专区| 亚洲视频自拍偷拍| 伊大人香蕉综合8在线视| 欧美日韩高清免费| 久久本道综合色狠狠五月| 亚洲精品视频在线| 另类春色校园亚洲| 亚洲免费在线视频| 亚洲黄色成人| 国产一区二区三区在线观看精品| 欧美大片免费观看在线观看网站推荐| 中国成人亚色综合网站| 欧美二区在线看| 久久久久久久91| 亚洲欧美日韩综合| 91久久一区二区| 韩国一区二区三区在线观看| 欧美三级网址| 欧美激情精品久久久久久变态| 午夜精品999| 亚洲午夜在线观看| 亚洲精品日韩激情在线电影| 蜜桃av一区| 久久久人成影片一区二区三区| 国产精品99久久久久久白浆小说| 在线观看视频日韩| 激情综合久久| 国产日韩欧美精品综合| 国产精品黄色| 欧美日韩一区二区精品| 欧美激情一区二区三级高清视频| 久久久久网址| 久久久www成人免费无遮挡大片| 亚洲综合电影一区二区三区| 在线亚洲成人| 一本一道久久综合狠狠老精东影业| 亚洲国产欧美日韩精品| 欧美激情免费在线| 欧美jjzz| 亚洲第一页中文字幕| 欧美fxxxxxx另类| 麻豆精品传媒视频| 欧美a级片一区| 欧美成人性网| 91久久综合亚洲鲁鲁五月天| 亚洲福利在线看| 亚洲三级电影在线观看| 亚洲精品一区在线观看香蕉| 野花国产精品入口| 亚洲一区二区在线免费观看视频 | 亚洲欧洲一区二区在线播放| 亚洲高清久久| 亚洲人精品午夜| 制服诱惑一区二区| 亚洲欧美国产视频| 久久久亚洲国产天美传媒修理工 | 欧美黄色成人网| 欧美三区在线视频| 国产精品社区| 一区二区亚洲精品国产| 亚洲黄色性网站| 一区二区动漫| 欧美一区二区三区免费视频| 久久久水蜜桃| 亚洲国产精品日韩| 亚洲美女黄色片| 亚洲欧美国产精品桃花| 老色鬼精品视频在线观看播放| 欧美成人综合| 国产精品自拍在线| 亚洲电影免费在线 | 欧美一级黄色网| 欧美暴力喷水在线| 在线视频亚洲欧美| 久久精品一区二区国产| 欧美激情综合亚洲一二区| 国产精品日韩精品| 亚洲欧洲日产国产网站| 亚洲一品av免费观看| 久热精品视频在线观看一区| 欧美高清影院| 亚洲欧美国产精品专区久久| 老司机精品久久| 国产区二精品视| 日韩图片一区| 久久午夜羞羞影院免费观看| 亚洲品质自拍| 久久久视频精品| 国产精品福利片| 亚洲精品国产精品国自产观看浪潮 | 亚洲精品三级| 久久久久天天天天| 亚洲色诱最新| 欧美大片专区| 在线观看成人av电影| 亚洲在线观看免费视频| 亚洲第一黄色| 久久综合一区二区| 国产乱人伦精品一区二区| 日韩视频在线观看国产| 免费亚洲电影在线观看| 性欧美精品高清|