Loading...
Searching...
No Matches
shadowTask.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_IMAGING_HDX_SHADOW_TASK_H
25#define PXR_IMAGING_HDX_SHADOW_TASK_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdx/api.h"
29#include "pxr/imaging/hdx/version.h"
30#include "pxr/imaging/hd/enums.h"
31#include "pxr/imaging/hd/task.h"
32
33#include "pxr/base/gf/vec4f.h"
34#include "pxr/base/gf/vec4d.h"
36
37#include <memory>
38
39PXR_NAMESPACE_OPEN_SCOPE
40
41class GlfSimpleLight;
42class HdRenderIndex;
43class HdSceneDelegate;
45
46using HdStRenderPassShaderSharedPtr =
47 std::shared_ptr<class HdStRenderPassShader>;
48using HdStShaderCodeSharedPtr =
49 std::shared_ptr<class HdStShaderCode>;
50
51using HdRenderPassSharedPtr = std::shared_ptr<class HdRenderPass>;
52using HdRenderPassSharedPtrVector = std::vector<HdRenderPassSharedPtr>;
53using HdStRenderPassStateSharedPtr = std::shared_ptr<class HdStRenderPassState>;
54using HdStRenderPassStateSharedPtrVector =
55 std::vector<HdStRenderPassStateSharedPtr>;
56
57TF_DECLARE_WEAK_AND_REF_PTRS(GlfSimpleShadowArray);
58
59struct HdxShadowTaskParams
60{
61 HdxShadowTaskParams()
62 : overrideColor(0.0)
63 , wireframeColor(0.0)
64 , enableLighting(false)
65 , enableIdRender(false)
66 , enableSceneMaterials(true)
67 , alphaThreshold(0.0)
68 , depthBiasEnable(false)
69 , depthBiasConstantFactor(0.0f)
70 , depthBiasSlopeFactor(1.0f)
71 , depthFunc(HdCmpFuncLEqual)
72 , cullStyle(HdCullStyleBackUnlessDoubleSided)
73 {}
74
75 // RenderPassState
76 GfVec4f overrideColor;
77 GfVec4f wireframeColor;
78 bool enableLighting;
79 bool enableIdRender;
80 bool enableSceneMaterials;
81 float alphaThreshold;
82 bool depthBiasEnable;
83 float depthBiasConstantFactor;
84 float depthBiasSlopeFactor;
85 HdCompareFunction depthFunc;
86 HdCullStyle cullStyle;
87};
88
93class HdxShadowTask : public HdTask
94{
95public:
96 HDX_API
97 HdxShadowTask(HdSceneDelegate* delegate, SdfPath const& id);
98
99 HDX_API
100 ~HdxShadowTask() override;
101
103 HDX_API
104 void Sync(HdSceneDelegate* delegate,
105 HdTaskContext* ctx,
106 HdDirtyBits* dirtyBits) override;
107
109 HDX_API
110 void Prepare(HdTaskContext* ctx,
111 HdRenderIndex* renderIndex) override;
112
114 HDX_API
115 void Execute(HdTaskContext* ctx) override;
116
118 HDX_API
119 const TfTokenVector &GetRenderTags() const override;
120
121
122private:
123 void _UpdateDirtyParams(HdStRenderPassStateSharedPtr &renderPassState,
124 HdxShadowTaskParams const &params);
125
126 HdRenderPassSharedPtrVector _passes;
127 HdStRenderPassStateSharedPtrVector _renderPassStates;
128 HdxShadowTaskParams _params;
129 TfTokenVector _renderTags;
130
131
132 HdxShadowTask() = delete;
133 HdxShadowTask(const HdxShadowTask &) = delete;
134 HdxShadowTask &operator =(const HdxShadowTask &) = delete;
135};
136
137// VtValue requirements
138HDX_API
139std::ostream& operator<<(std::ostream& out, const HdxShadowTaskParams& pv);
140HDX_API
141bool operator==(const HdxShadowTaskParams& lhs, const HdxShadowTaskParams& rhs);
142HDX_API
143bool operator!=(const HdxShadowTaskParams& lhs, const HdxShadowTaskParams& rhs);
144
145
146PXR_NAMESPACE_CLOSE_SCOPE
147
148#endif //PXR_IMAGING_HDX_SHADOW_TASK_H
Basic type for a vector of 4 float components.
Definition: vec4f.h:63
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:121
Adapter class providing data exchange with the client scene graph.
A set of rendering parameters used among render passes.
A task for generating shadow maps.
Definition: shadowTask.h:94
HDX_API const TfTokenVector & GetRenderTags() const override
Collect Render Tags used by the task.
HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the tasks resources.
HDX_API void Execute(HdTaskContext *ctx) override
Execute render pass task.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:89
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457