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"
46PXR_NAMESPACE_OPEN_SCOPE
49using HdRenderPassStateSharedPtr = std::shared_ptr<class HdRenderPassState>;
50using HdResourceRegistrySharedPtr = std::shared_ptr<class HdResourceRegistry>;
73 virtual void Prepare(HdResourceRegistrySharedPtr
const &resourceRegistry);
79 using ClipPlanesVector = std::vector<GfVec4d>;
94 const std::pair<bool, CameraUtilConformWindowPolicy> &
95 overrideWindowPolicy);
117 const std::pair<bool, CameraUtilConformWindowPolicy> &
118 overrideWindowPolicy);
139 const std::pair<bool, CameraUtilConformWindowPolicy> &
146 CameraUtilConformWindowPolicy
186 const GfVec4f& GetOverrideColor()
const {
return _overrideColor; }
192 const GfVec4f& GetWireframeColor()
const {
return _wireframeColor; }
195 void SetMaskColor(
GfVec4f const &color);
196 const GfVec4f& GetMaskColor()
const {
return _maskColor; }
199 void SetIndicatorColor(
GfVec4f const &color);
200 const GfVec4f& GetIndicatorColor()
const {
return _indicatorColor; }
206 const GfVec4f& GetPointColor()
const {
return _pointColor; }
211 float GetPointSize()
const {
return _pointSize; }
216 float GetPointSelectedSize()
const {
return _pointSelectedSize; }
221 bool GetLightingEnabled()
const {
return _lightingEnabled; }
224 void SetClippingEnabled(
bool enabled);
225 bool GetClippingEnabled()
const {
return _clippingEnabled; }
235 HdRenderPassAovBindingVector
const& GetAovBindings()
const;
241 HdRenderPassAovBindingVector
const& GetAovInputBindings()
const;
248 bool GetUseAovMultiSample()
const;
251 void SetCullStyle(HdCullStyle cullStyle);
253 HdCullStyle GetCullStyle()
const {
return _cullStyle; }
256 void SetAlphaThreshold(
float alphaThreshold);
257 float GetAlphaThreshold()
const {
return _alphaThreshold; }
260 void SetTessLevel(
float level);
261 float GetTessLevel()
const {
return _tessLevel; }
264 void SetDrawingRange(
GfVec2f const &drawRange);
265 GfVec2f GetDrawingRange()
const {
return _drawRange; }
267 GfVec2f GetDrawingRangeNDC()
const;
270 void SetDepthBiasUseDefault(
bool useDefault);
271 bool GetDepthBiasUseDefault()
const {
return _depthBiasUseDefault; }
274 void SetDepthBiasEnabled(
bool enabled);
275 bool GetDepthBiasEnabled()
const {
return _depthBiasEnabled; }
278 void SetDepthBias(
float constantFactor,
float slopeFactor);
281 void SetDepthFunc(HdCompareFunction depthFunc);
282 HdCompareFunction GetDepthFunc()
const {
return _depthFunc; }
285 void SetEnableDepthMask(
bool state);
287 bool GetEnableDepthMask()
const;
290 void SetEnableDepthTest(
bool enabled);
292 bool GetEnableDepthTest()
const;
295 void SetEnableDepthClamp(
bool enabled);
297 bool GetEnableDepthClamp()
const;
300 void SetDepthRange(
GfVec2f const &depthRange);
302 const GfVec2f& GetDepthRange()
const;
305 void SetStencil(HdCompareFunction func,
int ref,
int mask,
306 HdStencilOp fail, HdStencilOp zfail, HdStencilOp zpass);
307 HdCompareFunction GetStencilFunc()
const {
return _stencilFunc; }
308 int GetStencilRef()
const {
return _stencilRef; }
309 int GetStencilMask()
const {
return _stencilMask; }
310 HdStencilOp GetStencilFailOp()
const {
return _stencilFailOp; }
311 HdStencilOp GetStencilDepthFailOp()
const {
return _stencilZFailOp; }
312 HdStencilOp GetStencilDepthPassOp()
const {
return _stencilZPassOp; }
314 void SetStencilEnabled(
bool enabled);
316 bool GetStencilEnabled()
const;
319 void SetLineWidth(
float width);
320 float GetLineWidth()
const {
return _lineWidth; }
323 void SetBlend(HdBlendOp colorOp,
324 HdBlendFactor colorSrcFactor,
325 HdBlendFactor colorDstFactor,
327 HdBlendFactor alphaSrcFactor,
328 HdBlendFactor alphaDstFactor);
329 HdBlendOp GetBlendColorOp() {
return _blendColorOp; }
330 HdBlendFactor GetBlendColorSrcFactor() {
return _blendColorSrcFactor; }
331 HdBlendFactor GetBlendColorDstFactor() {
return _blendColorDstFactor; }
332 HdBlendOp GetBlendAlphaOp() {
return _blendAlphaOp; }
333 HdBlendFactor GetBlendAlphaSrcFactor() {
return _blendAlphaSrcFactor; }
334 HdBlendFactor GetBlendAlphaDstFactor() {
return _blendAlphaDstFactor; }
336 void SetBlendConstantColor(
GfVec4f const & color);
337 const GfVec4f& GetBlendConstantColor()
const {
return _blendConstantColor; }
339 void SetBlendEnabled(
bool enabled);
342 void SetAlphaToCoverageEnabled(
bool enabled);
343 bool GetAlphaToCoverageEnabled()
const {
return _alphaToCoverageEnabled; }
346 void SetColorMaskUseDefault(
bool useDefault);
347 bool GetColorMaskUseDefault()
const {
return _colorMaskUseDefault;}
350 void SetConservativeRasterizationEnabled(
bool enabled);
351 bool GetConservativeRasterizationEnabled()
const {
352 return _conservativeRasterizationEnabled;
356 void SetVolumeRenderingConstants(
float stepSize,
float stepSizeLighting);
365 void SetColorMasks(std::vector<ColorMask>
const& masks);
366 std::vector<ColorMask>
const& GetColorMasks()
const {
return _colorMasks; }
369 void SetMultiSampleEnabled(
bool enabled);
370 bool GetMultiSampleEnabled()
const {
return _multiSampleEnabled; }
379 std::pair<bool, CameraUtilConformWindowPolicy> _overrideWindowPolicy;
388 bool _lightingEnabled;
389 bool _clippingEnabled;
393 float _pointSelectedSize;
398 float _alphaThreshold;
402 bool _depthBiasUseDefault;
403 bool _depthBiasEnabled;
404 float _depthBiasConstantFactor;
405 float _depthBiasSlopeFactor;
406 HdCompareFunction _depthFunc;
407 bool _depthMaskEnabled;
408 bool _depthTestEnabled;
409 bool _depthClampEnabled;
412 HdCullStyle _cullStyle;
415 HdCompareFunction _stencilFunc;
418 HdStencilOp _stencilFailOp;
419 HdStencilOp _stencilZFailOp;
420 HdStencilOp _stencilZPassOp;
421 bool _stencilEnabled;
427 HdBlendOp _blendColorOp;
428 HdBlendFactor _blendColorSrcFactor;
429 HdBlendFactor _blendColorDstFactor;
430 HdBlendOp _blendAlphaOp;
431 HdBlendFactor _blendAlphaSrcFactor;
432 HdBlendFactor _blendAlphaDstFactor;
437 bool _alphaToCoverageEnabled;
439 bool _colorMaskUseDefault;
440 std::vector<ColorMask> _colorMasks;
442 HdRenderPassAovBindingVector _aovBindings;
443 HdRenderPassAovBindingVector _aovInputBindings;
444 bool _useMultiSampleAov;
446 bool _conservativeRasterizationEnabled;
449 float _stepSizeLighting;
451 bool _multiSampleEnabled;
454PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
Basic type for a vector of 2 float components.
Basic type for a vector of 4 double components.
Basic type for a vector of 4 float components.
Hydra schema for a camera that pulls the params (see above) during Sync.
A set of rendering parameters used among render passes.
HD_API GfMatrix4d GetImageToWorldMatrix() const
Compute a transform from window relative coordinates (x,y,z,1) to homogeneous world coordinates (x,...
GfVec4f const & GetViewport() const
Only use when clients did not specify a camera framing.
HD_API CameraUtilConformWindowPolicy GetWindowPolicy() const
The resolved window policy to conform the camera frustum.
virtual HD_API ClipPlanesVector const & GetClipPlanes() const
Returns HdCamera's clip planes.
HD_API void SetFraming(const CameraUtilFraming &framing)
Sets the framing to show the camera.
HD_API void SetAovInputBindings(HdRenderPassAovBindingVector const &aovBindings)
Set the AOVs that this renderpass needs to read from.
virtual HD_API void Prepare(HdResourceRegistrySharedPtr const &resourceRegistry)
Schedule to update renderPassState parameters.
HD_API void SetAovBindings(HdRenderPassAovBindingVector const &aovBindings)
Set the attachments for this renderpass to render into.
HD_API void SetCamera(const HdCamera *camera)
Sets the camera.
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 SetOverrideColor(GfVec4f const &color)
Set an override color for rendering where the R, G and B components are the color and the alpha compo...
HdCamera const * GetCamera() const
Get camera.
HD_API void SetPointSize(float size)
Set the point size for unselected points.
HD_API void SetViewport(const GfVec4d &viewport)
Sets the viewport to show the camera.
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...
HD_API void SetCameraAndFraming(const HdCamera *camera, const CameraUtilFraming &framing, const std::pair< bool, CameraUtilConformWindowPolicy > &overrideWindowPolicy)
HD_API void SetPointSelectedSize(float size)
Set the point size for selected points.
virtual HD_API GfMatrix4d GetProjectionMatrix() const
Compute projection matrix using physical attributes of an HdCamera.
HD_API void SetLightingEnabled(bool enabled)
XXX: Hacky way of disabling lighting.
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 SetUseAovMultiSample(bool state)
Returns true if the render pass wants to render into the multi-sample aovs.
HD_API void SetOverrideWindowPolicy(const std::pair< bool, CameraUtilConformWindowPolicy > &overrideWindowPolicy)
Sets whether to override the window policy used to conform the camera if its aspect ratio is not matc...
const CameraUtilFraming & GetFraming() const
Get framing information determining how the filmback plane maps to pixels.
HD_API void SetCameraAndViewport(const HdCamera *camera, const GfVec4d &viewport)
virtual HD_API GfMatrix4d GetWorldToViewMatrix() const
Camera getter API.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...