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

天行健 君子當自強而不息

坐標系與基本圖元(1)

Direct3D基本圖元

圖元(primitives)是Direct3D中定義的基本圖形表示,它是組成一個單一實體的一組頂點。最簡單的圖元是三維坐標系中多個點的集合,稱為點列表(point list)。通常,圖元是多邊形(polygon),一個多邊形是由至少三條邊組成的封閉圖形。最簡單的多邊形是三角形,Direct3D使用三角形來構成大多數其他多邊形,這是因為三角形的三個頂點肯定是共面的,而渲染不共面的頂點效率比較低。通過組合三角形可以形成更大、更復雜的多邊形和網格(mesh)。

Direct3D定義了6中基本圖元。

Defines the primitives supported by Direct3D.

typedef enum D3DPRIMITIVETYPE
{
D3DPT_POINTLIST = 1,
D3DPT_LINELIST = 2,
D3DPT_LINESTRIP = 3,
D3DPT_TRIANGLELIST = 4,
D3DPT_TRIANGLESTRIP = 5,
D3DPT_TRIANGLEFAN = 6,
D3DPT_FORCE_DWORD = 0x7fffffff,
} D3DPRIMITIVETYPE, *LPD3DPRIMITIVETYPE;

Constants

D3DPT_POINTLIST
Renders the vertices as a collection of isolated points. This value is unsupported for indexed primitives.
D3DPT_LINELIST
Renders the vertices as a list of isolated straight line segments.
D3DPT_LINESTRIP
Renders the vertices as a single polyline.
D3DPT_TRIANGLELIST

Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle.

Back-face culling is affected by the current winding-order render state.

 

D3DPT_TRIANGLESTRIP
Renders the vertices as a triangle strip. The backface-culling flag is automatically flipped on even-numbered triangles.
D3DPT_TRIANGLEFAN
Renders the vertices as a triangle fan.
D3DPT_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

Using Triangle Strips (Direct3D 9) or Triangle Fans (Direct3D 9) is often more efficient than using triangle lists because fewer vertices are duplicated.

頂點集合(point list)(或稱為點列表)表示將要繪制的圖形是一組獨立的集合,在程序中可以使用點列表表示天空中的星星,或者點畫線等。對點列表圖元同樣可以應用紋理和材質,只不過材質或紋理的顏色只在畫點的位置顯示,而在點之外的任何地方都不顯示。

IDirect3DDevice9的DrawPrimitive()是Direct3D的圖元繪制方法,該方法的聲明如下:

Renders a sequence of nonindexed, geometric primitives of the specified type from the current set of data input streams.

HRESULT DrawPrimitive(
D3DPRIMITIVETYPE PrimitiveType,
UINT StartVertex,
UINT PrimitiveCount
);

Parameters

PrimitiveType
[in] Member of the D3DPRIMITIVETYPE enumerated type, describing the type of primitive to render.
StartVertex
[in] Index of the first vertex to load. Beginning at StartVertex the correct number of vertices will be read out of the vertex buffer.
PrimitiveCount
[in] Number of primitives to render. The maximum number of primitives allowed is determined by checking the MaxPrimitiveCount member of the D3DCAPS9 structure. PrimitiveCount is the number of primitives as determined by the primitive type. If it is a line list, each primitive has two vertices. If it is a triangle list, each primitive has three vertices.

Return Values

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

Remarks

When converting a legacy application to Direct3D 9, you must add a call to either IDirect3DDevice9::SetFVF to use the fixed function pipeline, or IDirect3DDevice9::SetVertexDeclaration to use a vertex shader before you make any Draw calls.

線段集合(line list)(或稱線段列表)表示一組相互獨立的直線段。線段集合可用于在三維場景中繪制下雨等效果,應用程序通過填充一組頂點創(chuàng)建一個線段集合。注意,頂點個數必須是大于等于2的偶數。可以將材質或紋理添加到線段集合中,默認情況下,材質或紋理的顏色沿線段變化而繪制,并不是線段上某一點的顏色。

線段條帶(line strip)是由一組相互連線的線段構成的圖元??梢允褂镁€段條帶創(chuàng)建不封閉的多邊形,封閉多邊形是指最后一個頂點與第一個頂點間用線段連接起來的多邊形。如果使用線段條帶創(chuàng)建多邊形,該多邊形有可能不共面,即不在一個平面內。

一個三角形集合(triangle list)是一系列獨立的三角形。它們可以彼此相鄰,也可以不相鄰。一個三角形集合的頂點數至少是3,并且它的頂點總數必須能被3整除。使用三角形集合創(chuàng)建的對象,其構成部件是不相交的。例如,在三維游戲中創(chuàng)建一面墻的方法就是具體指定一系列小的互不相連的三角形。然后給這些三角形加上看上去發(fā)光的材質和紋理,使墻上的每個三角形看上去都發(fā)光。因為三角形間可能存在間隙,當玩家盯著游戲中的場景時,可能發(fā)現墻后面的場景變得部分可見。

三角形條帶(triangle strips)是一系列相互連接的三角形。因為這些三角形是相互連接的,所以應用程序沒有為每個三角形指定它的三個頂點。大多數三維場景中的對象都是由三角形條帶構成的,這是因為三角形條帶可以高效利用內存和運行時間畫出復雜的對象。

三角形扇(triangle fans)與三角形條帶很相似,不同之處是,三角形扇形共享一個頂點。

 

使用頂點緩沖區(qū)繪制圖形

在Direct3D中,頂點緩沖區(qū)(vertex buffer)是Direct3D用來保存頂點數據的內存緩沖區(qū),由IDirect3DVertexBuffer9接口對象表示。頂點緩沖區(qū)可以保存任何類型的頂點數據,并可以對其中的頂點數據進行坐標變換、光照處理、裁剪等操作,頂點緩沖區(qū)中的頂點數據表示要輸出到屏幕上顯示的圖形。

根據圖形顯示的需要,頂點緩沖區(qū)中的頂點可以包含頂點坐標、顏色、法線方向、紋理坐標等屬性,至于頂點數據具體包含哪些屬性,可以使用靈活頂點格式(Flexible Vertex Format, FVF)進行描述。

Flexible Vertex Format Constants, or FVF codes, are used to describe the contents of vertices interleaved in a single data stream that will be processed by the fixed-function pipeline.

Vertex Data Flags

The following flags describe a vertex format. For information regarding vertex formats, see Fixed Function FVF Codes (Direct3D 9).

#define Description Data order and type
D3DFVF_DIFFUSE Vertex format includes a diffuse color component. DWORD in ARGB order. See D3DCOLOR_ARGB.
D3DFVF_NORMAL Vertex format includes a vertex normal vector. This flag cannot be used with the D3DFVF_XYZRHW flag. float, float, float
D3DFVF_PSIZE Vertex format specified in point size. This size is expressed in camera space units for vertices that are not transformed and lit, and in device-space units for transformed and lit vertices. float
D3DFVF_SPECULAR Vertex format includes a specular color component. DWORD in ARGB order. See D3DCOLOR_ARGB.
D3DFVF_XYZ Vertex format includes the position of an untransformed vertex. This flag cannot be used with the D3DFVF_XYZRHW flag. float, float, float.
D3DFVF_XYZRHW Vertex format includes the position of a transformed vertex. This flag cannot be used with the D3DFVF_XYZ or D3DFVF_NORMAL flags. float, float, float, float.
D3DFVF_XYZB1 through D3DFVF_XYZB5 Vertex format contains position data, and a corresponding number of weighting (beta) values to use for multimatrix vertex blending operations. Currently, Direct3D can blend with up to three weighting values and four blending matrices. For more information about using blending matrices, see Indexed Vertex Blending (Direct3D 9). 1, 2, or 3 floats. When D3DFVF_LASTBETA_UBYTE4 is used, the last blending weight is treated as a DWORD.
D3DFVF_XYZW Vertex format contains transformed and clipped (x, y, z, w) data. ProcessVertices does not invoke the clipper, instead outputting data in clip coordinates. This constant is designed for, and can only be used with, the programmable vertex pipeline. float, float, float, float

Texture Flags

The following flags describe texture flags used by the fixed-function pipeline.

#define Description
D3DFVF_TEX0 - D3DFVF_TEX8 Number of texture coordinate sets for this vertex. The actual values for these flags are not sequential.
D3DFVF_TEXCOORDSIZEN(coordIndex) Define a texture coordinate data set. n indicates the dimension of the texture coordinates. coordIndex indicates texture coordinate index number. See D3DFVF_TEXCOORDSIZEN and Texture coordinates and Texture Stages.

Mask Flags

The following flags describe mask flags used by the fixed-function pipeline.

#define Description
D3DFVF_POSITION_MASK Mask for position bits.
D3DFVF_RESERVED0, D3DFVF_RESERVED2 Mask values for reserved bits in the FVF. Do not use.
D3DFVF_TEXCOUNT_MASK Mask value for texture flag bits.

Miscellaneous Flags

The following flags describe a variety of flags used by the fixed-function pipeline.

#define Description
D3DFVF_LASTBETA_D3DCOLOR The last beta field in the vertex position data will be of type D3DCOLOR. The data in the beta fields are used with matrix palette skinning to specify matrix indices.
D3DFVF_LASTBETA_UBYTE4 The last beta field in the vertex position data will be of type UBYTE4. The data in the beta fields are used with matrix palette skinning to specify matrix indices.
// Given the following vertex data definition: 
struct VERTEXPOSITION
{
float pos[3];
union
{
float beta[5];
struct
{
float weights[4];
DWORD MatrixIndices; // Used as UBYTEs
}
}
};

Given the FVF is declared as: D3DFVF_XYZB5 | D3DFVF_LASTBETA_UBYTE4. Weight and MatrixIndices are included in beta[5], where D3DFVF_LASTBETA_UBYTE4 says to interpret the last DWORD in beta[5] as type UBYTE4.

D3DFVF_TEXCOUNT_SHIFT The number of bits by which to shift an integer value that identifies the number of texture coordinates for a vertex. This value might be used as shown below.
DWORD dwNumTextures = 1;  // Vertex has only one set of coordinates.

// Shift the value for use when creating a
// flexible vertex format (FVF) combination.
dwFVF = dwNumTextures << D3DFVF_TEXCOUNT_SHIFT;

// Now, create an FVF combination using the shifted value.

Examples

The following examples show other common flag combinations.

// Untransformed vertex for lit, untextured, Gouraud-shaded content.
dwFVF = ( D3DFVF_XYZ | D3DFVF_DIFFUSE );
// Untransformed vertex for unlit, untextured, Gouraud-shaded 
// content with diffuse material color specified per vertex.
dwFVF = ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE );
// Untransformed vertex for light-map-based lighting.
dwFVF = ( D3DFVF_XYZ | D3DFVF_TEX2 );
// Transformed vertex for light-map-based lighting with shared rhw.
dwFVF = ( D3DFVF_XYZRHW | D3DFVF_TEX2 );
// Heavyweight vertex for unlit, colored content with two 
// sets of texture coordinates.
dwFVF = ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX2 );

posted on 2008-04-30 12:25 lovedday 閱讀(1586) 評論(0)  編輯 收藏 引用


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


公告

導航

統(tǒng)計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲欧洲日本一区二区三区| 欧美国产精品日韩| 久久免费精品视频| 亚洲欧美激情在线视频| 狂野欧美一区| 久久精品日产第一区二区三区| 女同一区二区| 美女国内精品自产拍在线播放| 国产精品久久久久久影院8一贰佰 国产精品久久久久久影视 | 欧美激情亚洲国产| 久久―日本道色综合久久| 国产精品福利影院| 亚洲精品视频在线观看免费| 亚洲国产成人精品女人久久久 | 亚洲精品一区二区三区在线观看| 精品9999| 久久久久久免费| 狂野欧美一区| 国内免费精品永久在线视频| 亚洲欧美视频一区| 欧美影院视频| 国产精品亚洲片夜色在线| 夜夜爽av福利精品导航| avtt综合网| 欧美精彩视频一区二区三区| 亚洲国产专区校园欧美| 亚洲国产精品成人综合| 久久亚洲精品欧美| 欧美大胆人体视频| 亚洲人在线视频| 欧美日韩国产免费| 亚洲伦理久久| 午夜国产精品视频免费体验区| 欧美性色综合| 亚洲一区二区少妇| 久久精品国产一区二区电影| 狠狠久久亚洲欧美| 久久欧美肥婆一二区| 欧美成ee人免费视频| 亚洲国产婷婷| 欧美日韩国产页| 亚洲自拍偷拍一区| 久久国产免费看| 亚洲电影免费观看高清| 欧美大胆成人| 一区二区精品国产| 久久成人精品电影| 在线观看日韩www视频免费| 你懂的网址国产 欧美| 亚洲精品一区二| 欧美怡红院视频| 黄色成人小视频| 欧美激情第4页| 亚洲少妇诱惑| 美女免费视频一区| 日韩小视频在线观看| 国产精品成人免费视频| 欧美一级视频一区二区| 欧美激情视频一区二区三区免费| 一本久道综合久久精品| 国产日韩视频一区二区三区| 欧美成人国产一区二区| 亚洲天堂av图片| 嫩草影视亚洲| 亚洲在线免费视频| 在线播放国产一区中文字幕剧情欧美 | 激情欧美亚洲| 欧美日韩另类国产亚洲欧美一级| 亚洲欧美日韩精品久久| 亚洲国产另类久久久精品极度| 亚洲永久免费观看| 亚洲国产专区校园欧美| 国产精品国产三级国产专区53| 久久久久久高潮国产精品视| 日韩午夜电影av| 免费在线一区二区| 午夜日韩在线| 一区二区免费看| 一区二区三区在线免费视频| 欧美特黄视频| 欧美日韩国产另类不卡| 久久亚洲电影| 欧美一区二区三区四区高清| 亚洲精品一区二区三区四区高清| 美女成人午夜| 久久国产黑丝| 亚洲欧美日韩一区| 一本色道久久88综合日韩精品| 在线精品观看| 国产欧美激情| 国产精品美女久久久浪潮软件| 欧美精品www| 美女成人午夜| 卡通动漫国产精品| 久久国产精品99国产| 亚洲伊人网站| 亚洲午夜未删减在线观看| 亚洲精品美女在线观看| 欧美高清视频一区二区三区在线观看 | 亚洲电影有码| 欧美成人一区二区| 免费观看成人| 久久午夜激情| 久久亚洲私人国产精品va媚药| 欧美一级片在线播放| 国产精品99久久久久久久vr| 日韩亚洲视频| 一本到高清视频免费精品| 亚洲伦理精品| 亚洲色图综合久久| 在线性视频日韩欧美| 99在线精品视频在线观看| 亚洲精品一区二区三| 亚洲精品日韩一| 99re热这里只有精品免费视频| 亚洲激情六月丁香| 亚洲精品一区二区三区四区高清 | 蜜臀久久99精品久久久画质超高清| 久久不射电影网| 久久精品人人| 免费高清在线一区| 欧美国产日本| 欧美视频一区二区三区…| 欧美日韩在线三级| 国产精品日韩一区二区| 国产日产欧美精品| 一区免费观看视频| 亚洲韩国青草视频| 99re在线精品| 亚洲女与黑人做爰| 久久成年人视频| 欧美国产精品人人做人人爱| 亚洲精品视频在线播放| 亚洲伊人色欲综合网| 久久精品视频免费| 欧美精品三级| 国产精品亚洲综合久久| 国语自产在线不卡| 亚洲精品日本| 欧美在线日韩| 亚洲国产精品激情在线观看| 99国产精品久久久久久久| 香蕉av福利精品导航| 另类尿喷潮videofree | 黄色成人在线免费| 亚洲美女毛片| 欧美一区二区视频网站| 亚洲电影第三页| 亚洲女人天堂av| 嫩草伊人久久精品少妇av杨幂| 国产精品多人| 亚洲黄页视频免费观看| 午夜精品福利一区二区三区av| 麻豆成人91精品二区三区| 一本色道久久99精品综合| 久久国产精品久久精品国产| 欧美激情1区2区| 国产亚洲免费的视频看| 日韩视频三区| 毛片av中文字幕一区二区| 亚洲视频在线观看免费| 美女脱光内衣内裤视频久久影院| 国产精品久久久久av免费| 亚洲国产精品黑人久久久| 亚洲欧美日韩综合aⅴ视频| 欧美夫妇交换俱乐部在线观看| 亚洲综合色丁香婷婷六月图片| 欧美成人精品三级在线观看| 国产日韩欧美综合精品| 这里只有视频精品| 欧美激情视频一区二区三区免费| 欧美亚洲免费高清在线观看| 欧美日韩理论| 亚洲精选在线| 欧美成人中文| 久久精品成人一区二区三区 | 亚洲成色最大综合在线| 久久成人18免费观看| 国产精品99久久久久久久女警 | 欧美视频在线免费| 亚洲精品自在在线观看| 美女黄色成人网| 久久精品亚洲| 国产色爱av资源综合区| 午夜国产不卡在线观看视频| 99av国产精品欲麻豆| 欧美日韩国产一区| 夜夜嗨av一区二区三区中文字幕 | 欧美视频第二页| 日韩午夜一区| 亚洲国产经典视频| 免费观看一区| 亚洲国产日韩欧美综合久久| 玖玖国产精品视频| 久久久www成人免费无遮挡大片 | 久久久av水蜜桃| 欧美在线视频观看| 国产欧美一区二区三区在线老狼 | 亚洲视频在线观看| 国产精品热久久久久夜色精品三区|