forked from KhronosGroup/ANARI-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderPass.h
69 lines (55 loc) · 1.75 KB
/
renderPass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright 2024 The Khronos Group
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <anari/anari_cpp.hpp>
#include <pxr/base/gf/matrix4d.h>
#include <pxr/base/gf/rect2i.h>
#include <pxr/base/gf/vec4f.h>
#include <pxr/base/tf/token.h>
#include <pxr/imaging/hd/aov.h>
#include <pxr/imaging/hd/renderDelegate.h>
#include <pxr/imaging/hd/renderIndex.h>
#include <pxr/imaging/hd/renderPass.h>
#include <pxr/imaging/hd/rprimCollection.h>
#include <pxr/pxr.h>
#include <memory>
#include "renderParam.h"
PXR_NAMESPACE_OPEN_SCOPE
struct HdAnariRenderPass final : public HdRenderPass
{
HdAnariRenderPass(HdRenderIndex *index,
HdRprimCollection const &collection,
std::shared_ptr<HdAnariRenderParam> renderParam);
~HdAnariRenderPass() override;
void _Execute(HdRenderPassStateSharedPtr const &renderPassState,
TfTokenVector const &renderTags) override;
private:
void _UpdateRenderer();
void _UpdateFrame(
const GfRect2i &size, const HdRenderPassAovBindingVector &aovBindings);
void _UpdateCamera(const GfMatrix4d &invView, const GfMatrix4d &invProj);
void _UpdateWorld();
void _WriteAovs(const HdRenderPassAovBindingVector &aovBindings);
std::shared_ptr<HdAnariRenderParam> _renderParam;
HdRenderPassAovBindingVector _aovBindings;
HdParsedAovTokenVector _aovNames;
GfVec4f _clearColor;
GfRect2i _frameSize;
struct ViewInfo
{
GfMatrix4d view{1.f};
GfMatrix4d proj{1.f};
GfMatrix4d invView{1.f};
GfMatrix4d invProj{1.f};
} _camera;
int _lastSettingsVersion{-1};
int _lastSceneVersion{-1};
struct AnariObjects
{
anari::Frame frame{nullptr};
anari::Camera camera{nullptr};
anari::Renderer renderer{nullptr};
anari::World world{nullptr};
} _anari;
};
PXR_NAMESPACE_CLOSE_SCOPE