24 #ifndef PXR_IMAGING_HD_RENDER_PASS_STATE_H
25 #define PXR_IMAGING_HD_RENDER_PASS_STATE_H
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/aov.h"
30 #include "pxr/imaging/hd/version.h"
31 #include "pxr/imaging/hd/enums.h"
33 #include "pxr/imaging/cameraUtil/framing.h"
35 #include "pxr/usd/sdf/path.h"
38 #include "pxr/base/vt/value.h"
46 PXR_NAMESPACE_OPEN_SCOPE
49 using HdRenderPassStateSharedPtr = std::shared_ptr<class HdRenderPassState>;
50 using HdResourceRegistrySharedPtr = std::shared_ptr<class HdResourceRegistry>;
66 virtual ~HdRenderPassState();
73 virtual void Prepare(HdResourceRegistrySharedPtr
const &resourceRegistry);
79 using ClipPlanesVector = std::vector<GfVec4d>;
94 const std::pair<bool, CameraUtilConformWindowPolicy> &
95 overrideWindowPolicy);
108 const std::pair<bool, CameraUtilConformWindowPolicy> &
115 CameraUtilConformWindowPolicy
158 ClipPlanesVector
const & GetClipPlanes()
const;
160 GfMatrix4d GetCullMatrix()
const {
return _cullMatrix; }
170 const GfVec4f& GetOverrideColor()
const {
return _overrideColor; }
176 const GfVec4f& GetWireframeColor()
const {
return _wireframeColor; }
179 void SetMaskColor(
GfVec4f const &color);
180 const GfVec4f& GetMaskColor()
const {
return _maskColor; }
183 void SetIndicatorColor(
GfVec4f const &color);
184 const GfVec4f& GetIndicatorColor()
const {
return _indicatorColor; }
190 const GfVec4f& GetPointColor()
const {
return _pointColor; }
195 float GetPointSize()
const {
return _pointSize; }
200 float GetPointSelectedSize()
const {
return _pointSelectedSize; }
205 bool GetLightingEnabled()
const {
return _lightingEnabled; }
208 void SetClippingEnabled(
bool enabled);
209 bool GetClippingEnabled()
const {
return _clippingEnabled; }
217 void SetAovBindings(HdRenderPassAovBindingVector
const &aovBindings);
219 HdRenderPassAovBindingVector
const& GetAovBindings()
const;
225 HdRenderPassAovBindingVector
const& GetAovInputBindings()
const;
232 bool GetUseAovMultiSample()
const;
235 void SetCullStyle(HdCullStyle cullStyle);
237 HdCullStyle GetCullStyle()
const {
return _cullStyle; }
240 void SetAlphaThreshold(
float alphaThreshold);
241 float GetAlphaThreshold()
const {
return _alphaThreshold; }
244 void SetTessLevel(
float level);
245 float GetTessLevel()
const {
return _tessLevel; }
248 void SetDrawingRange(
GfVec2f const &drawRange);
249 GfVec2f GetDrawingRange()
const {
return _drawRange; }
250 GfVec2f GetDrawingRangeNDC()
const {
251 return GfVec2f(2*_drawRange[0]/_viewport[2],
252 2*_drawRange[1]/_viewport[3]);
256 void SetDepthBiasUseDefault(
bool useDefault);
257 bool GetDepthBiasUseDefault()
const {
return _depthBiasUseDefault; }
260 void SetDepthBiasEnabled(
bool enabled);
261 bool GetDepthBiasEnabled()
const {
return _depthBiasEnabled; }
264 void SetDepthBias(
float constantFactor,
float slopeFactor);
267 void SetDepthFunc(HdCompareFunction depthFunc);
268 HdCompareFunction GetDepthFunc()
const {
return _depthFunc; }
271 void SetEnableDepthMask(
bool state);
273 bool GetEnableDepthMask();
276 void SetEnableDepthTest(
bool enabled);
278 bool GetEnableDepthTest()
const;
281 void SetStencil(HdCompareFunction func,
int ref,
int mask,
282 HdStencilOp fail, HdStencilOp zfail, HdStencilOp zpass);
283 HdCompareFunction GetStencilFunc()
const {
return _stencilFunc; }
284 int GetStencilRef()
const {
return _stencilRef; }
285 int GetStencilMask()
const {
return _stencilMask; }
286 HdStencilOp GetStencilFailOp()
const {
return _stencilFailOp; }
287 HdStencilOp GetStencilDepthFailOp()
const {
return _stencilZFailOp; }
288 HdStencilOp GetStencilDepthPassOp()
const {
return _stencilZPassOp; }
290 void SetStencilEnabled(
bool enabled);
292 bool GetStencilEnabled()
const;
295 void SetLineWidth(
float width);
296 float GetLineWidth()
const {
return _lineWidth; }
299 void SetBlend(HdBlendOp colorOp,
300 HdBlendFactor colorSrcFactor,
301 HdBlendFactor colorDstFactor,
303 HdBlendFactor alphaSrcFactor,
304 HdBlendFactor alphaDstFactor);
305 HdBlendOp GetBlendColorOp() {
return _blendColorOp; }
306 HdBlendFactor GetBlendColorSrcFactor() {
return _blendColorSrcFactor; }
307 HdBlendFactor GetBlendColorDstFactor() {
return _blendColorDstFactor; }
308 HdBlendOp GetBlendAlphaOp() {
return _blendAlphaOp; }
309 HdBlendFactor GetBlendAlphaSrcFactor() {
return _blendAlphaSrcFactor; }
310 HdBlendFactor GetBlendAlphaDstFactor() {
return _blendAlphaDstFactor; }
312 void SetBlendConstantColor(
GfVec4f const & color);
313 const GfVec4f& GetBlendConstantColor()
const {
return _blendConstantColor; }
315 void SetBlendEnabled(
bool enabled);
318 void SetAlphaToCoverageEnabled(
bool enabled);
319 bool GetAlphaToCoverageEnabled()
const {
return _alphaToCoverageEnabled; }
322 void SetColorMaskUseDefault(
bool useDefault);
323 bool GetColorMaskUseDefault()
const {
return _colorMaskUseDefault;}
332 void SetColorMasks(std::vector<ColorMask>
const& masks);
333 std::vector<ColorMask>
const& GetColorMasks()
const {
return _colorMasks; }
342 std::pair<bool, CameraUtilConformWindowPolicy> _overrideWindowPolicy;
353 ClipPlanesVector _clipPlanes;
362 bool _lightingEnabled;
363 bool _clippingEnabled;
367 float _pointSelectedSize;
372 float _alphaThreshold;
376 bool _depthBiasUseDefault;
377 bool _depthBiasEnabled;
378 float _depthBiasConstantFactor;
379 float _depthBiasSlopeFactor;
380 HdCompareFunction _depthFunc;
381 bool _depthMaskEnabled;
382 bool _depthTestEnabled;
384 HdCullStyle _cullStyle;
387 HdCompareFunction _stencilFunc;
390 HdStencilOp _stencilFailOp;
391 HdStencilOp _stencilZFailOp;
392 HdStencilOp _stencilZPassOp;
393 bool _stencilEnabled;
399 HdBlendOp _blendColorOp;
400 HdBlendFactor _blendColorSrcFactor;
401 HdBlendFactor _blendColorDstFactor;
402 HdBlendOp _blendAlphaOp;
403 HdBlendFactor _blendAlphaSrcFactor;
404 HdBlendFactor _blendAlphaDstFactor;
409 bool _alphaToCoverageEnabled;
411 bool _colorMaskUseDefault;
412 std::vector<ColorMask> _colorMasks;
414 HdRenderPassAovBindingVector _aovBindings;
415 HdRenderPassAovBindingVector _aovInputBindings;
416 bool _useMultiSampleAov;
419 PXR_NAMESPACE_CLOSE_SCOPE
421 #endif // PXR_IMAGING_HD_RENDER_PASS_STATE_H
HD_API void SetUseAovMultiSample(bool state)
Returns true if the render pass wants to render into the multi-sample aovs.
HD_API void SetOverrideColor(GfVec4f const &color)
Set an override color for rendering where the R, G and B components are the color and the alpha compo...
const std::pair< bool, CameraUtilConformWindowPolicy > & GetOverrideWindowPolicy() const
The override value for the window policy to conform the camera frustum that can be specified by the a...
HD_API void SetLightingEnabled(bool enabled)
XXX: Hacky way of disabling lighting.
HD_API void SetCameraAndFraming(HdCamera const *camera, CameraUtilFraming const &framing, const std::pair< bool, CameraUtilConformWindowPolicy > &overrideWindowPolicy)
Camera setter API.
HD_API void SetWireframeColor(GfVec4f const &color)
Set a wireframe color for rendering where the R, G and B components are the color and the alpha compo...
Hydra schema for a camera that pulls the params (see above) during Sync.
Basic type for a vector of 4 double components.
HD_API GfMatrix4d GetWorldToViewMatrix() const
Camera getter API.
A set of rendering parameters used among render passes.
HD_API void SetPointSize(float size)
Set the point size for unselected points.
HdCamera const * GetCamera() const
Get camera.
HD_API GfMatrix4d GetProjectionMatrix() const
It is expected that an HdCamera was specified that has physically based attributes.
Stores a 4x4 matrix of double elements.
HD_API void SetPointSelectedSize(float size)
Set the point size for selected points.
Basic type for a vector of 4 float components.
GfVec4f const & GetViewport() const
Only use when clients did not specify a camera framing.
HD_API void SetAovInputBindings(HdRenderPassAovBindingVector const &aovBindings)
Set the AOVs that this renderpass needs to read from.
Basic type for a vector of 2 float components.
HD_API void SetAovBindings(HdRenderPassAovBindingVector const &aovBindings)
Set the attachments for this renderpass to render into.
HD_API void SetPointColor(GfVec4f const &color)
Set a point color for rendering where the R, G and B components are the color and the alpha component...
HD_API void SetCameraAndViewport(HdCamera const *camera, GfVec4d const &viewport)
Camera setter API The view, projection and clipping plane info of the camera will be used...
const CameraUtilFraming & GetFraming() const
Get framing information determining how the filmback plane maps to pixels.
HD_API CameraUtilConformWindowPolicy GetWindowPolicy() const
The resolved window policy to conform the camera frustum.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
virtual HD_API void Prepare(HdResourceRegistrySharedPtr const &resourceRegistry)
Schedule to update renderPassState parameters.