CFx SDK Documentation  2023 SP0
TrVisRenderMode.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 render mode definition
24 
25 #ifndef ODTRVISRENDERMODE
26 #define ODTRVISRENDERMODE
27 
28 #include "TD_PackPush.h"
29 
30 #include "TrVisDefs.h"
31 
36 {
37  protected:
38  enum Flags
39  {
45  kNumFlags
46  };
47  protected:
49  public:
50  // Constructors, setters/getters
52  { reset(); }
53  void reset() { for (long i = 0; i < kNumFlags; i++) m_bFlags[i] = false; } /* reset to 2d mode by default */
54  bool depthBufferEnabled() const { return m_bFlags[kDepthBuffer]; } void setDepthBufferEnabled(bool bSet) { m_bFlags[kDepthBuffer] = bSet; }
55  bool stencilBufferEnabled() const { return m_bFlags[kStencilBuffer]; } void setStencilBufferEnabled(bool bSet) { m_bFlags[kStencilBuffer] = bSet; }
56  bool polygonOffsetEnabled() const { return m_bFlags[kPolygonOffset]; } void setPolygonOffsetEnabled(bool bSet) { m_bFlags[kPolygonOffset] = bSet; }
57  bool lightingEnabled() const { return m_bFlags[kLighting]; } void setLightingEnabled(bool bSet) { m_bFlags[kLighting] = bSet; }
58  bool faceNormalsEnabled() const { return m_bFlags[kFaceNormals]; } void setFaceNormalsEnabled(bool bSet) { m_bFlags[kFaceNormals] = bSet; }
59  // Serialization
60  OdUInt32 serializeOut() const { OdUInt32 nRez = 0; for (long i = 0; i < kNumFlags; i++) { if (m_bFlags[i]) nRez |= 1 << i; } return nRez; }
61  void serializeIn(OdUInt32 nFlags) { for (long i = 0; i < kNumFlags; i++) { m_bFlags[i] = (nFlags | (1 << i)) != 0; } }
62  // Control version
63  const long controlVersion() const { return kNumFlags; }
64  // Gs Render Mode compatibility
65  // 2dOptimized mode
66  bool is_2d() const
68  // Wireframe mode
69  bool is_3d() const
71  // HiddenLine mode
72  bool is_hl() const
74  // Shaded (any) modes
75  bool is_sa() const
77  // Shaded without edges modes
78  bool is_sh() const
80  // ShadedWithWireframe modes
81  bool is_sw() const
83  // FlatShaded mode
84  bool is_fs() const
86  // GouraudShaded mode
87  bool is_gs() const
89  // FlatShadedWithWireframe mode
90  bool is_fw() const
92  // GouraudShadedWithWireframe mode
93  bool is_gw() const
95  // RenderMode from flags
97  {
100  else if (m_bFlags[kLighting])
101  {
104  else
106  }
107  else
108  return OdGsView::kWireframe;
109  }
110  // Flags from render mode
112  {
113  switch (rm)
114  {
117  break;
120  break;
123  break;
126  break;
129  break;
132  break;
135  break;
136  default: break;
137  }
138  }
139  // Calibrate settings
140  void calibrate() { make_fs(make_rm()); }
141 };
142 
143 #include "TD_PackPop.h"
144 
145 #endif // ODTRVISRENDERMODE
unsigned int OdUInt32
RenderMode
Definition: Gs.h:138
@ kFlatShadedWithWireframe
Definition: Gs.h:145
@ kHiddenLine
Definition: Gs.h:142
@ kGouraudShadedWithWireframe
Definition: Gs.h:146
@ kWireframe
Definition: Gs.h:141
@ kFlatShaded
Definition: Gs.h:143
@ k2DOptimized
Definition: Gs.h:140
@ kGouraudShaded
Definition: Gs.h:144
void setFaceNormalsEnabled(bool bSet)
OdGsView::RenderMode make_rm() const
bool is_gs() const
bool depthBufferEnabled() const
bool is_sa() const
bool lightingEnabled() const
bool is_3d() const
void setStencilBufferEnabled(bool bSet)
OdUInt32 serializeOut() const
void make_fs(OdGsView::RenderMode rm)
bool is_hl() const
bool is_gw() const
const long controlVersion() const
bool is_fs() const
void serializeIn(OdUInt32 nFlags)
bool is_fw() const
bool faceNormalsEnabled() const
bool polygonOffsetEnabled() const
bool is_2d() const
void setLightingEnabled(bool bSet)
void setDepthBufferEnabled(bool bSet)
bool stencilBufferEnabled() const
bool m_bFlags[kNumFlags]
void setPolygonOffsetEnabled(bool bSet)
bool is_sh() const
bool is_sw() const