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/bbox3d.h"
36 #include "pxr/base/gf/vec2i.h"
37 #include "pxr/base/gf/vec4d.h"
38 #include "pxr/base/gf/vec4f.h"
39 #include "pxr/base/tf/token.h"
40 
41 PXR_NAMESPACE_OPEN_SCOPE
42 
43 enum class UsdImagingGLDrawMode
44 {
45  DRAW_POINTS,
46  DRAW_WIREFRAME,
47  DRAW_WIREFRAME_ON_SURFACE,
48  DRAW_SHADED_FLAT,
49  DRAW_SHADED_SMOOTH,
50  DRAW_GEOM_ONLY,
51  DRAW_GEOM_FLAT,
52  DRAW_GEOM_SMOOTH
53 };
54 
55 // Note: some assumptions are made about the order of these enums, so please
56 // be careful when updating them.
57 enum class UsdImagingGLCullStyle
58 {
59  CULL_STYLE_NO_OPINION,
60  CULL_STYLE_NOTHING,
61  CULL_STYLE_BACK,
62  CULL_STYLE_FRONT,
63  CULL_STYLE_BACK_UNLESS_DOUBLE_SIDED,
64 
65  CULL_STYLE_COUNT
66 };
67 
68 
74 {
75 public:
76 
77  using ClipPlanesVector = std::vector<GfVec4d>;
78  using BBoxVector = std::vector<GfBBox3d>;
79 
80  UsdTimeCode frame;
81  float complexity;
82  UsdImagingGLDrawMode drawMode;
83  bool showGuides;
84  bool showProxy;
85  bool showRender;
86  bool forceRefresh;
87  bool flipFrontFacing;
88  UsdImagingGLCullStyle cullStyle;
89  bool enableIdRender;
90  bool enableLighting;
91  bool enableSampleAlphaToCoverage;
92  bool applyRenderState;
93  bool gammaCorrectColors;
94  bool highlight;
95  GfVec4f overrideColor;
96  GfVec4f wireframeColor;
97  float alphaThreshold; // threshold < 0 implies automatic
98  ClipPlanesVector clipPlanes;
99  bool enableSceneMaterials;
100  bool enableSceneLights;
101  // Respect USD's model:drawMode attribute...
102  bool enableUsdDrawModes;
103  GfVec4f clearColor;
104  TfToken colorCorrectionMode;
105  // Optional OCIO color setings, only valid when colorCorrectionMode==HdxColorCorrectionTokens->openColorIO
106  int lut3dSizeOCIO;
107  TfToken ocioDisplay;
108  TfToken ocioView;
109  TfToken ocioColorSpace;
110  TfToken ocioLook;
111  // BBox settings
112  BBoxVector bboxes;
113  GfVec4f bboxLineColor;
114  float bboxLineDashSize;
115 
116  inline UsdImagingGLRenderParams();
117 
118  inline bool operator==(const UsdImagingGLRenderParams &other) const;
119 
120  inline bool operator!=(const UsdImagingGLRenderParams &other) const {
121  return !(*this == other);
122  }
123 };
124 
125 
126 UsdImagingGLRenderParams::UsdImagingGLRenderParams() :
127  frame(UsdTimeCode::EarliestTime()),
128  complexity(1.0),
129  drawMode(UsdImagingGLDrawMode::DRAW_SHADED_SMOOTH),
130  showGuides(false),
131  showProxy(true),
132  showRender(false),
133  forceRefresh(false),
134  flipFrontFacing(false),
135  cullStyle(UsdImagingGLCullStyle::CULL_STYLE_NOTHING),
136  enableIdRender(false),
137  enableLighting(true),
138  enableSampleAlphaToCoverage(false),
139  applyRenderState(true),
140  gammaCorrectColors(true),
141  highlight(false),
142  overrideColor(.0f, .0f, .0f, .0f),
143  wireframeColor(.0f, .0f, .0f, .0f),
144  alphaThreshold(-1),
145  clipPlanes(),
146  enableSceneMaterials(true),
147  enableSceneLights(true),
148  enableUsdDrawModes(true),
149  clearColor(0,0,0,1),
150  lut3dSizeOCIO(65),
151  bboxLineColor(1),
152  bboxLineDashSize(3)
153 {
154 }
155 
156 bool
157 UsdImagingGLRenderParams::operator==(const UsdImagingGLRenderParams &other)
158  const
159 {
160  return frame == other.frame
161  && complexity == other.complexity
162  && drawMode == other.drawMode
163  && showGuides == other.showGuides
164  && showProxy == other.showProxy
165  && showRender == other.showRender
166  && forceRefresh == other.forceRefresh
167  && flipFrontFacing == other.flipFrontFacing
168  && cullStyle == other.cullStyle
169  && enableIdRender == other.enableIdRender
170  && enableLighting == other.enableLighting
171  && enableSampleAlphaToCoverage == other.enableSampleAlphaToCoverage
172  && applyRenderState == other.applyRenderState
173  && gammaCorrectColors == other.gammaCorrectColors
174  && highlight == other.highlight
175  && overrideColor == other.overrideColor
176  && wireframeColor == other.wireframeColor
177  && alphaThreshold == other.alphaThreshold
178  && clipPlanes == other.clipPlanes
179  && enableSceneMaterials == other.enableSceneMaterials
180  && enableSceneLights == other.enableSceneLights
181  && enableUsdDrawModes == other.enableUsdDrawModes
182  && clearColor == other.clearColor
183  && colorCorrectionMode == other.colorCorrectionMode
184  && ocioDisplay == other.ocioDisplay
185  && ocioView == other.ocioView
186  && ocioColorSpace == other.ocioColorSpace
187  && ocioLook == other.ocioLook
188  && lut3dSizeOCIO == other.lut3dSizeOCIO
189  && bboxes == other.bboxes
190  && bboxLineColor == other.bboxLineColor
191  && bboxLineDashSize == other.bboxLineDashSize;
192 }
193 
194 PXR_NAMESPACE_CLOSE_SCOPE
195 
196 #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:84
Basic type for a vector of 4 float components.
Definition: vec4f.h:62
Used as an arguments class for various methods in UsdImagingGLEngine.
Definition: renderParams.h:73
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...