renderParams.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 
9 
10 #ifndef PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_H
11 #define PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_H
12 
13 #include "pxr/pxr.h"
14 #include "pxr/usdImaging/usdImagingGL/api.h"
15 
16 #include "pxr/usd/usd/timeCode.h"
17 
18 #include "pxr/base/gf/bbox3d.h"
19 #include "pxr/base/gf/vec2i.h"
20 #include "pxr/base/gf/vec4d.h"
21 #include "pxr/base/gf/vec4f.h"
22 #include "pxr/base/tf/token.h"
23 
24 PXR_NAMESPACE_OPEN_SCOPE
25 
26 enum class UsdImagingGLDrawMode
27 {
28  DRAW_POINTS,
29  DRAW_WIREFRAME,
30  DRAW_WIREFRAME_ON_SURFACE,
31  DRAW_SHADED_FLAT,
32  DRAW_SHADED_SMOOTH,
33  DRAW_GEOM_ONLY,
34  DRAW_GEOM_FLAT,
35  DRAW_GEOM_SMOOTH
36 };
37 
38 // Note: some assumptions are made about the order of these enums, so please
39 // be careful when updating them.
40 enum class UsdImagingGLCullStyle
41 {
42  CULL_STYLE_NO_OPINION,
43  CULL_STYLE_NOTHING,
44  CULL_STYLE_BACK,
45  CULL_STYLE_FRONT,
46  CULL_STYLE_BACK_UNLESS_DOUBLE_SIDED,
47 
48  CULL_STYLE_COUNT
49 };
50 
51 
57 {
58 public:
59 
60  using ClipPlanesVector = std::vector<GfVec4d>;
61  using BBoxVector = std::vector<GfBBox3d>;
62 
63  UsdTimeCode frame;
64  float complexity;
65  UsdImagingGLDrawMode drawMode;
66  bool showGuides;
67  bool showProxy;
68  bool showRender;
69  bool forceRefresh;
70  bool flipFrontFacing;
71  UsdImagingGLCullStyle cullStyle;
72  bool enableLighting;
73  bool enableSampleAlphaToCoverage;
74  bool applyRenderState;
75  bool gammaCorrectColors;
76  bool highlight;
77  GfVec4f overrideColor;
78  GfVec4f wireframeColor;
79  float alphaThreshold; // threshold < 0 implies automatic
80  ClipPlanesVector clipPlanes;
81  bool enableSceneMaterials;
82  bool enableSceneLights;
83  // Respect USD's model:drawMode attribute...
84  bool enableUsdDrawModes;
85  GfVec4f clearColor;
86  TfToken colorCorrectionMode;
87  // Optional OCIO color setings, only valid when colorCorrectionMode==HdxColorCorrectionTokens->openColorIO
88  int lut3dSizeOCIO;
89  TfToken ocioDisplay;
90  TfToken ocioView;
91  TfToken ocioColorSpace;
92  TfToken ocioLook;
93  // BBox settings
94  BBoxVector bboxes;
95  GfVec4f bboxLineColor;
96  float bboxLineDashSize;
97 
98  inline UsdImagingGLRenderParams();
99 
100  inline bool operator==(const UsdImagingGLRenderParams &other) const;
101 
102  inline bool operator!=(const UsdImagingGLRenderParams &other) const {
103  return !(*this == other);
104  }
105 };
106 
107 
108 UsdImagingGLRenderParams::UsdImagingGLRenderParams() :
109  frame(UsdTimeCode::EarliestTime()),
110  complexity(1.0),
111  drawMode(UsdImagingGLDrawMode::DRAW_SHADED_SMOOTH),
112  showGuides(false),
113  showProxy(true),
114  showRender(false),
115  forceRefresh(false),
116  flipFrontFacing(false),
117  cullStyle(UsdImagingGLCullStyle::CULL_STYLE_NOTHING),
118  enableLighting(true),
119  enableSampleAlphaToCoverage(false),
120  applyRenderState(true),
121  gammaCorrectColors(true),
122  highlight(false),
123  overrideColor(.0f, .0f, .0f, .0f),
124  wireframeColor(.0f, .0f, .0f, .0f),
125  alphaThreshold(-1),
126  clipPlanes(),
127  enableSceneMaterials(true),
128  enableSceneLights(true),
129  enableUsdDrawModes(true),
130  clearColor(0,0,0,1),
131  lut3dSizeOCIO(65),
132  bboxLineColor(1),
133  bboxLineDashSize(3)
134 {
135 }
136 
137 bool
138 UsdImagingGLRenderParams::operator==(const UsdImagingGLRenderParams &other)
139  const
140 {
141  return frame == other.frame
142  && complexity == other.complexity
143  && drawMode == other.drawMode
144  && showGuides == other.showGuides
145  && showProxy == other.showProxy
146  && showRender == other.showRender
147  && forceRefresh == other.forceRefresh
148  && flipFrontFacing == other.flipFrontFacing
149  && cullStyle == other.cullStyle
150  && enableLighting == other.enableLighting
151  && enableSampleAlphaToCoverage == other.enableSampleAlphaToCoverage
152  && applyRenderState == other.applyRenderState
153  && gammaCorrectColors == other.gammaCorrectColors
154  && highlight == other.highlight
155  && overrideColor == other.overrideColor
156  && wireframeColor == other.wireframeColor
157  && alphaThreshold == other.alphaThreshold
158  && clipPlanes == other.clipPlanes
159  && enableSceneMaterials == other.enableSceneMaterials
160  && enableSceneLights == other.enableSceneLights
161  && enableUsdDrawModes == other.enableUsdDrawModes
162  && clearColor == other.clearColor
163  && colorCorrectionMode == other.colorCorrectionMode
164  && ocioDisplay == other.ocioDisplay
165  && ocioView == other.ocioView
166  && ocioColorSpace == other.ocioColorSpace
167  && ocioLook == other.ocioLook
168  && lut3dSizeOCIO == other.lut3dSizeOCIO
169  && bboxes == other.bboxes
170  && bboxLineColor == other.bboxLineColor
171  && bboxLineDashSize == other.bboxLineDashSize;
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:80
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:73
Basic type for a vector of 4 float components.
Definition: vec4f.h:47
Used as an arguments class for various methods in UsdImagingGLEngine.
Definition: renderParams.h:56
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...