wpf 動畫 2個表單切換

來源:互聯網
上載者:User

標籤:c   style   class   blog   code   a   

先看看 MSDN 的 簡介

先說說 Positions,介紹說 是頂點位置的集合,什麼意思,看張圖片。

這張簡單描述了一個三位座標系,裡面有四個座標點,也就是頂點位置,都已標出,也就組成了集合(Positions)。

它所標示的是一個正方形,先放在這裡,下面說一下TriangleIndices。

往往分不清 TriangleIndices 和 Positions 的關係。

舉個例子:

TriangleIndices="0 1 2 2 3 0"

它所表示的是什麼。每個數字什麼意思。

先講一下概念,字面意思是三角形索引的集合。為什麼要用到三角形呢,因為在3D圖形的世界裡,所有物體都可以被描述成為一系列三角形的集合。

比如我們現在畫的這個正方形,可以有兩個三角形組成。

那麼TriangleIndices="0 1 2 2 3 0"  按照圖片顯示的可以翻譯成 “P0 P1 P2,P2 P3 P0”,或者 0 對應 (-1,1,0),1 對應 (-1,-1,0),以此類推。

這裡面的每個數字對應這圖片裡的每個點。可是為什麼這樣對應呢。

這關係到三角形呈現的是有正反面區分的,可以看出上面每三個點組成的一個三角形都是逆時針順序的,這是因為WPF採用逆時針的環繞方式來顯示正面,

或者用右手定則:握住右手,伸出拇指,四指為逆時針方向,拇指指向正面。

如果你那順序反過來,會顯示一片黑。因為你沒描述背面。

到這裡基本就搞清了TriangleIndices 和 Positions 的關係。

這兩個也是比較主要的屬性,因為另兩個屬性,不寫的話,會自動判斷來給出預設值。

來說說 Normals 和 TextureCoordinates。

Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">TextureCoordinates:紋理座標用於確定將 Material 映射到構成網格的三角形的頂點的方式。 

Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">這個比較好理解,比如

Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">TextureCoordinates="0,0 0,1 1,1 1,0"

Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">一般材質的的正常座標按照來說順序依次是 P0,P3,P2,P1。也就是說 0,0 0,1 1,1 1,0 這是一個正常順序,是按照本來畫面顯示的。

Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">但如果換成Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">TextureCoordinates="1 0, 0 0, 0 1, 1 1",你會發現顯示的畫面向左倒了。

Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">這也和你定義的座標集合有關係。

Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">最後是

Material is mapped to the vertices of the triangles that make up a mesh. ‘ data-guid="535eead1b023b6ec65afc67428a2db30">Normals:法向量是與定義網格的每個三角形的面垂直的向量。 法向量用於確定是否亮顯給定三角形面。如果指定了三角形索引,則將考慮相鄰面來產生法向量。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.