0024530: TKMesh - remove unused package IntPoly
[occt.git] / src / Graphic3d / Graphic3d_AspectFillArea3d.cxx
CommitLineData
b311480e 1// Created by: NW,JPB,CAL
2// Copyright (c) 1991-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
81bba717 16//-Design Declaration of variables specific to the context
17// of tracing of facets 3D
7fd59977 18
81bba717 19//-Warning Ccontext of tracing of facets 3d inherits the context
20// defined by :
21// - the style of the interior of the facet
22// - the style of the facet border
23// - the color
24// Additionally, it has more than one definition of material
25// for internal and external faces.
7fd59977 26
7fd59977 27// for the class
28#include <Graphic3d_AspectFillArea3d.ixx>
29
7fd59977 30#include <Aspect_PolygonOffsetMode.hxx>
7fd59977 31#include <Standard_Boolean.hxx>
32
7fd59977 33Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d ():
de75ed09 34DistinguishModeActive (Standard_False), EdgeModeActive (Standard_False), BackFaceRemovalActive (Standard_False), MyTextureMapState(Standard_False), MyFrontMaterial (), MyBackMaterial ()
35{
7fd59977 36 // By default, aspect do not change current polygon offset parameters
60761105 37 MyPolygonOffsetMode = Aspect_POM_Fill;
7fd59977 38 MyPolygonOffsetFactor = 1.;
39 MyPolygonOffsetUnits = 0.;
7fd59977 40}
41
81bba717 42// (InteriorStyle, InteriorColor, EdgeColor, EdgeLineType, EdgeLineWidth)
43// because AspectFillArea3d inherits AspectFillArea and it is necessary to call
44// initialisation of AspectFillArea with InteriorStyle, InteriorColor,
45// EdgeColor, EdgeLineType and EdgeLineWidth.
7fd59977 46
47Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d (const Aspect_InteriorStyle InteriorStyle, const Quantity_Color& InteriorColor, const Quantity_Color& EdgeColor, const Aspect_TypeOfLine EdgeLineType, const Standard_Real EdgeLineWidth, const Graphic3d_MaterialAspect& FrontMaterial, const Graphic3d_MaterialAspect& BackMaterial):
48Aspect_AspectFillArea (InteriorStyle, InteriorColor, EdgeColor, EdgeLineType, EdgeLineWidth), DistinguishModeActive (Standard_False), EdgeModeActive (Standard_False), BackFaceRemovalActive (Standard_False), MyTextureMap(), MyTextureMapState(Standard_False), MyFrontMaterial (FrontMaterial), MyBackMaterial (BackMaterial) {
7fd59977 49 // By default, aspect do not change current polygon offset parameters
60761105 50 MyPolygonOffsetMode = Aspect_POM_Fill;
7fd59977 51 MyPolygonOffsetFactor = 1.;
52 MyPolygonOffsetUnits = 0.;
7fd59977 53}
54
55void Graphic3d_AspectFillArea3d::SetBackMaterial (const Graphic3d_MaterialAspect& AMaterial) {
56
57 MyBackMaterial = AMaterial;
58
59}
60
61void Graphic3d_AspectFillArea3d::SetFrontMaterial (const Graphic3d_MaterialAspect& AMaterial) {
62
63 MyFrontMaterial = AMaterial;
64
65}
66
67Graphic3d_MaterialAspect Graphic3d_AspectFillArea3d::BackMaterial () const {
68
69 return (MyBackMaterial);
70
71}
72
73Graphic3d_MaterialAspect Graphic3d_AspectFillArea3d::FrontMaterial () const {
74
75 return (MyFrontMaterial);
76
77}
78
79void Graphic3d_AspectFillArea3d::AllowBackFace () {
80
81 BackFaceRemovalActive = Standard_False;
82
83}
84
85void Graphic3d_AspectFillArea3d::SuppressBackFace () {
86
87 BackFaceRemovalActive = Standard_True;
88
89}
90
91Standard_Boolean Graphic3d_AspectFillArea3d::BackFace () const {
92
93 return (BackFaceRemovalActive);
94
95}
96
97void Graphic3d_AspectFillArea3d::SetDistinguishOn () {
98
99 DistinguishModeActive = Standard_True;
100
101}
102
103void Graphic3d_AspectFillArea3d::SetDistinguishOff () {
104
105 DistinguishModeActive = Standard_False;
106
107}
108
109Standard_Boolean Graphic3d_AspectFillArea3d::Distinguish () const {
110
111 return (DistinguishModeActive);
112
113}
114
115void Graphic3d_AspectFillArea3d::SetEdgeOn () {
116
117 EdgeModeActive = Standard_True;
118
119}
120
121void Graphic3d_AspectFillArea3d::SetEdgeOff () {
122
123 EdgeModeActive = Standard_False;
124
125}
126
127
128void Graphic3d_AspectFillArea3d::SetTextureMap(const Handle(Graphic3d_TextureMap)& ATexture)
129{
130 MyTextureMap = ATexture;
131}
132
133
134void Graphic3d_AspectFillArea3d::SetTextureMapOn()
135{
136 MyTextureMapState = Standard_True;
137}
138
139
140void Graphic3d_AspectFillArea3d::SetTextureMapOff()
141{
142 MyTextureMapState = Standard_False;
143}
144
145
146Standard_Boolean Graphic3d_AspectFillArea3d::Edge () const {
147
148 return (EdgeModeActive);
149
150}
151
152
153Handle(Graphic3d_TextureMap) Graphic3d_AspectFillArea3d::TextureMap() const
154{
155 return MyTextureMap;
156}
157
158
159Standard_Boolean Graphic3d_AspectFillArea3d::TextureMapState() const
160{
161 return MyTextureMapState;
162}
163
60be1f9b 164void Graphic3d_AspectFillArea3d::SetPolygonOffsets(const Standard_Integer aMode,
165 const Standard_ShortReal aFactor,
166 const Standard_ShortReal aUnits) {
7fd59977 167 MyPolygonOffsetMode = ( aMode & Aspect_POM_Mask );
168 MyPolygonOffsetFactor = aFactor;
169 MyPolygonOffsetUnits = aUnits;
170}
171
60be1f9b 172void Graphic3d_AspectFillArea3d::PolygonOffsets(Standard_Integer& aMode,
173 Standard_ShortReal& aFactor,
174 Standard_ShortReal& aUnits) const {
7fd59977 175 aMode = MyPolygonOffsetMode;
176 aFactor = MyPolygonOffsetFactor;
177 aUnits = MyPolygonOffsetUnits;
178}
30f0ad28 179
180void Graphic3d_AspectFillArea3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
181{
182 MyShaderProgram = theProgram;
183}
184
185const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectFillArea3d::ShaderProgram() const
186{
187 return MyShaderProgram;
188}