7fd59977 |
1 | -- File : AIS_Triangulation.cdl |
2 | -- Created : 10 December 2009 |
3 | -- Author : Paul SUPRYATKIN |
4 | ---Copyright: Open CASCADE 2009 |
5 | |
6 | class Triangulation from AIS inherits InteractiveObject from AIS |
7 | |
8 | |
9 | ---Purpose: Interactive object that draws data from Poly_Triangulation, optionally with colors associated |
10 | -- with each triangulation vertex. For maximum efficiency colors are represented as 32-bit integers |
11 | -- instead of classic Quantity_Color values. |
12 | -- Interactive selection of triangles and vertices is not yet implemented. |
13 | |
14 | |
15 | uses |
16 | Triangulation from Poly, |
17 | HArray1OfInteger from TColStd, |
18 | Presentation from Prs3d, |
19 | PresentationManager3d from PrsMgr, |
20 | Selection from SelectMgr |
21 | |
22 | is |
23 | |
24 | Create(aTriangulation : Triangulation from Poly) |
25 | returns Triangulation from AIS; |
26 | ---Purpose: Constructs the Triangulation display object |
27 | |
28 | -- -- Methods from PresentableObject |
29 | |
30 | Compute(me : mutable; |
31 | aPresentationManager : PresentationManager3d from PrsMgr; |
32 | aPresentation : mutable Presentation from Prs3d; |
33 | aMode : Integer from Standard = 0) |
34 | is redefined private; |
35 | |
36 | -- Methods from SelectableObject |
37 | |
38 | ComputeSelection(me : mutable; |
39 | aSelection : mutable Selection from SelectMgr; |
40 | aMode : Integer from Standard) |
41 | is redefined private; |
42 | --- Empty implementation, does nothing |
43 | |
44 | SetColors(me : mutable; |
45 | aColor : HArray1OfInteger from TColStd); |
46 | ---Level: Public |
47 | ---Purpose: |
48 | -- Set the color for each node. |
49 | -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red |
50 | -- Order of color components is essential for further usage by OpenGL |
51 | |
52 | GetColors(me) |
53 | ---Level: Public |
54 | ---Purpose: |
55 | -- Get the color for each node. |
56 | -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red |
57 | |
58 | returns HArray1OfInteger from TColStd; |
59 | |
60 | |
61 | SetTriangulation( me : mutable; |
62 | aTriangulation : Triangulation from Poly); |
63 | ---Level: Public |
64 | |
65 | |
66 | GetTriangulation( me ) |
67 | returns Triangulation from Poly; |
68 | ---Level: Public |
69 | ---Purpose: Returns Poly_Triangulation . |
70 | |
71 | AttenuateColor( me : mutable; |
72 | aColor : Integer from Standard; |
73 | aComponent : Real from Standard ) |
74 | returns Integer from Standard |
75 | is private; |
76 | ---Level: Private |
77 | ---Purpose: Attenuates 32-bit color by a given attenuation factor (0...1): |
78 | -- aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red |
79 | -- All color components are multiplied by aComponent, the result is then packed again as 32-bit integer. |
80 | -- Color attenuation is applied to the vertex colors in order to have correct visual result |
81 | -- after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and flat. |
82 | |
83 | |
84 | fields |
85 | |
86 | myTriangulation : Triangulation from Poly; |
87 | myColor : HArray1OfInteger from TColStd; |
88 | myFlagColor : Integer from Standard; |
89 | myNbNodes : Integer from Standard; |
90 | myNbTriangles : Integer from Standard; |
91 | |
92 | end Triangulation; |