0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / AIS / AIS_Triangulation.hxx
CommitLineData
42cf5bc1 1// Created on: 2009-12-10
2// Created by: Paul SUPRYATKIN
3// Copyright (c) 2009-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License 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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _AIS_Triangulation_HeaderFile
17#define _AIS_Triangulation_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_Type.hxx>
21
22#include <TColStd_HArray1OfInteger.hxx>
23#include <Standard_Integer.hxx>
24#include <AIS_InteractiveObject.hxx>
25#include <PrsMgr_PresentationManager3d.hxx>
26#include <SelectMgr_Selection.hxx>
27#include <Standard_Real.hxx>
28class Poly_Triangulation;
29class Prs3d_Presentation;
30
31
32class AIS_Triangulation;
33DEFINE_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject)
34
35//! Interactive object that draws data from Poly_Triangulation, optionally with colors associated
36//! with each triangulation vertex. For maximum efficiency colors are represented as 32-bit integers
37//! instead of classic Quantity_Color values.
38//! Interactive selection of triangles and vertices is not yet implemented.
39class AIS_Triangulation : public AIS_InteractiveObject
40{
41
42public:
43
44
45 //! Constructs the Triangulation display object
46 Standard_EXPORT AIS_Triangulation(const Handle(Poly_Triangulation)& aTriangulation);
47
48
49 //! Set the color for each node.
50 //! Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red
51 //! Order of color components is essential for further usage by OpenGL
52 Standard_EXPORT void SetColors (const Handle(TColStd_HArray1OfInteger)& aColor);
53
54
55 //! Get the color for each node.
56 //! Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red
57 Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetColors() const;
58
59 Standard_EXPORT void SetTriangulation (const Handle(Poly_Triangulation)& aTriangulation);
60
61 //! Returns Poly_Triangulation .
62 Standard_EXPORT Handle(Poly_Triangulation) GetTriangulation() const;
63
64
65
66
67 DEFINE_STANDARD_RTTI(AIS_Triangulation,AIS_InteractiveObject)
68
69protected:
70
71
72
73
74private:
75
76
77 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
78
79 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
80
81 //! Attenuates 32-bit color by a given attenuation factor (0...1):
82 //! aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red
83 //! All color components are multiplied by aComponent, the result is then packed again as 32-bit integer.
84 //! Color attenuation is applied to the vertex colors in order to have correct visual result
85 //! after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and flat.
86 Standard_EXPORT Standard_Integer AttenuateColor (const Standard_Integer aColor, const Standard_Real aComponent);
87
88 Handle(Poly_Triangulation) myTriangulation;
89 Handle(TColStd_HArray1OfInteger) myColor;
90 Standard_Integer myFlagColor;
91 Standard_Integer myNbNodes;
92 Standard_Integer myNbTriangles;
93
94
95};
96
97
98
99
100
101
102
103#endif // _AIS_Triangulation_HeaderFile