<!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1262759992; mso-list-type:hybrid; mso-list-template-ids:233838752 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:42.0pt; mso-level-number-position:left; margin-left:42.0pt; text-indent:-21.0pt; font-family:Wingdings;} @list l1 {mso-list-id:1565097105; mso-list-type:hybrid; mso-list-template-ids:151808690 -289405516 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l1:level1 {mso-level-number-format:alpha-lower; mso-level-text:%1、; mso-level-tab-stop:39.75pt; mso-level-number-position:left; margin-left:39.75pt; text-indent:-18.0pt;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->
OpenCascade 不仅提供了下层的几何拓朴表示及其相关算法,也提供了一个显示模块,用于方便的显示构造的几何和拓朴对象。该显示模块提供了方便的封装,允许很简单的实现一个对象的显示和选择等功能。
首先,显示模块能够调用简单的接口显示对象,对象可以有多种显示方式,例如:线框显示、着色显示、纹理显示等,每个对象也可以自定义自己的显示方式。
其次,可以通过简单的接口,实现对象的选取功能,包括:对象的自动选取、选中的高亮显示、对象的选择过滤等。并且,每个对象可以自定义多种选择模式,例如:一个拓朴实体对象,可以允许选择整个对象,也可以选择其中的一个面、一条边等。
显示模块基于 OpenGL 实现。允许设置灯光、材质、纹理等,实现一定的渲染功能。但相对真正的 render 引擎,渲染功能还是比较弱的。
总体结构, OpenCascade 的 visual.pdf 文档中给出了一副结构图。我这里按照自己的理解将其分为了四层,当然层与层之间的并不如下面分层那样明晰,主要为了理解上的方便。四层如下:
AIS 层
/ /
显示管理 选择管理
/ /
visual3d 层
|
OpenGL 层
AIS 层是最顶层,提供了丰富的接口,来方便外部实现对象的显示和选择功能。下面管理层,提供了抽象的显示和选择管理机制,具体的实现都放在 visual3d 层,以便管理和显示图形,最终数据发送到 OpenGL 层,有 OpenGL 层进行绘制。
后续依次详细说明每层的结构和实现。