1 -- Created on: 2009-12-10
2 -- Created by: Paul SUPRYATKIN
3 -- Copyright (c) 2009-2012 OPEN CASCADE SAS
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.
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.
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.
21 class Triangulation from AIS inherits InteractiveObject from AIS
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.
31 Triangulation from Poly,
32 HArray1OfInteger from TColStd,
33 Presentation from Prs3d,
34 PresentationManager3d from PrsMgr,
35 Selection from SelectMgr
39 Create(aTriangulation : Triangulation from Poly)
40 returns Triangulation from AIS;
41 ---Purpose: Constructs the Triangulation display object
43 -- -- Methods from PresentableObject
46 aPresentationManager : PresentationManager3d from PrsMgr;
47 aPresentation : mutable Presentation from Prs3d;
48 aMode : Integer from Standard = 0)
51 -- Methods from SelectableObject
53 ComputeSelection(me : mutable;
54 aSelection : mutable Selection from SelectMgr;
55 aMode : Integer from Standard)
57 --- Empty implementation, does nothing
59 SetColors(me : mutable;
60 aColor : HArray1OfInteger from TColStd);
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
70 -- Get the color for each node.
71 -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red
73 returns HArray1OfInteger from TColStd;
76 SetTriangulation( me : mutable;
77 aTriangulation : Triangulation from Poly);
81 GetTriangulation( me )
82 returns Triangulation from Poly;
84 ---Purpose: Returns Poly_Triangulation .
86 AttenuateColor( me : mutable;
87 aColor : Integer from Standard;
88 aComponent : Real from Standard )
89 returns Integer from Standard
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.
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;