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>;
63 virtual void Prepare(HdResourceRegistrySharedPtr
const &resourceRegistry);
69 using ClipPlanesVector = std::vector<GfVec4d>;
81 const std::optional<CameraUtilConformWindowPolicy> &
82 overrideWindowPolicy);
107 const std::optional<CameraUtilConformWindowPolicy> &
114 CameraUtilConformWindowPolicy
155 const GfVec4f& GetOverrideColor()
const {
return _overrideColor; }
162 const GfVec4f& GetWireframeColor()
const {
return _wireframeColor; }
167 const GfVec4f& GetMaskColor()
const {
return _maskColor; }
172 const GfVec4f& GetIndicatorColor()
const {
return _indicatorColor; }
179 const GfVec4f& GetPointColor()
const {
return _pointColor; }
184 float GetPointSize()
const {
return _pointSize; }
189 float GetPointSelectedSize()
const {
return _pointSelectedSize; }
194 bool GetLightingEnabled()
const {
return _lightingEnabled; }
197 void SetClippingEnabled(
bool enabled);
198 bool GetClippingEnabled()
const {
return _clippingEnabled; }
201 void SetEnableExposureCompensation(
bool enableExposureCompensation);
202 bool GetEnableExposureCompensation()
const {
return _enableExposureCompensation; }
212 HdRenderPassAovBindingVector
const& GetAovBindings()
const;
218 HdRenderPassAovBindingVector
const& GetAovInputBindings()
const;
225 bool GetUseAovMultiSample()
const;
228 void SetCullStyle(HdCullStyle cullStyle);
230 HdCullStyle GetCullStyle()
const {
return _cullStyle; }
233 void SetAlphaThreshold(
float alphaThreshold);
234 float GetAlphaThreshold()
const {
return _alphaThreshold; }
237 void SetTessLevel(
float level);
238 float GetTessLevel()
const {
return _tessLevel; }
241 void SetDrawingRange(
GfVec2f const &drawRange);
242 GfVec2f GetDrawingRange()
const {
return _drawRange; }
244 GfVec2f GetDrawingRangeNDC()
const;
247 void SetDepthBiasUseDefault(
bool useDefault);
248 bool GetDepthBiasUseDefault()
const {
return _depthBiasUseDefault; }
251 void SetDepthBiasEnabled(
bool enabled);
252 bool GetDepthBiasEnabled()
const {
return _depthBiasEnabled; }
255 void SetDepthBias(
float constantFactor,
float slopeFactor);
258 void SetDepthFunc(HdCompareFunction depthFunc);
259 HdCompareFunction GetDepthFunc()
const {
return _depthFunc; }
262 void SetEnableDepthMask(
bool state);
264 bool GetEnableDepthMask()
const;
267 void SetEnableDepthTest(
bool enabled);
269 bool GetEnableDepthTest()
const;
272 void SetEnableDepthClamp(
bool enabled);
274 bool GetEnableDepthClamp()
const;
277 void SetDepthRange(
GfVec2f const &depthRange);
279 const GfVec2f& GetDepthRange()
const;
282 void SetStencil(HdCompareFunction func,
int ref,
int mask,
283 HdStencilOp fail, HdStencilOp zfail, HdStencilOp zpass);
284 HdCompareFunction GetStencilFunc()
const {
return _stencilFunc; }
285 int GetStencilRef()
const {
return _stencilRef; }
286 int GetStencilMask()
const {
return _stencilMask; }
287 HdStencilOp GetStencilFailOp()
const {
return _stencilFailOp; }
288 HdStencilOp GetStencilDepthFailOp()
const {
return _stencilZFailOp; }
289 HdStencilOp GetStencilDepthPassOp()
const {
return _stencilZPassOp; }
291 void SetStencilEnabled(
bool enabled);
293 bool GetStencilEnabled()
const;
296 void SetLineWidth(
float width);
297 float GetLineWidth()
const {
return _lineWidth; }
300 void SetBlend(HdBlendOp colorOp,
301 HdBlendFactor colorSrcFactor,
302 HdBlendFactor colorDstFactor,
304 HdBlendFactor alphaSrcFactor,
305 HdBlendFactor alphaDstFactor);
306 HdBlendOp GetBlendColorOp() {
return _blendColorOp; }
307 HdBlendFactor GetBlendColorSrcFactor() {
return _blendColorSrcFactor; }
308 HdBlendFactor GetBlendColorDstFactor() {
return _blendColorDstFactor; }
309 HdBlendOp GetBlendAlphaOp() {
return _blendAlphaOp; }
310 HdBlendFactor GetBlendAlphaSrcFactor() {
return _blendAlphaSrcFactor; }
311 HdBlendFactor GetBlendAlphaDstFactor() {
return _blendAlphaDstFactor; }
315 void SetBlendConstantColor(
GfVec4f const & color);
316 const GfVec4f& GetBlendConstantColor()
const {
return _blendConstantColor; }
318 void SetBlendEnabled(
bool enabled);
321 void SetAlphaToCoverageEnabled(
bool enabled);
322 bool GetAlphaToCoverageEnabled()
const {
return _alphaToCoverageEnabled; }
325 void SetColorMaskUseDefault(
bool useDefault);
326 bool GetColorMaskUseDefault()
const {
return _colorMaskUseDefault;}
329 void SetConservativeRasterizationEnabled(
bool enabled);
330 bool GetConservativeRasterizationEnabled()
const {
331 return _conservativeRasterizationEnabled;
335 void SetVolumeRenderingConstants(
float stepSize,
float stepSizeLighting);
344 void SetColorMasks(std::vector<ColorMask>
const& masks);
345 std::vector<ColorMask>
const& GetColorMasks()
const {
return _colorMasks; }
348 void SetMultiSampleEnabled(
bool enabled);
349 bool GetMultiSampleEnabled()
const {
return _multiSampleEnabled; }
358 std::optional<CameraUtilConformWindowPolicy> _overrideWindowPolicy;
367 bool _lightingEnabled;
368 bool _clippingEnabled;
369 bool _enableExposureCompensation;
373 float _pointSelectedSize;
378 float _alphaThreshold;
382 bool _depthBiasUseDefault;
383 bool _depthBiasEnabled;
384 float _depthBiasConstantFactor;
385 float _depthBiasSlopeFactor;
386 HdCompareFunction _depthFunc;
387 bool _depthMaskEnabled;
388 bool _depthTestEnabled;
389 bool _depthClampEnabled;
392 HdCullStyle _cullStyle;
395 HdCompareFunction _stencilFunc;
398 HdStencilOp _stencilFailOp;
399 HdStencilOp _stencilZFailOp;
400 HdStencilOp _stencilZPassOp;
401 bool _stencilEnabled;
407 HdBlendOp _blendColorOp;
408 HdBlendFactor _blendColorSrcFactor;
409 HdBlendFactor _blendColorDstFactor;
410 HdBlendOp _blendAlphaOp;
411 HdBlendFactor _blendAlphaSrcFactor;
412 HdBlendFactor _blendAlphaDstFactor;
417 bool _alphaToCoverageEnabled;
419 bool _colorMaskUseDefault;
420 std::vector<ColorMask> _colorMasks;
422 HdRenderPassAovBindingVector _aovBindings;
423 HdRenderPassAovBindingVector _aovInputBindings;
424 bool _useMultiSampleAov;
426 bool _conservativeRasterizationEnabled;
429 float _stepSizeLighting;
431 bool _multiSampleEnabled;
434PXR_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.
virtual HD_API void Copy(HdRenderPassState const &src)
Copy state from src into this object.
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...