Repository navigation
Expand file tree
/
Copy pathcomposite_node.h
More file actions
107 lines (91 loc) · 2.1 KB
/
Copy pathcomposite_node.h
File metadata and controls
107 lines (91 loc) · 2.1 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
////////////////////////////////////////////////////////////////////////////////
// Distributed under the Boost Software License, Version 1.0. //
// (See accompanying file LICENSE or copy at //
// https://www.boost.org/LICENSE_1_0.txt) //
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <cstddef>
#include <memory>
#include "core/vector3.h"
#include "graphics/render_graph/node.h"
namespace iris
{
class ShaderCompiler;
/**
* Implementation of Node that composites two other nodes together. For each
* fragment colour1 or colour2 is picked based upon which has the closest depth
* value.
*/
class CompositeNode : public Node
{
public:
/**
* Create a new CompositeNode.
*
* @param colour1
* First colour node.
*
* @param colour2
* Second colour node.
*
* @param depth1
* Depth values for colour1.
*
* @param depth2
* Depth values for colour2.
*/
CompositeNode(Node *colour1, Node *colour2, Node *depth1, Node *depth2);
~CompositeNode() override = default;
/**
* Accept a compiler visitor.
*
* @param compiler
* Compiler to accept.
*/
void accept(ShaderCompiler &compiler) const override;
/**
* Get first colour.
*
* @returns
* First colour.
*/
Node *colour1() const;
/**
* Get second colour.
*
* @returns
* Second colour.
*/
Node *colour2() const;
/**
* Get first depth.
*
* @returns
* First depth.
*/
Node *depth1() const;
/**
* Get second depth.
*
* @returns
* Second depth.
*/
Node *depth2() const;
/**
* Compute hash of node.
*
* @return
* Hash of node.
*/
std::size_t hash() const override;
private:
/** First colour. */
Node *colour1_;
/** Second colour. */
Node *colour2_;
/** First depth. */
Node *depth1_;
/** Second depth. */
Node *depth2_;
};
}