1 -- Created on: 2009-12-10
2 -- Created by: Paul SUPRYATKIN
3 -- Copyright (c) 2009-2014 OPEN CASCADE SAS
5 -- This file is part of Open CASCADE Technology software library.
7 -- This library is free software; you can redistribute it and / or modify it
8 -- under the terms of the GNU Lesser General Public version 2.1 as published
9 -- by the Free Software Foundation, with special exception defined in the file
10 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 -- distribution for complete text of the license and disclaimer of any warranty.
13 -- Alternatively, this file may be used under the terms of Open CASCADE
14 -- commercial license or contractual agreement.
16 class Triangulation from AIS inherits InteractiveObject from AIS
19 ---Purpose: Interactive object that draws data from Poly_Triangulation, optionally with colors associated
20 -- with each triangulation vertex. For maximum efficiency colors are represented as 32-bit integers
21 -- instead of classic Quantity_Color values.
22 -- Interactive selection of triangles and vertices is not yet implemented.
26 Triangulation from Poly,
27 HArray1OfInteger from TColStd,
28 Presentation from Prs3d,
29 PresentationManager3d from PrsMgr,
30 Selection from SelectMgr
34 Create(aTriangulation : Triangulation from Poly)
35 returns Triangulation from AIS;
36 ---Purpose: Constructs the Triangulation display object
38 -- -- Methods from PresentableObject
41 aPresentationManager : PresentationManager3d from PrsMgr;
42 aPresentation : mutable Presentation from Prs3d;
43 aMode : Integer from Standard = 0)
46 -- Methods from SelectableObject
48 ComputeSelection(me : mutable;
49 aSelection : mutable Selection from SelectMgr;
50 aMode : Integer from Standard)
52 --- Empty implementation, does nothing
54 SetColors(me : mutable;
55 aColor : HArray1OfInteger from TColStd);
58 -- Set the color for each node.
59 -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red
60 -- Order of color components is essential for further usage by OpenGL
65 -- Get the color for each node.
66 -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red
68 returns HArray1OfInteger from TColStd;
71 SetTriangulation( me : mutable;
72 aTriangulation : Triangulation from Poly);
76 GetTriangulation( me )
77 returns Triangulation from Poly;
79 ---Purpose: Returns Poly_Triangulation .
81 AttenuateColor( me : mutable;
82 aColor : Integer from Standard;
83 aComponent : Real from Standard )
84 returns Integer from Standard
87 ---Purpose: Attenuates 32-bit color by a given attenuation factor (0...1):
88 -- aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red
89 -- All color components are multiplied by aComponent, the result is then packed again as 32-bit integer.
90 -- Color attenuation is applied to the vertex colors in order to have correct visual result
91 -- after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and flat.
96 myTriangulation : Triangulation from Poly;
97 myColor : HArray1OfInteger from TColStd;
98 myFlagColor : Integer from Standard;
99 myNbNodes : Integer from Standard;
100 myNbTriangles : Integer from Standard;