首页 > Windows开发 > 详细

十五、polygon API

时间:2016-02-11 14:31:56      阅读:276      评论:0      收藏:0      [点我收藏+]

用来存储polygon(faces,edges,vertices)等部分的基本数据结构,这些数据结构然后被封装到polygonal shape nodes,这些节点构成maya的基本结构——dependency graph。

 

Polygon components:

 polygon Mesh 由三种基本的component组成: 

1. Vertices

2. Edges:

3. Faces:

在这三种基础的polygon components之上还有2中附加的component:

5. Face-Vertices

6. UVs

 

每一个polygon mesh的vertices存储在一个数组中,数组的每一项为一个三维的浮点数指针,每一项对应一个vertexId,这个vertexId基于数组的index,edges和faces的索引都是基于这一个数组的索引。

技术分享

边索引:polygon mesh的边存储在边数组中,每一条边由2个顶点组成,所以边数组的每一项为一个指向边结构的指针。边结构第一项的integer指向start vertex在顶点数组中的vertexId,第二项指向end vertex在顶点数组的顶点数组中的vertexId:

技术分享

面数组:

polygonal mesh的面也全部被存储在一个数组中,每一个面被描述为一个整数序列,每一个整数代表一个edge的ID,所以它是基于边表上的。

第一个序列代表一个面的包围边,接下来的子序列代表了面当中所有的holes。

internal flags 标志了每个序列的起止。

(1)face array:

技术分享

(2)face index array(face offset array):

技术分享

 

face-vertices:

相邻的面共享一些顶点,通常你需要对应于某一个面的顶点,从而与同样的处于另一个面的同一个顶点进行区分,这就是face-vertices。

face-vertices是conceptual components,用来定义polygonal的特性(feature),例如color per vertex和UVs。face-vertices由face array和face index array来表示,每一个face-vertices由一个faceid和一个vertexid共同构成

可以有faceid在face array中找到edges,然后每个edgeid的start vertex就是由verticesid来对应的。

例子:

技术分享

因而face array可以变为:

技术分享

 

UVs:

UVs依赖于face-vertices的概念,UVs对应于2D的平面用来将texture映射到polygon surface上,The structure that holds UVs in Maya consists of two arrays:

  • A UV index array that uses the exact same indices of the face array (visualized as a face vertex array).
  • A UV array that holds a list of UV points indexed by UVIds.

The first array associates each face vertex with a given UVId or none at all if the face that the face-vertex belongs to is not mapped. Each UVId then corresponds to an index in the UV list that holds the 2D point (U and V float values) where the UV is situated on the UV space.:

技术分享

 

 

The Polygonal shape node:

用来表示一个mesh,对应maya中的一个DG,The polygonal shape node holds four fundamental attributes: an inMesh, an outMesh, a cachedInMesh, and pnts (tweaks), as shown in the following illustration.

技术分享

 

十五、polygon API

原文:http://www.cnblogs.com/bubbler/p/5186437.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!