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; }
203 HdRenderPassAovBindingVector
const& GetAovBindings()
const;
209 HdRenderPassAovBindingVector
const& GetAovInputBindings()
const;
216 bool GetUseAovMultiSample()
const;
219 void SetCullStyle(HdCullStyle cullStyle);
221 HdCullStyle GetCullStyle()
const {
return _cullStyle; }
224 void SetAlphaThreshold(
float alphaThreshold);
225 float GetAlphaThreshold()
const {
return _alphaThreshold; }
228 void SetTessLevel(
float level);
229 float GetTessLevel()
const {
return _tessLevel; }
232 void SetDrawingRange(
GfVec2f const &drawRange);
233 GfVec2f GetDrawingRange()
const {
return _drawRange; }
235 GfVec2f GetDrawingRangeNDC()
const;
238 void SetDepthBiasUseDefault(
bool useDefault);
239 bool GetDepthBiasUseDefault()
const {
return _depthBiasUseDefault; }
242 void SetDepthBiasEnabled(
bool enabled);
243 bool GetDepthBiasEnabled()
const {
return _depthBiasEnabled; }
246 void SetDepthBias(
float constantFactor,
float slopeFactor);
249 void SetDepthFunc(HdCompareFunction depthFunc);
250 HdCompareFunction GetDepthFunc()
const {
return _depthFunc; }
253 void SetEnableDepthMask(
bool state);
255 bool GetEnableDepthMask()
const;
258 void SetEnableDepthTest(
bool enabled);
260 bool GetEnableDepthTest()
const;
263 void SetEnableDepthClamp(
bool enabled);
265 bool GetEnableDepthClamp()
const;
268 void SetDepthRange(
GfVec2f const &depthRange);
270 const GfVec2f& GetDepthRange()
const;
273 void SetStencil(HdCompareFunction func,
int ref,
int mask,
274 HdStencilOp fail, HdStencilOp zfail, HdStencilOp zpass);
275 HdCompareFunction GetStencilFunc()
const {
return _stencilFunc; }
276 int GetStencilRef()
const {
return _stencilRef; }
277 int GetStencilMask()
const {
return _stencilMask; }
278 HdStencilOp GetStencilFailOp()
const {
return _stencilFailOp; }
279 HdStencilOp GetStencilDepthFailOp()
const {
return _stencilZFailOp; }
280 HdStencilOp GetStencilDepthPassOp()
const {
return _stencilZPassOp; }
282 void SetStencilEnabled(
bool enabled);
284 bool GetStencilEnabled()
const;
287 void SetLineWidth(
float width);
288 float GetLineWidth()
const {
return _lineWidth; }
291 void SetBlend(HdBlendOp colorOp,
292 HdBlendFactor colorSrcFactor,
293 HdBlendFactor colorDstFactor,
295 HdBlendFactor alphaSrcFactor,
296 HdBlendFactor alphaDstFactor);
297 HdBlendOp GetBlendColorOp() {
return _blendColorOp; }
298 HdBlendFactor GetBlendColorSrcFactor() {
return _blendColorSrcFactor; }
299 HdBlendFactor GetBlendColorDstFactor() {
return _blendColorDstFactor; }
300 HdBlendOp GetBlendAlphaOp() {
return _blendAlphaOp; }
301 HdBlendFactor GetBlendAlphaSrcFactor() {
return _blendAlphaSrcFactor; }
302 HdBlendFactor GetBlendAlphaDstFactor() {
return _blendAlphaDstFactor; }
306 void SetBlendConstantColor(
GfVec4f const & color);
307 const GfVec4f& GetBlendConstantColor()
const {
return _blendConstantColor; }
309 void SetBlendEnabled(
bool enabled);
312 void SetAlphaToCoverageEnabled(
bool enabled);
313 bool GetAlphaToCoverageEnabled()
const {
return _alphaToCoverageEnabled; }
316 void SetColorMaskUseDefault(
bool useDefault);
317 bool GetColorMaskUseDefault()
const {
return _colorMaskUseDefault;}
320 void SetConservativeRasterizationEnabled(
bool enabled);
321 bool GetConservativeRasterizationEnabled()
const {
322 return _conservativeRasterizationEnabled;
326 void SetVolumeRenderingConstants(
float stepSize,
float stepSizeLighting);
335 void SetColorMasks(std::vector<ColorMask>
const& masks);
336 std::vector<ColorMask>
const& GetColorMasks()
const {
return _colorMasks; }
339 void SetMultiSampleEnabled(
bool enabled);
340 bool GetMultiSampleEnabled()
const {
return _multiSampleEnabled; }
349 std::optional<CameraUtilConformWindowPolicy> _overrideWindowPolicy;
358 bool _lightingEnabled;
359 bool _clippingEnabled;
363 float _pointSelectedSize;
368 float _alphaThreshold;
372 bool _depthBiasUseDefault;
373 bool _depthBiasEnabled;
374 float _depthBiasConstantFactor;
375 float _depthBiasSlopeFactor;
376 HdCompareFunction _depthFunc;
377 bool _depthMaskEnabled;
378 bool _depthTestEnabled;
379 bool _depthClampEnabled;
382 HdCullStyle _cullStyle;
385 HdCompareFunction _stencilFunc;
388 HdStencilOp _stencilFailOp;
389 HdStencilOp _stencilZFailOp;
390 HdStencilOp _stencilZPassOp;
391 bool _stencilEnabled;
397 HdBlendOp _blendColorOp;
398 HdBlendFactor _blendColorSrcFactor;
399 HdBlendFactor _blendColorDstFactor;
400 HdBlendOp _blendAlphaOp;
401 HdBlendFactor _blendAlphaSrcFactor;
402 HdBlendFactor _blendAlphaDstFactor;
407 bool _alphaToCoverageEnabled;
409 bool _colorMaskUseDefault;
410 std::vector<ColorMask> _colorMasks;
412 HdRenderPassAovBindingVector _aovBindings;
413 HdRenderPassAovBindingVector _aovInputBindings;
414 bool _useMultiSampleAov;
416 bool _conservativeRasterizationEnabled;
419 float _stepSizeLighting;
421 bool _multiSampleEnabled;
424PXR_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...