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

uniform_node.hpp
Go to the documentation of this file.
1 #ifndef OGLPLUS_TEXGEN_UNIFORM_NODE_HPP
9 #define OGLPLUS_TEXGEN_UNIFORM_NODE_HPP
10 
11 #include "../uniform.hpp"
12 #include "base_node.hpp"
13 #include "base_output.hpp"
14 
15 namespace eagine::oglp::texgen {
16 
17 class uniform_output : public base_output {
18 private:
19  friend class uniform_node;
20 
21  slot_data_type _value_type;
22  uniform_location _location;
23 
24 public:
25  uniform_output(node_intf& parent, slot_data_type type);
26 
27  void bind_location();
28 
29  uniform_location get_location() const {
30  return _location;
31  }
32 
33  string_view type_name() override;
34 
35  slot_data_type value_type() override;
36 
37  std::ostream& definitions(std::ostream& out, compile_context& ctxt) override;
38 };
39 
40 class uniform_node : public single_output_node<uniform_output> {
41 public:
42  uniform_node(slot_data_type);
43  uniform_node();
44 
45  uniform_node& set_value_type(slot_data_type type) {
46  _output._value_type = type;
47  return *this;
48  }
49 
50  template <typename T>
51  uniform_node& set_value_type() {
52  set_value_type(get_data_type_v<T>);
53  return *this;
54  }
55 
56  uniform_location get_uniform_location() const {
57  return _output.get_location();
58  }
59 
60  void prepare() override;
61 };
62 
63 } // namespace eagine::oglp::texgen
64 
65 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
66 #include <oglplus/texgen/uniform_node.inl>
67 #endif
68 
69 #endif // OGLPLUS_TEXGEN_UNIFORM_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
prog_var_location< EAGINE_ID_V(Uniform)> uniform_location
Alias for shader program uniform location wrapper.
Definition: prog_var_loc.hpp:115
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).