-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcomponent_node.h
More file actions
78 lines (66 loc) · 1.67 KB
/
Copy pathcomponent_node.h
File metadata and controls
78 lines (66 loc) · 1.67 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
////////////////////////////////////////////////////////////////////////////////
// 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 <string>
#include "graphics/render_graph/node.h"
namespace iris
{
class ShaderCompiler;
/**
* Implementation of Node for extracting components from an input_node.
*/
class ComponentNode : public Node
{
public:
/**
* Create a new ComponentNode.
*
* @param input_node
* Node to get component from.
*
* @param component
* String representation of components, supports swizzling e.g. "x", "xy",
* "rgb".
*/
ComponentNode(Node *input_node, const std::string &component);
~ComponentNode() override = default;
/**
* Accept a compiler visitor.
*
* @param compiler
* Compiler to accept.
*/
void accept(ShaderCompiler &compiler) const override;
/**
* Get input_node node.
*
* @returns
* Input node.
*/
Node *input_node() const;
/**
* Get component string.
*
* @returns
* Component string.
*/
std::string component() const;
/**
* Compute hash of node.
*
* @return
* Hash of node.
*/
std::size_t hash() const override;
private:
/** Input node. */
Node *input_node_;
/** Component string. */
std::string component_;
};
}