b311480e |
1 | -- Created on: 2009-12-10 |
2 | -- Created by: Paul SUPRYATKIN |
3 | -- Copyright (c) 2009-2012 OPEN CASCADE SAS |
4 | -- |
5 | -- The content of this file is subject to the Open CASCADE Technology Public |
6 | -- License Version 6.5 (the "License"). You may not use the content of this file |
7 | -- except in compliance with the License. Please obtain a copy of the License |
8 | -- at http://www.opencascade.org and read it completely before using this file. |
9 | -- |
10 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | -- |
13 | -- The Original Code and all software distributed under the License is |
14 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | -- Initial Developer hereby disclaims all such warranties, including without |
16 | -- limitation, any warranties of merchantability, fitness for a particular |
17 | -- purpose or non-infringement. Please see the License for the specific terms |
18 | -- and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | |
21 | class Triangulation from AIS inherits InteractiveObject from AIS |
22 | |
23 | |
24 | ---Purpose: Interactive object that draws data from Poly_Triangulation, optionally with colors associated |
25 | -- with each triangulation vertex. For maximum efficiency colors are represented as 32-bit integers |
26 | -- instead of classic Quantity_Color values. |
27 | -- Interactive selection of triangles and vertices is not yet implemented. |
28 | |
29 | |
30 | uses |
31 | Triangulation from Poly, |
32 | HArray1OfInteger from TColStd, |
33 | Presentation from Prs3d, |
34 | PresentationManager3d from PrsMgr, |
35 | Selection from SelectMgr |
36 | |
37 | is |
38 | |
39 | Create(aTriangulation : Triangulation from Poly) |
40 | returns Triangulation from AIS; |
41 | ---Purpose: Constructs the Triangulation display object |
42 | |
43 | -- -- Methods from PresentableObject |
44 | |
45 | Compute(me : mutable; |
46 | aPresentationManager : PresentationManager3d from PrsMgr; |
47 | aPresentation : mutable Presentation from Prs3d; |
48 | aMode : Integer from Standard = 0) |
49 | is redefined private; |
50 | |
51 | -- Methods from SelectableObject |
52 | |
53 | ComputeSelection(me : mutable; |
54 | aSelection : mutable Selection from SelectMgr; |
55 | aMode : Integer from Standard) |
56 | is redefined private; |
57 | --- Empty implementation, does nothing |
58 | |
59 | SetColors(me : mutable; |
60 | aColor : HArray1OfInteger from TColStd); |
61 | ---Level: Public |
62 | ---Purpose: |
63 | -- Set the color for each node. |
64 | -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red |
65 | -- Order of color components is essential for further usage by OpenGL |
66 | |
67 | GetColors(me) |
68 | ---Level: Public |
69 | ---Purpose: |
70 | -- Get the color for each node. |
71 | -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red |
72 | |
73 | returns HArray1OfInteger from TColStd; |
74 | |
75 | |
76 | SetTriangulation( me : mutable; |
77 | aTriangulation : Triangulation from Poly); |
78 | ---Level: Public |
79 | |
80 | |
81 | GetTriangulation( me ) |
82 | returns Triangulation from Poly; |
83 | ---Level: Public |
84 | ---Purpose: Returns Poly_Triangulation . |
85 | |
86 | AttenuateColor( me : mutable; |
87 | aColor : Integer from Standard; |
88 | aComponent : Real from Standard ) |
89 | returns Integer from Standard |
90 | is private; |
91 | ---Level: Private |
92 | ---Purpose: Attenuates 32-bit color by a given attenuation factor (0...1): |
93 | -- aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red |
94 | -- All color components are multiplied by aComponent, the result is then packed again as 32-bit integer. |
95 | -- Color attenuation is applied to the vertex colors in order to have correct visual result |
96 | -- after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and flat. |
97 | |
98 | |
99 | fields |
100 | |
101 | myTriangulation : Triangulation from Poly; |
102 | myColor : HArray1OfInteger from TColStd; |
103 | myFlagColor : Integer from Standard; |
104 | myNbNodes : Integer from Standard; |
105 | myNbTriangles : Integer from Standard; |
106 | |
107 | end Triangulation; |