CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
TrVisRenderMode.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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 {
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 // Wireframe 2d or 3d mode
72 bool is_wf() const
74 // HiddenLine mode
75 bool is_hl() const
77 // Shaded (any) modes
78 bool is_sa() const
80 // Shaded without edges modes
81 bool is_sh() const
83 // ShadedWithWireframe modes
84 bool is_sw() const
86 // FlatShaded mode
87 bool is_fs() const
89 // GouraudShaded mode
90 bool is_gs() const
92 // FlatShadedWithWireframe mode
93 bool is_fw() const
95 // GouraudShadedWithWireframe mode
96 bool is_gw() const
98 // RenderMode from flags
100 {
103 else if (m_bFlags[kLighting])
104 {
107 else
109 }
110 else
112 }
113 // Flags from render mode
115 {
116 switch (rm)
117 {
120 break;
123 break;
126 break;
129 break;
132 break;
135 break;
138 break;
139 default: break;
140 }
141 }
142 // Calibrate settings
143 void calibrate() { make_fs(make_rm()); }
144};
145
146#include "TD_PackPop.h"
147
148#endif // ODTRVISRENDERMODE
unsigned int OdUInt32
RenderMode
Definition: Gs.h:148
@ kFlatShadedWithWireframe
Definition: Gs.h:155
@ kHiddenLine
Definition: Gs.h:152
@ kGouraudShadedWithWireframe
Definition: Gs.h:156
@ kWireframe
Definition: Gs.h:151
@ kFlatShaded
Definition: Gs.h:153
@ k2DOptimized
Definition: Gs.h:150
@ kGouraudShaded
Definition: Gs.h:154
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
bool is_wf() const