HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
skydomeTask.h
Go to the documentation of this file.
1
//
2
// Copyright 2021 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 HDX_SKYDOME_TASK_H
25
#define HDX_SKYDOME_TASK_H
26
27
#include "
pxr/pxr.h
"
28
#include "
pxr/imaging/hdx/api.h
"
29
#include "
pxr/imaging/hdx/renderSetupTask.h
"
30
#include "
pxr/imaging/hdx/task.h
"
31
32
#include "
pxr/base/gf/matrix4f.h
"
33
#include "
pxr/base/gf/vec2f.h
"
34
#include "
pxr/usd/sdf/path.h
"
35
#include "
pxr/imaging/hgi/graphicsCmds.h
"
36
37
#include "
pxr/imaging/glf/simpleLightingContext.h
"
38
39
PXR_NAMESPACE_OPEN_SCOPE
40
41
/// \class HdxSkydomeTask
42
///
43
/// If we have a domelight present in the lighting context the SkydomeTask
44
/// will render the associated environment map as a Skydome. Otherwise, it
45
/// will simply clear the AOVs.
46
///
47
/// Note that this task is intended to be the first "Render Task" in the
48
/// HdxTaskController so that the AOV's are properly cleared, however it
49
/// does not spawn a HdRenderPass.
50
///
51
class
HdxSkydomeTask
:
public
HdxTask
52
{
53
public
:
54
HDX_API
55
HdxSkydomeTask
(
HdSceneDelegate
* delegate,
SdfPath
const
&
id
);
56
57
HDX_API
58
~HdxSkydomeTask
()
override
;
59
60
/// Prepare the tasks resources
61
HDX_API
62
void
Prepare
(
HdTaskContext
* ctx,
63
HdRenderIndex
* renderIndex)
override
;
64
65
/// Execute render pass task
66
HDX_API
67
void
Execute
(
HdTaskContext
* ctx)
override
;
68
69
protected
:
70
/// Sync the render pass resources
71
HDX_API
72
void
_Sync
(
HdSceneDelegate
* delegate,
73
HdTaskContext
* ctx,
74
HdDirtyBits
* dirtyBits)
override
;
75
76
private
:
77
HdRenderIndex
* _renderIndex;
78
HgiTextureHandle
_skydomeTexture;
79
// Optional internal render setup task, for params unpacking.
80
// This is used for aov bindings, camera matrices and framing
81
HdxRenderSetupTaskSharedPtr
_setupTask;
82
unsigned
int
_settingsVersion;
83
bool
_skydomeVisibility;
84
85
HdxSkydomeTask() =
delete
;
86
HdxSkydomeTask(
const
HdxSkydomeTask &) =
delete
;
87
HdxSkydomeTask &operator =(
const
HdxSkydomeTask &) =
delete
;
88
89
HdRenderPassStateSharedPtr
_GetRenderPassState(
HdTaskContext
*ctx)
const
;
90
bool
_GetSkydomeTexture(
HdTaskContext
* ctx);
91
void
_SetFragmentShader();
92
93
// Utility function to update the shader uniform parameters.
94
// Returns true if the values were updated. False if unchanged.
95
bool
_UpdateParameterBuffer(
96
const
GfMatrix4f
& invProjMatrix,
97
const
GfMatrix4f
& viewToWorldMatrix,
98
const
GfMatrix4f
& lightTransform);
99
100
// This struct must match ParameterBuffer in Skydome.glslfx.
101
// Be careful to remember the std430 rules.
102
struct
_ParameterBuffer
103
{
104
GfMatrix4f
invProjMatrix;
105
GfMatrix4f
viewToWorldMatrix;
106
GfMatrix4f
lightTransform;
107
};
108
109
std::unique_ptr<class HdxFullscreenShader> _compositor;
110
_ParameterBuffer _parameterData;
111
};
112
113
114
PXR_NAMESPACE_CLOSE_SCOPE
115
116
#endif
GfMatrix4f
Definition:
matrix4f.h:87
HdRenderIndex
Definition:
renderIndex.h:120
HdRenderPassStateSharedPtr
std::shared_ptr< class HdRenderPassState > HdRenderPassStateSharedPtr
Definition:
engine.h:42
HdDirtyBits
uint32_t HdDirtyBits
Definition:
types.h:158
renderSetupTask.h
HdxSkydomeTask::_Sync
HDX_API void _Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
HgiTextureHandle
int HgiHandle< class HgiTexture > HgiTextureHandle
Definition:
ptexTextureObject.h:53
HDX_API
#define HDX_API
Definition:
api.h:40
vec2f.h
HdxSkydomeTask::~HdxSkydomeTask
HDX_API ~HdxSkydomeTask() override
pxr.h
HdSceneDelegate
Definition:
sceneDelegate.h:408
simpleLightingContext.h
SdfPath
Definition:
path.h:290
matrix4f.h
HdTaskContext
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition:
renderIndex.h:77
path.h
task.h
HdxTask
Definition:
task.h:44
HdxSkydomeTask::Execute
HDX_API void Execute(HdTaskContext *ctx) override
Execute render pass task.
PXR_NAMESPACE_OPEN_SCOPE
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition:
path.h:1432
api.h
HdxSkydomeTask
Definition:
skydomeTask.h:51
HdxRenderSetupTaskSharedPtr
std::shared_ptr< class HdxRenderSetupTask > HdxRenderSetupTaskSharedPtr
Definition:
renderSetupTask.h:47
PXR_NAMESPACE_CLOSE_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition:
pxr.h:91
HdxSkydomeTask::Prepare
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the tasks resources.
graphicsCmds.h
pxr
imaging
hdx
skydomeTask.h
Generated on Sun Nov 17 2024 03:02:54 for HDK by
1.8.6