CFx SDK Documentation  2020SP3
TrVisViewportDef.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 // GLES2 device viewport definition
24 
25 #ifndef ODTRVISVIEWPORTDEF
26 #define ODTRVISVIEWPORTDEF
27 
28 #include "TD_PackPush.h"
29 
30 #include "Ge/GeMatrix3d.h"
31 #include "IntArray.h"
32 #include "Ge/GePoint2dArray.h"
33 #include "UInt8Array.h"
34 
35 #include "TrVisRenderMode.h"
36 #include "TrVisOverlayDef.h"
37 
42 {
43  // Flags
45  {
46  kPSOverallViewport = (1 << 0), // Overall PaperSpace viewport
47  kPSModelViewport = (1 << 1), // ModelSpace viewport in PaperSpace
48  kPSHelperViewport = (1 << 2) // Helper PaperSpace viewport
49  };
50 
51  // applyChanges parts
53  {
54  // Viewport visibility flag
56  // Transform matrices, camera positioning
58  // Persistent viewport parameters, flags and etc.
60  // Contextual viewport parameters (lineweight style, fading, etc.)
62  // Viewport rectangle in screen coordinates
63  kViewportModRect = (1 << 4),
64  // Viewport Nrc clipping boundary in screen coordinates
65  kViewportModNrcClip = (1 << 5),
66  // Array of lineweights
68  // Base shader program
69  kViewportModShader = (1 << 7),
70  // Viewport border in screen coordinates
71  kViewportModBorder = (1 << 8),
72 
75  };
76 
77  // Mark viewport as visible (kViewportModVisibility)
78  bool m_bVisible;
79  // Orientation
81  // Persistent viewport parameters (kViewportModPersistent)
84  // Contextual viewport parameters (kViewportModContextual)
87  // Viewport positioning (rect clip), as 0-1 range (kViewportModRect)
89  // Viewport clip region (as triangle strips) (kViewportModNrcClip)
92  // Lineweights (kViewportModLineweights)
95  // Render mode (kViewportModShader)
100  // Viewport border (kViewportModBorder)
101  bool m_bBorder;
106 
107  // Reset viewport flags
108  void resetViewportFlags(OdUInt16 vptFlags = 0) { m_vptFlags = vptFlags; }
109 
110  // PSOverallViewport flag
113 
114  // PSModelViewport flag
117 
118  // PSHelperViewport flag
121 
122  // Setup default values
123  void setDefault()
124  {
125  m_bVisible = false;
127  m_vptFlags = 0;
129  m_lineStyleConfig = ODRGBA(1, 2, 2, 1);
130  m_fadingConfig = ODRGBA(0, 0, 0, 0);
131  m_screenRect.m_min = OdGePoint2d(0.0, 1.0);
132  m_screenRect.m_max = OdGePoint2d(1.0, 0.0);
133  m_lineweightsCoef = 1.0;
136  m_renderMode .reset();
137  m_faceFillColor = 0;
138  m_bBorder = false;
139  m_borderColor = 0;
140  m_borderWeight = 1;
141  }
142 
143  // Apply partial changes in OdTrVisViewportDef
144  static void viewportDefApplyChanges(OdTrVisViewportDef &applyTo, const OdTrVisViewportDef &applyFrom, OdUInt32 nChanges);
145  void applyChanges(const OdTrVisViewportDef &applyFrom, OdUInt32 nChanges)
146  {
147  viewportDefApplyChanges(*this, applyFrom, nChanges);
148  }
149 };
150 
151 inline
153 {
155  {
156  applyTo.m_bVisible = applyFrom.m_bVisible;
157  }
159  {
160  applyTo.m_viewParams = applyFrom.m_viewParams;
161  }
163  {
164  applyTo.m_vptFlags = applyFrom.m_vptFlags;
165  applyTo.m_overallViewportId = applyFrom.m_overallViewportId;
166  }
168  {
169  applyTo.m_lineStyleConfig = applyFrom.m_lineStyleConfig;
170  applyTo.m_fadingConfig = applyFrom.m_fadingConfig;
171  }
173  {
174  applyTo.m_screenRect = applyFrom.m_screenRect;
175  }
177  {
178  applyTo.m_nrcCounts = applyFrom.m_nrcCounts;
179  applyTo.m_nrcPoints = applyFrom.m_nrcPoints;
180  }
182  {
183  applyTo.m_lineweightsEnum = applyFrom.m_lineweightsEnum;
184  applyTo.m_lineweightsCoef = applyFrom.m_lineweightsCoef;
185  }
187  {
188  applyTo.m_rmShader = applyFrom.m_rmShader;
189  applyTo.m_visualStyle = applyFrom.m_visualStyle;
190  applyTo.m_renderMode = applyFrom.m_renderMode;
191  applyTo.m_faceFillColor = applyFrom.m_faceFillColor;
192  }
194  {
195  applyTo.m_bBorder = applyFrom.m_bBorder;
196  applyTo.m_borderColor = applyFrom.m_borderColor;
197  applyTo.m_borderWeight = applyFrom.m_borderWeight;
198  applyTo.m_borderCounts = applyFrom.m_borderCounts;
199  applyTo.m_borderPoints = applyFrom.m_borderPoints;
200  }
201 }
202 
203 #include "TD_PackPop.h"
204 
205 #endif // ODTRVISVIEWPORTDEF
GETBIT
#define GETBIT(flags, bit)
Definition: OdaDefs.h:498
kTrVisNegativeId
const OdTrVisId kTrVisNegativeId
Definition: TrVisDefs.h:110
OdTrVisRenderMode
Definition: TrVisRenderMode.h:36
TrVisRenderMode.h
OdTrVisViewportDef::viewportDefApplyChanges
static void viewportDefApplyChanges(OdTrVisViewportDef &applyTo, const OdTrVisViewportDef &applyFrom, OdUInt32 nChanges)
Definition: TrVisViewportDef.h:152
OdGsDCRectDouble
Definition: GsDefs.h:242
OdTrVisViewportDef::KindOfModification
KindOfModification
Definition: TrVisViewportDef.h:53
OdTrVisViewportDef::kViewportModRect
@ kViewportModRect
Definition: TrVisViewportDef.h:63
OdTrVisViewportDef::m_lineStyleConfig
ODCOLORREF m_lineStyleConfig
Definition: TrVisViewportDef.h:85
OdTrVisViewportDef::isPSModelViewport
bool isPSModelViewport() const
Definition: TrVisViewportDef.h:115
OdTrVisViewportDef
Definition: TrVisViewportDef.h:42
OdTrVisViewportDef::setPSOverallViewport
void setPSOverallViewport(bool bSet)
Definition: TrVisViewportDef.h:112
SETBIT
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:497
OdTrVisViewportDef::m_rmShader
OdTrVisProgramId m_rmShader
Definition: TrVisViewportDef.h:96
OdTrVisRenderMode::reset
void reset()
Definition: TrVisRenderMode.h:53
OdTrVisViewportDef::kViewportModVisibility
@ kViewportModVisibility
Definition: TrVisViewportDef.h:55
OdArray< int, OdMemoryAllocator< int > >
TD_PackPop.h
OdTrVisViewportDef::kViewportModLineweights
@ kViewportModLineweights
Definition: TrVisViewportDef.h:67
IntArray.h
OdTrVisViewportDef::m_lineweightsCoef
double m_lineweightsCoef
Definition: TrVisViewportDef.h:94
OdGsDCRectDouble::m_min
OdGePoint2d m_min
Definition: GsDefs.h:288
OdTrVisViewportDef::m_renderMode
OdTrVisRenderMode m_renderMode
Definition: TrVisViewportDef.h:98
OdTrVisViewportDef::kViewportModContextual
@ kViewportModContextual
Definition: TrVisViewportDef.h:61
OdTrVisViewportDef::m_vptFlags
OdUInt16 m_vptFlags
Definition: TrVisViewportDef.h:82
OdUInt16
unsigned short OdUInt16
Definition: OdPlatformSettings.h:760
OdTrVisViewParamsDef::setDefault
void setDefault()
Definition: TrVisOverlayDef.h:133
OdTrVisViewportDef::setPSHelperViewport
void setPSHelperViewport(bool bSet)
Definition: TrVisViewportDef.h:120
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdTrVisViewportDef::m_faceFillColor
ODCOLORREF m_faceFillColor
Definition: TrVisViewportDef.h:99
OdTrVisViewportDef::ViewportDefFlags
ViewportDefFlags
Definition: TrVisViewportDef.h:45
OdTrVisViewportDef::applyChanges
void applyChanges(const OdTrVisViewportDef &applyFrom, OdUInt32 nChanges)
Definition: TrVisViewportDef.h:145
OdTrVisViewportDef::kPSOverallViewport
@ kPSOverallViewport
Definition: TrVisViewportDef.h:46
OdTrVisViewportDef::kViewportModBorder
@ kViewportModBorder
Definition: TrVisViewportDef.h:71
TrVisOverlayDef.h
OdTrVisViewportDef::m_nrcCounts
OdIntArray m_nrcCounts
Definition: TrVisViewportDef.h:90
OdTrVisViewportDef::kViewportModNrcClip
@ kViewportModNrcClip
Definition: TrVisViewportDef.h:65
OdTrVisViewportDef::m_viewParams
OdTrVisViewParamsDef m_viewParams
Definition: TrVisViewportDef.h:80
OdTrVisViewportDef::m_borderCounts
OdIntArray m_borderCounts
Definition: TrVisViewportDef.h:104
OdTrVisViewportDef::kViewportModShader
@ kViewportModShader
Definition: TrVisViewportDef.h:69
OdTrVisViewportDef::m_fadingConfig
ODCOLORREF m_fadingConfig
Definition: TrVisViewportDef.h:86
OdGsDCRectDouble::m_max
OdGePoint2d m_max
Definition: GsDefs.h:289
OdTrVisViewportDef::m_borderWeight
int m_borderWeight
Definition: TrVisViewportDef.h:103
TD_PackPush.h
OdTrVisViewportDef::m_borderColor
ODCOLORREF m_borderColor
Definition: TrVisViewportDef.h:102
GePoint2dArray.h
OdTrVisViewportDef::m_lineweightsEnum
OdUInt8Array m_lineweightsEnum
Definition: TrVisViewportDef.h:93
OdTrVisViewportDef::m_visualStyle
OdTrVisVisualStyleId m_visualStyle
Definition: TrVisViewportDef.h:97
OdTrVisViewportDef::m_screenRect
OdGsDCRectDouble m_screenRect
Definition: TrVisViewportDef.h:88
OdTrVisViewportDef::setPSModelViewport
void setPSModelViewport(bool bSet)
Definition: TrVisViewportDef.h:116
OdTrVisViewportDef::kPSModelViewport
@ kPSModelViewport
Definition: TrVisViewportDef.h:47
UInt8Array.h
OdTrVisViewportDef::kViewportModAll
@ kViewportModAll
Definition: TrVisViewportDef.h:73
OdTrVisViewParamsDef
Definition: TrVisOverlayDef.h:112
OdTrVisViewportDef::m_bVisible
bool m_bVisible
Definition: TrVisViewportDef.h:78
OdTrVisViewportDef::m_overallViewportId
OdTrVisViewportId m_overallViewportId
Definition: TrVisViewportDef.h:83
ODRGBA
#define ODRGBA(r, g, b, a)
Definition: OdPlatform.h:885
OdTrVisViewportDef::isPSOverallViewport
bool isPSOverallViewport() const
Definition: TrVisViewportDef.h:111
ODCOLORREF
#define ODCOLORREF
Definition: OdPlatform.h:883
OdTrVisViewportDef::kViewportModOrientation
@ kViewportModOrientation
Definition: TrVisViewportDef.h:57
OdTrVisViewportDef::kPSHelperViewport
@ kPSHelperViewport
Definition: TrVisViewportDef.h:48
GeMatrix3d.h
OdTrVisViewportDef::m_bBorder
bool m_bBorder
Definition: TrVisViewportDef.h:101
OdTrVisViewportDef::isPSHelperViewport
bool isPSHelperViewport() const
Definition: TrVisViewportDef.h:119
OdTrVisViewportDef::m_nrcPoints
OdFloatArray m_nrcPoints
Definition: TrVisViewportDef.h:91
OdTrVisViewportDef::m_borderPoints
OdFloatArray m_borderPoints
Definition: TrVisViewportDef.h:105
OdTrVisViewportDef::resetViewportFlags
void resetViewportFlags(OdUInt16 vptFlags=0)
Definition: TrVisViewportDef.h:108
OdTrVisViewportDef::kViewportModPersistent
@ kViewportModPersistent
Definition: TrVisViewportDef.h:59
OdTrVisViewportDef::setDefault
void setDefault()
Definition: TrVisViewportDef.h:123
OdUInt64
Definition: Int64.h:137
OdGePoint2d
Definition: GePoint2d.h:60