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

glsl_node.hpp
Go to the documentation of this file.
1 #ifndef OGLPLUS_TEXGEN_GLSL_NODE_HPP
9 #define OGLPLUS_TEXGEN_GLSL_NODE_HPP
10 
11 #include "fallback_input.hpp"
12 #include "multi_input_node.hpp"
13 #include <map>
14 
15 namespace eagine::oglp::texgen {
16 
17 class glsl_output : public multi_input_output {
18 private:
19  friend class glsl_node;
20 
21  std::string _glsl;
22  slot_data_type _type;
23 
24 public:
25  glsl_output(node_intf& parent, std::string, slot_data_type);
26 
27  glsl_output(node_intf& parent)
28  : glsl_output(parent, "vec4(0.0)", slot_data_type::float_4) {}
29 
30  string_view type_name() override;
31 
32  slot_data_type value_type() override;
33 
34  std::ostream& definitions(std::ostream& out, compile_context& ctxt) override;
35 };
36 
37 class glsl_node : public multi_input_node {
38 private:
39  glsl_output _output;
40 
41 public:
42  glsl_node();
43 
44  glsl_output& single_output() override {
45  return _output;
46  }
47 
48  glsl_node& set_glsl(const std::string& glsl) {
49  _output._glsl = glsl;
50  return *this;
51  }
52 
53  glsl_node& set_type(slot_data_type type) {
54  _output._type = type;
55  return *this;
56  }
57 };
58 
59 } // namespace eagine::oglp::texgen
60 
61 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
62 #include <oglplus/texgen/glsl_node.inl>
63 #endif
64 
65 #endif // OGLPLUS_TEXGEN_GLSL_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).