Share via


使用定點頂點資料

更新:2007 年 11 月

您可以使用定點頂點資料,對於在硬體中沒有實作轉換和光源的 3D 圖形驅動程式,增加轉換和光源速度。某些驅動程式在定點資料上運作更快速。您可以檢查 DeviceCaps 結構的 NativeFloat 屬性,以判斷您的驅動程式是否使用浮點數學運作。如果屬性值為 false,對裝置使用定點格式資料就是較好的做法。所有 Windows Mobile Direct3D 驅動程式都需要同時支援定點和浮點資料。

定點頂點緩衝區的使用方式和浮點頂點緩衝區相同。唯一的差異在於其所包含資料的格式,以及在建立頂點緩衝區時指定的彈性頂點格式 (Flexible Vertex Format)。

如果資料原本不屬於定點格式,您可以建構含有浮點資料的 Mesh 物件,然後呼叫 Mesh 物件的 Clone 方法,將資料轉換為定點資料。

下表會列出用來對浮點和定點資料指定各種彈性格式的 VertexFormats 列舉值。這份清單並未涵蓋所有的可能性,不過提供了定點彈性頂點格式如何與浮點彈性頂點格式不同的範例。

格式

浮點規格

定點規格

只有位置

VertexFormats.Position

VertexFormats.PositionFixed

位置和標準

VertexFormats.Position | VertexFormats.Normal

VertexFormats.PositionFixed | VertexFormats.NormalFixed

位置和散佈色彩

VertexFormats.Position | VertexFormats.Diffuse

VertexFormats.PositionFixed | VertexFormats.Diffuse

位置和一個 2D 紋理座標

VertexFormats.Position | VertexFormats.Texture1

VertexFormats.PositionFixed | VertexFormats.Texture1 | VertexTextureCoordinate.Fixed(0)

位置、標準、鏡面色彩、散佈色彩、1D 紋理座標,以及 2D 紋理座標

VertexFormats.Position | VertexFormats.Normal | VertexFormats.Diffuse | VertexFormats.Texture2 | VertexTextureCoordinate.Size1(0)

VertexFormats.PositionFixed | VertexFormats.NormalFixed | VertexFormats.Diffuse | VertexFormats.Texture2 | VertexTextureCoordinate.Size1(0) | VertexTextureCoordinate.Fixed(0) | VertexTextureCoordinate.Fixed(1)

 

請參閱

其他資源

.NET Compact Framework 中的 Mobile Direct3D 程式設計