CFx SDK Documentation  2022 SP0
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
#define ODCOLORREF
Definition: OdPlatform.h:883
#define ODRGBA(r, g, b, a)
Definition: OdPlatform.h:885
unsigned int OdUInt32
unsigned short OdUInt16
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:497
#define GETBIT(flags, bit)
Definition: OdaDefs.h:498
const OdTrVisId kTrVisNegativeId
Definition: TrVisDefs.h:110
OdGePoint2d m_min
Definition: GsDefs.h:288
OdGePoint2d m_max
Definition: GsDefs.h:289
OdTrVisViewParamsDef m_viewParams
bool isPSModelViewport() const
void resetViewportFlags(OdUInt16 vptFlags=0)
ODCOLORREF m_faceFillColor
OdFloatArray m_borderPoints
bool isPSOverallViewport() const
OdFloatArray m_nrcPoints
ODCOLORREF m_fadingConfig
bool isPSHelperViewport() const
ODCOLORREF m_lineStyleConfig
OdUInt8Array m_lineweightsEnum
OdGsDCRectDouble m_screenRect
OdTrVisProgramId m_rmShader
OdTrVisRenderMode m_renderMode
OdTrVisViewportId m_overallViewportId
void applyChanges(const OdTrVisViewportDef &applyFrom, OdUInt32 nChanges)
void setPSOverallViewport(bool bSet)
void setPSHelperViewport(bool bSet)
void setPSModelViewport(bool bSet)
static void viewportDefApplyChanges(OdTrVisViewportDef &applyTo, const OdTrVisViewportDef &applyFrom, OdUInt32 nChanges)
OdTrVisVisualStyleId m_visualStyle