1 -- File : AIS_Triangulation.cdl
2 -- Created : 10 December 2009
3 -- Author : Paul SUPRYATKIN
4 ---Copyright: Open CASCADE 2009
6 class Triangulation from AIS inherits InteractiveObject from AIS
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.
16 Triangulation from Poly,
17 HArray1OfInteger from TColStd,
18 Presentation from Prs3d,
19 PresentationManager3d from PrsMgr,
20 Selection from SelectMgr
24 Create(aTriangulation : Triangulation from Poly)
25 returns Triangulation from AIS;
26 ---Purpose: Constructs the Triangulation display object
28 -- -- Methods from PresentableObject
31 aPresentationManager : PresentationManager3d from PrsMgr;
32 aPresentation : mutable Presentation from Prs3d;
33 aMode : Integer from Standard = 0)
36 -- Methods from SelectableObject
38 ComputeSelection(me : mutable;
39 aSelection : mutable Selection from SelectMgr;
40 aMode : Integer from Standard)
42 --- Empty implementation, does nothing
44 SetColors(me : mutable;
45 aColor : HArray1OfInteger from TColStd);
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
55 -- Get the color for each node.
56 -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red
58 returns HArray1OfInteger from TColStd;
61 SetTriangulation( me : mutable;
62 aTriangulation : Triangulation from Poly);
66 GetTriangulation( me )
67 returns Triangulation from Poly;
69 ---Purpose: Returns Poly_Triangulation .
71 AttenuateColor( me : mutable;
72 aColor : Integer from Standard;
73 aComponent : Real from Standard )
74 returns Integer from Standard
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.
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;