7#ifndef PXR_IMAGING_HD_RENDER_PASS_STATE_H
8#define PXR_IMAGING_HD_RENDER_PASS_STATE_H
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/aov.h"
13#include "pxr/imaging/hd/version.h"
14#include "pxr/imaging/hd/enums.h"
16#include "pxr/imaging/cameraUtil/framing.h"
18#include "pxr/usd/sdf/path.h"
21#include "pxr/base/vt/value.h"
31PXR_NAMESPACE_OPEN_SCOPE
34using HdRenderPassStateSharedPtr = std::shared_ptr<class HdRenderPassState>;
35using HdResourceRegistrySharedPtr = std::shared_ptr<class HdResourceRegistry>;
58 virtual void Prepare(HdResourceRegistrySharedPtr
const &resourceRegistry);
64 using ClipPlanesVector = std::vector<GfVec4d>;
76 const std::optional<CameraUtilConformWindowPolicy> &
77 overrideWindowPolicy);
102 const std::optional<CameraUtilConformWindowPolicy> &
109 CameraUtilConformWindowPolicy
150 const GfVec4f& GetOverrideColor()
const {
return _overrideColor; }
157 const GfVec4f& GetWireframeColor()
const {
return _wireframeColor; }
162 const GfVec4f& GetMaskColor()
const {
return _maskColor; }
167 const GfVec4f& GetIndicatorColor()
const {
return _indicatorColor; }
174 const GfVec4f& GetPointColor()
const {
return _pointColor; }
179 float GetPointSize()
const {
return _pointSize; }
184 float GetPointSelectedSize()
const {
return _pointSelectedSize; }
189 bool GetLightingEnabled()
const {
return _lightingEnabled; }
192 void SetClippingEnabled(
bool enabled);
193 bool GetClippingEnabled()
const {
return _clippingEnabled; }
196 void SetEnableExposureCompensation(
bool enableExposureCompensation);
197 bool GetEnableExposureCompensation()
const {
return _enableExposureCompensation; }
207 HdRenderPassAovBindingVector
const& GetAovBindings()
const;
213 HdRenderPassAovBindingVector
const& GetAovInputBindings()
const;
220 bool GetUseAovMultiSample()
const;
223 void SetCullStyle(HdCullStyle cullStyle);
225 HdCullStyle GetCullStyle()
const {
return _cullStyle; }
228 void SetAlphaThreshold(
float alphaThreshold);
229 float GetAlphaThreshold()
const {
return _alphaThreshold; }
232 void SetTessLevel(
float level);
233 float GetTessLevel()
const {
return _tessLevel; }
236 void SetDrawingRange(
GfVec2f const &drawRange);
237 GfVec2f GetDrawingRange()
const {
return _drawRange; }
239 GfVec2f GetDrawingRangeNDC()
const;
242 void SetDepthBiasUseDefault(
bool useDefault);
243 bool GetDepthBiasUseDefault()
const {
return _depthBiasUseDefault; }
246 void SetDepthBiasEnabled(
bool enabled);
247 bool GetDepthBiasEnabled()
const {
return _depthBiasEnabled; }
250 void SetDepthBias(
float constantFactor,
float slopeFactor);
253 void SetDepthFunc(HdCompareFunction depthFunc);
254 HdCompareFunction GetDepthFunc()
const {
return _depthFunc; }
257 void SetEnableDepthMask(
bool state);
259 bool GetEnableDepthMask()
const;
262 void SetEnableDepthTest(
bool enabled);
264 bool GetEnableDepthTest()
const;
267 void SetEnableDepthClamp(
bool enabled);
269 bool GetEnableDepthClamp()
const;
272 void SetDepthRange(
GfVec2f const &depthRange);
274 const GfVec2f& GetDepthRange()
const;
277 void SetStencil(HdCompareFunction func,
int ref,
int mask,
278 HdStencilOp fail, HdStencilOp zfail, HdStencilOp zpass);
279 HdCompareFunction GetStencilFunc()
const {
return _stencilFunc; }
280 int GetStencilRef()
const {
return _stencilRef; }
281 int GetStencilMask()
const {
return _stencilMask; }
282 HdStencilOp GetStencilFailOp()
const {
return _stencilFailOp; }
283 HdStencilOp GetStencilDepthFailOp()
const {
return _stencilZFailOp; }
284 HdStencilOp GetStencilDepthPassOp()
const {
return _stencilZPassOp; }
286 void SetStencilEnabled(
bool enabled);
288 bool GetStencilEnabled()
const;
291 void SetLineWidth(
float width);
292 float GetLineWidth()
const {
return _lineWidth; }
295 void SetBlend(HdBlendOp colorOp,
296 HdBlendFactor colorSrcFactor,
297 HdBlendFactor colorDstFactor,
299 HdBlendFactor alphaSrcFactor,
300 HdBlendFactor alphaDstFactor);
301 HdBlendOp GetBlendColorOp() {
return _blendColorOp; }
302 HdBlendFactor GetBlendColorSrcFactor() {
return _blendColorSrcFactor; }
303 HdBlendFactor GetBlendColorDstFactor() {
return _blendColorDstFactor; }
304 HdBlendOp GetBlendAlphaOp() {
return _blendAlphaOp; }
305 HdBlendFactor GetBlendAlphaSrcFactor() {
return _blendAlphaSrcFactor; }
306 HdBlendFactor GetBlendAlphaDstFactor() {
return _blendAlphaDstFactor; }
310 void SetBlendConstantColor(
GfVec4f const & color);
311 const GfVec4f& GetBlendConstantColor()
const {
return _blendConstantColor; }
313 void SetBlendEnabled(
bool enabled);
316 void SetAlphaToCoverageEnabled(
bool enabled);
317 bool GetAlphaToCoverageEnabled()
const {
return _alphaToCoverageEnabled; }
320 void SetColorMaskUseDefault(
bool useDefault);
321 bool GetColorMaskUseDefault()
const {
return _colorMaskUseDefault;}
324 void SetConservativeRasterizationEnabled(
bool enabled);
325 bool GetConservativeRasterizationEnabled()
const {
326 return _conservativeRasterizationEnabled;
330 void SetVolumeRenderingConstants(
float stepSize,
float stepSizeLighting);
339 void SetColorMasks(std::vector<ColorMask>
const& masks);
340 std::vector<ColorMask>
const& GetColorMasks()
const {
return _colorMasks; }
343 void SetMultiSampleEnabled(
bool enabled);
344 bool GetMultiSampleEnabled()
const {
return _multiSampleEnabled; }
353 std::optional<CameraUtilConformWindowPolicy> _overrideWindowPolicy;
362 bool _lightingEnabled;
363 bool _clippingEnabled;
364 bool _enableExposureCompensation;
368 float _pointSelectedSize;
373 float _alphaThreshold;
377 bool _depthBiasUseDefault;
378 bool _depthBiasEnabled;
379 float _depthBiasConstantFactor;
380 float _depthBiasSlopeFactor;
381 HdCompareFunction _depthFunc;
382 bool _depthMaskEnabled;
383 bool _depthTestEnabled;
384 bool _depthClampEnabled;
387 HdCullStyle _cullStyle;
390 HdCompareFunction _stencilFunc;
393 HdStencilOp _stencilFailOp;
394 HdStencilOp _stencilZFailOp;
395 HdStencilOp _stencilZPassOp;
396 bool _stencilEnabled;
402 HdBlendOp _blendColorOp;
403 HdBlendFactor _blendColorSrcFactor;
404 HdBlendFactor _blendColorDstFactor;
405 HdBlendOp _blendAlphaOp;
406 HdBlendFactor _blendAlphaSrcFactor;
407 HdBlendFactor _blendAlphaDstFactor;
412 bool _alphaToCoverageEnabled;
414 bool _colorMaskUseDefault;
415 std::vector<ColorMask> _colorMasks;
417 HdRenderPassAovBindingVector _aovBindings;
418 HdRenderPassAovBindingVector _aovInputBindings;
419 bool _useMultiSampleAov;
421 bool _conservativeRasterizationEnabled;
424 float _stepSizeLighting;
426 bool _multiSampleEnabled;
429PXR_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 SetMaskColor(GfVec4f const &color)
The color is specified in the render color space.
HD_API void SetFraming(const CameraUtilFraming &framing)
Sets the framing to show the camera.
HD_API void SetOverrideWindowPolicy(const std::optional< CameraUtilConformWindowPolicy > &overrideWindowPolicy)
Sets whether to override the window policy used to conform the camera if its aspect ratio is not matc...
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 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::optional< 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.
const CameraUtilFraming & GetFraming() const
Get framing information determining how the filmback plane maps to pixels.
HD_API void SetIndicatorColor(GfVec4f const &color)
The color is specified in the render color space.
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...