All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderParams.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 
26 
27 #ifndef USDIMAGINGGL_RENDERPARAMS_H
28 #define USDIMAGINGGL_RENDERPARAMS_H
29 
30 #include "pxr/pxr.h"
31 #include "pxr/usdImaging/usdImagingGL/api.h"
32 
33 #include "pxr/usd/usd/timeCode.h"
34 
35 #include "pxr/base/gf/vec2i.h"
36 #include "pxr/base/gf/vec4d.h"
37 #include "pxr/base/gf/vec4f.h"
38 #include "pxr/base/tf/token.h"
39 
40 PXR_NAMESPACE_OPEN_SCOPE
41 
42 enum class UsdImagingGLDrawMode
43 {
44  DRAW_POINTS,
45  DRAW_WIREFRAME,
46  DRAW_WIREFRAME_ON_SURFACE,
47  DRAW_SHADED_FLAT,
48  DRAW_SHADED_SMOOTH,
49  DRAW_GEOM_ONLY,
50  DRAW_GEOM_FLAT,
51  DRAW_GEOM_SMOOTH
52 };
53 
54 // Note: some assumptions are made about the order of these enums, so please
55 // be careful when updating them.
56 enum class UsdImagingGLCullStyle
57 {
58  CULL_STYLE_NO_OPINION,
59  CULL_STYLE_NOTHING,
60  CULL_STYLE_BACK,
61  CULL_STYLE_FRONT,
62  CULL_STYLE_BACK_UNLESS_DOUBLE_SIDED,
63 
64  CULL_STYLE_COUNT
65 };
66 
67 
73 {
74 public:
75 
76  typedef std::vector<GfVec4d> ClipPlanesVector;
77 
78  UsdTimeCode frame;
79  float complexity;
80  UsdImagingGLDrawMode drawMode;
81  bool showGuides;
82  bool showProxy;
83  bool showRender;
84  bool forceRefresh;
85  bool flipFrontFacing;
86  UsdImagingGLCullStyle cullStyle;
87  bool enableIdRender;
88  bool enableLighting;
89  bool enableSampleAlphaToCoverage;
90  bool applyRenderState;
91  bool gammaCorrectColors;
92  bool highlight;
93  GfVec4f overrideColor;
94  GfVec4f wireframeColor;
95  float alphaThreshold; // threshold < 0 implies automatic
96  ClipPlanesVector clipPlanes;
97  bool enableSceneMaterials;
98  // Respect USD's model:drawMode attribute...
99  bool enableUsdDrawModes;
100  GfVec4f clearColor;
101  TfToken colorCorrectionMode;
102  GfVec2i renderResolution;
103 
104  inline UsdImagingGLRenderParams();
105 
106  inline bool operator==(const UsdImagingGLRenderParams &other) const;
107 
108  inline bool operator!=(const UsdImagingGLRenderParams &other) const {
109  return !(*this == other);
110  }
111 };
112 
113 
114 UsdImagingGLRenderParams::UsdImagingGLRenderParams() :
115  frame(UsdTimeCode::Default()),
116  complexity(1.0),
117  drawMode(UsdImagingGLDrawMode::DRAW_SHADED_SMOOTH),
118  showGuides(false),
119  showProxy(true),
120  showRender(false),
121  forceRefresh(false),
122  flipFrontFacing(false),
123  cullStyle(UsdImagingGLCullStyle::CULL_STYLE_NOTHING),
124  enableIdRender(false),
125  enableLighting(true),
126  enableSampleAlphaToCoverage(false),
127  applyRenderState(true),
128  gammaCorrectColors(true),
129  highlight(false),
130  overrideColor(.0f, .0f, .0f, .0f),
131  wireframeColor(.0f, .0f, .0f, .0f),
132  alphaThreshold(-1),
133  clipPlanes(),
134  enableSceneMaterials(true),
135  enableUsdDrawModes(true),
136  clearColor(0,0,0,1),
137  renderResolution(100,100)
138 {
139 }
140 
141 bool
142 UsdImagingGLRenderParams::operator==(const UsdImagingGLRenderParams &other)
143  const
144 {
145  return frame == other.frame
146  && complexity == other.complexity
147  && drawMode == other.drawMode
148  && showGuides == other.showGuides
149  && showProxy == other.showProxy
150  && showRender == other.showRender
151  && forceRefresh == other.forceRefresh
152  && flipFrontFacing == other.flipFrontFacing
153  && cullStyle == other.cullStyle
154  && enableIdRender == other.enableIdRender
155  && enableLighting == other.enableLighting
156  && enableSampleAlphaToCoverage == other.enableSampleAlphaToCoverage
157  && applyRenderState == other.applyRenderState
158  && gammaCorrectColors == other.gammaCorrectColors
159  && highlight == other.highlight
160  && overrideColor == other.overrideColor
161  && wireframeColor == other.wireframeColor
162  && alphaThreshold == other.alphaThreshold
163  && clipPlanes == other.clipPlanes
164  && enableSceneMaterials == other.enableSceneMaterials
165  && enableUsdDrawModes == other.enableUsdDrawModes
166  && clearColor == other.clearColor
167  && colorCorrectionMode == other.colorCorrectionMode
168  && renderResolution == other.renderResolution;
169 }
170 
171 PXR_NAMESPACE_CLOSE_SCOPE
172 
173 #endif // USDIMAGINGGL_RENDERPARAMS_H
Basic type for a vector of 2 int components.
Definition: vec2i.h:61
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
Basic type for a vector of 4 float components.
Definition: vec4f.h:63
Used as an arguments class for various methods in UsdImagingGLEngine.
Definition: renderParams.h:72