Loading...
Searching...
No Matches
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
24PXR_NAMESPACE_OPEN_SCOPE
25
26enum 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.
40enum 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{
58public:
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 enableIdRender;
73 bool enableLighting;
74 bool enableSampleAlphaToCoverage;
75 bool applyRenderState;
76 bool gammaCorrectColors;
77 bool highlight;
78 GfVec4f overrideColor;
79 GfVec4f wireframeColor;
80 float alphaThreshold; // threshold < 0 implies automatic
81 ClipPlanesVector clipPlanes;
82 bool enableSceneMaterials;
83 bool enableSceneLights;
84 // Respect USD's model:drawMode attribute...
85 bool enableUsdDrawModes;
86 GfVec4f clearColor;
87 TfToken colorCorrectionMode;
88 // Optional OCIO color setings, only valid when colorCorrectionMode==HdxColorCorrectionTokens->openColorIO
89 int lut3dSizeOCIO;
90 TfToken ocioDisplay;
91 TfToken ocioView;
92 TfToken ocioColorSpace;
93 TfToken ocioLook;
94 // BBox settings
95 BBoxVector bboxes;
96 GfVec4f bboxLineColor;
97 float bboxLineDashSize;
98
100
101 inline bool operator==(const UsdImagingGLRenderParams &other) const;
102
103 inline bool operator!=(const UsdImagingGLRenderParams &other) const {
104 return !(*this == other);
105 }
106};
107
108
109UsdImagingGLRenderParams::UsdImagingGLRenderParams() :
110 frame(UsdTimeCode::EarliestTime()),
111 complexity(1.0),
112 drawMode(UsdImagingGLDrawMode::DRAW_SHADED_SMOOTH),
113 showGuides(false),
114 showProxy(true),
115 showRender(false),
116 forceRefresh(false),
117 flipFrontFacing(false),
118 cullStyle(UsdImagingGLCullStyle::CULL_STYLE_NOTHING),
119 enableIdRender(false),
120 enableLighting(true),
121 enableSampleAlphaToCoverage(false),
122 applyRenderState(true),
123 gammaCorrectColors(true),
124 highlight(false),
125 overrideColor(.0f, .0f, .0f, .0f),
126 wireframeColor(.0f, .0f, .0f, .0f),
127 alphaThreshold(-1),
128 clipPlanes(),
129 enableSceneMaterials(true),
130 enableSceneLights(true),
131 enableUsdDrawModes(true),
132 clearColor(0,0,0,1),
133 lut3dSizeOCIO(65),
134 bboxLineColor(1),
135 bboxLineDashSize(3)
136{
137}
138
139bool
140UsdImagingGLRenderParams::operator==(const UsdImagingGLRenderParams &other)
141 const
142{
143 return frame == other.frame
144 && complexity == other.complexity
145 && drawMode == other.drawMode
146 && showGuides == other.showGuides
147 && showProxy == other.showProxy
148 && showRender == other.showRender
149 && forceRefresh == other.forceRefresh
150 && flipFrontFacing == other.flipFrontFacing
151 && cullStyle == other.cullStyle
152 && enableIdRender == other.enableIdRender
153 && enableLighting == other.enableLighting
154 && enableSampleAlphaToCoverage == other.enableSampleAlphaToCoverage
155 && applyRenderState == other.applyRenderState
156 && gammaCorrectColors == other.gammaCorrectColors
157 && highlight == other.highlight
158 && overrideColor == other.overrideColor
159 && wireframeColor == other.wireframeColor
160 && alphaThreshold == other.alphaThreshold
161 && clipPlanes == other.clipPlanes
162 && enableSceneMaterials == other.enableSceneMaterials
163 && enableSceneLights == other.enableSceneLights
164 && enableUsdDrawModes == other.enableUsdDrawModes
165 && clearColor == other.clearColor
166 && colorCorrectionMode == other.colorCorrectionMode
167 && ocioDisplay == other.ocioDisplay
168 && ocioView == other.ocioView
169 && ocioColorSpace == other.ocioColorSpace
170 && ocioLook == other.ocioLook
171 && lut3dSizeOCIO == other.lut3dSizeOCIO
172 && bboxes == other.bboxes
173 && bboxLineColor == other.bboxLineColor
174 && bboxLineDashSize == other.bboxLineDashSize;
175}
176
177PXR_NAMESPACE_CLOSE_SCOPE
178
179#endif // PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_H
Basic type for a vector of 4 float components.
Definition: vec4f.h:46
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Used as an arguments class for various methods in UsdImagingGLEngine.
Definition: renderParams.h:57
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:67
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...