CFx SDK Documentation  2020SP3
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
OdTrVisRenderMode
Definition: TrVisRenderMode.h:36
OdGsView::RenderMode
RenderMode
Definition: Gs.h:138
OdTrVisRenderMode::make_rm
OdGsView::RenderMode make_rm() const
Definition: TrVisRenderMode.h:96
OdTrVisRenderMode::controlVersion
const long controlVersion() const
Definition: TrVisRenderMode.h:63
OdTrVisRenderMode::kDepthBuffer
@ kDepthBuffer
Definition: TrVisRenderMode.h:40
OdTrVisRenderMode::serializeOut
OdUInt32 serializeOut() const
Definition: TrVisRenderMode.h:60
OdTrVisRenderMode::kLighting
@ kLighting
Definition: TrVisRenderMode.h:43
OdTrVisRenderMode::calibrate
void calibrate()
Definition: TrVisRenderMode.h:140
OdTrVisRenderMode::setPolygonOffsetEnabled
void setPolygonOffsetEnabled(bool bSet)
Definition: TrVisRenderMode.h:56
OdTrVisRenderMode::reset
void reset()
Definition: TrVisRenderMode.h:53
OdTrVisRenderMode::is_gw
bool is_gw() const
Definition: TrVisRenderMode.h:93
TD_PackPop.h
OdTrVisRenderMode::setDepthBufferEnabled
void setDepthBufferEnabled(bool bSet)
Definition: TrVisRenderMode.h:54
OdTrVisRenderMode::polygonOffsetEnabled
bool polygonOffsetEnabled() const
Definition: TrVisRenderMode.h:56
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdTrVisRenderMode::OdTrVisRenderMode
OdTrVisRenderMode()
Definition: TrVisRenderMode.h:51
OdTrVisRenderMode::kNumFlags
@ kNumFlags
Definition: TrVisRenderMode.h:45
OdTrVisRenderMode::is_sa
bool is_sa() const
Definition: TrVisRenderMode.h:75
OdTrVisRenderMode::is_fw
bool is_fw() const
Definition: TrVisRenderMode.h:90
OdTrVisRenderMode::Flags
Flags
Definition: TrVisRenderMode.h:39
OdTrVisRenderMode::is_sw
bool is_sw() const
Definition: TrVisRenderMode.h:81
OdTrVisRenderMode::is_3d
bool is_3d() const
Definition: TrVisRenderMode.h:69
TrVisDefs.h
OdTrVisRenderMode::lightingEnabled
bool lightingEnabled() const
Definition: TrVisRenderMode.h:57
TD_PackPush.h
OdTrVisRenderMode::kPolygonOffset
@ kPolygonOffset
Definition: TrVisRenderMode.h:42
OdGsView::kFlatShadedWithWireframe
@ kFlatShadedWithWireframe
Definition: Gs.h:145
OdGsView::k2DOptimized
@ k2DOptimized
Definition: Gs.h:140
OdTrVisRenderMode::serializeIn
void serializeIn(OdUInt32 nFlags)
Definition: TrVisRenderMode.h:61
OdTrVisRenderMode::is_gs
bool is_gs() const
Definition: TrVisRenderMode.h:87
OdGsView::kGouraudShaded
@ kGouraudShaded
Definition: Gs.h:144
OdTrVisRenderMode::setStencilBufferEnabled
void setStencilBufferEnabled(bool bSet)
Definition: TrVisRenderMode.h:55
OdTrVisRenderMode::faceNormalsEnabled
bool faceNormalsEnabled() const
Definition: TrVisRenderMode.h:58
OdTrVisRenderMode::make_fs
void make_fs(OdGsView::RenderMode rm)
Definition: TrVisRenderMode.h:111
OdGsView::kGouraudShadedWithWireframe
@ kGouraudShadedWithWireframe
Definition: Gs.h:146
OdTrVisRenderMode::is_2d
bool is_2d() const
Definition: TrVisRenderMode.h:66
OdTrVisRenderMode::setLightingEnabled
void setLightingEnabled(bool bSet)
Definition: TrVisRenderMode.h:57
OdGsView::kFlatShaded
@ kFlatShaded
Definition: Gs.h:143
OdTrVisRenderMode::stencilBufferEnabled
bool stencilBufferEnabled() const
Definition: TrVisRenderMode.h:55
OdTrVisRenderMode::is_sh
bool is_sh() const
Definition: TrVisRenderMode.h:78
OdTrVisRenderMode::kStencilBuffer
@ kStencilBuffer
Definition: TrVisRenderMode.h:41
OdTrVisRenderMode::is_hl
bool is_hl() const
Definition: TrVisRenderMode.h:72
OdTrVisRenderMode::kFaceNormals
@ kFaceNormals
Definition: TrVisRenderMode.h:44
OdGsView::kWireframe
@ kWireframe
Definition: Gs.h:141
OdTrVisRenderMode::setFaceNormalsEnabled
void setFaceNormalsEnabled(bool bSet)
Definition: TrVisRenderMode.h:58
OdGsView::kHiddenLine
@ kHiddenLine
Definition: Gs.h:142
OdTrVisRenderMode::m_bFlags
bool m_bFlags[kNumFlags]
Definition: TrVisRenderMode.h:48
OdTrVisRenderMode::depthBufferEnabled
bool depthBufferEnabled() const
Definition: TrVisRenderMode.h:54
OdTrVisRenderMode::is_fs
bool is_fs() const
Definition: TrVisRenderMode.h:84