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 PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_H
28 #define PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_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  bool enableSceneLights;
99  // Respect USD's model:drawMode attribute...
100  bool enableUsdDrawModes;
101  GfVec4f clearColor;
102  TfToken colorCorrectionMode;
103  int lut3dSizeOCIO;
104 
105  inline UsdImagingGLRenderParams();
106 
107  inline bool operator==(const UsdImagingGLRenderParams &other) const;
108 
109  inline bool operator!=(const UsdImagingGLRenderParams &other) const {
110  return !(*this == other);
111  }
112 };
113 
114 
115 UsdImagingGLRenderParams::UsdImagingGLRenderParams() :
116  frame(UsdTimeCode::EarliestTime()),
117  complexity(1.0),
118  drawMode(UsdImagingGLDrawMode::DRAW_SHADED_SMOOTH),
119  showGuides(false),
120  showProxy(true),
121  showRender(false),
122  forceRefresh(false),
123  flipFrontFacing(false),
124  cullStyle(UsdImagingGLCullStyle::CULL_STYLE_NOTHING),
125  enableIdRender(false),
126  enableLighting(true),
127  enableSampleAlphaToCoverage(false),
128  applyRenderState(true),
129  gammaCorrectColors(true),
130  highlight(false),
131  overrideColor(.0f, .0f, .0f, .0f),
132  wireframeColor(.0f, .0f, .0f, .0f),
133  alphaThreshold(-1),
134  clipPlanes(),
135  enableSceneMaterials(true),
136  enableSceneLights(true),
137  enableUsdDrawModes(true),
138  clearColor(0,0,0,1),
139  lut3dSizeOCIO(65)
140 {
141 }
142 
143 bool
144 UsdImagingGLRenderParams::operator==(const UsdImagingGLRenderParams &other)
145  const
146 {
147  return frame == other.frame
148  && complexity == other.complexity
149  && drawMode == other.drawMode
150  && showGuides == other.showGuides
151  && showProxy == other.showProxy
152  && showRender == other.showRender
153  && forceRefresh == other.forceRefresh
154  && flipFrontFacing == other.flipFrontFacing
155  && cullStyle == other.cullStyle
156  && enableIdRender == other.enableIdRender
157  && enableLighting == other.enableLighting
158  && enableSampleAlphaToCoverage == other.enableSampleAlphaToCoverage
159  && applyRenderState == other.applyRenderState
160  && gammaCorrectColors == other.gammaCorrectColors
161  && highlight == other.highlight
162  && overrideColor == other.overrideColor
163  && wireframeColor == other.wireframeColor
164  && alphaThreshold == other.alphaThreshold
165  && clipPlanes == other.clipPlanes
166  && enableSceneMaterials == other.enableSceneMaterials
167  && enableSceneLights == other.enableSceneLights
168  && enableUsdDrawModes == other.enableUsdDrawModes
169  && clearColor == other.clearColor
170  && colorCorrectionMode == other.colorCorrectionMode
171  && lut3dSizeOCIO == other.lut3dSizeOCIO;
172 }
173 
174 PXR_NAMESPACE_CLOSE_SCOPE
175 
176 #endif // PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
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
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...