OGLplus  (0.59.0) a C++ wrapper for rendering APIs

complement_node.hpp
Go to the documentation of this file.
1 #ifndef OGLPLUS_TEXGEN_COMPLEMENT_NODE_HPP
9 #define OGLPLUS_TEXGEN_COMPLEMENT_NODE_HPP
10 
11 #include "base_node.hpp"
12 #include "fallback_input.hpp"
13 
14 namespace eagine::oglp::texgen {
15 
16 class complement_input : public input_with_const_default<float[4]> {
17 private:
18  using _base = input_with_const_default<float[4]>;
19 
20 public:
21  complement_input(
22  node_intf& parent,
23  string_view name,
24  float r,
25  float g,
26  float b,
27  float a)
28  : _base(parent, name, r, g, b, a) {}
29 
30  bool accepts_value_type(slot_data_type type) override {
31  return data_type_dims(type) == data_type_dims(output().value_type());
32  }
33 };
34 
35 class complement_output : public base_output {
36 public:
37  input_with_const_default<float[4]> input;
38  input_with_const_default<float[4]> complement;
39 
40  complement_output(node_intf& parent);
41 
42  string_view type_name() override;
43 
44  slot_data_type value_type() override;
45 
46  std::ostream& definitions(std::ostream& out, compile_context& ctxt) override;
47 };
48 
49 class complement_node
50  : public binary_single_output_node<
51  complement_output,
52  decltype(complement_output::input),
53  &complement_output::input,
54  decltype(complement_output::complement),
55  &complement_output::complement> {
56 public:
57  complement_node& set_complement(float r, float g, float b, float a) {
58  _output.complement.fallback().set(r, g, b, a);
59  return *this;
60  }
61 };
62 
63 } // namespace eagine::oglp::texgen
64 
65 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
66 #include <oglplus/texgen/complement_node.inl>
67 #endif
68 
69 #endif // OGLPLUS_TEXGEN_COMPLEMENT_NODE_HPP
value_type
Value tree value element data type enumeration.
Definition: interface.hpp:27
basic_string_span< const char > string_view
Alias for const string views.
Definition: string_span.hpp:116
static auto type_name(const T &) noexcept -> std::string
Returns the demangled name for type T.
Definition: type_name.hpp:24

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).