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

honeycomb_node.hpp
Go to the documentation of this file.
1 #ifndef OGLPLUS_TEXGEN_HONEYCOMB_NODE_HPP
9 #define OGLPLUS_TEXGEN_HONEYCOMB_NODE_HPP
10 
11 #include "base_node.hpp"
12 #include "fallback_input.hpp"
13 
14 namespace eagine::oglp::texgen {
15 
16 enum class honeycomb_direction { vertical, horizontal };
17 
18 enum class honeycomb_output_type { cell_coord, cell_center, distance };
19 
20 class honeycomb_output : public base_output {
21 private:
22  input_with_const_default<float[2]>& _cells;
23  honeycomb_direction& _direction;
24  honeycomb_output_type _type;
25 
26  string_view type_abbr() const;
27 
28 public:
29  honeycomb_output(
30  node_intf& parent,
31  input_with_const_default<float[2]>&,
32  honeycomb_direction& direction,
33  honeycomb_output_type type);
34 
35  string_view type_name() override;
36 
37  slot_data_type value_type() override;
38 
39  std::ostream& definitions(std::ostream& out, compile_context& ctxt) override;
40 
41  std::ostream& expression(std::ostream& out, compile_context& ctxt) override;
42 };
43 
44 class honeycomb_node : public base_node {
45 private:
46  input_with_const_default<float[2]> _cells;
47  honeycomb_direction _direction{honeycomb_direction::vertical};
48 
49  honeycomb_output _cell_coord;
50  honeycomb_output _cell_center;
51  honeycomb_output _distance;
52 
53 public:
54  honeycomb_node();
55 
56  honeycomb_node& set_cell_count(float x, float y) {
57  _cells.fallback().set(x, y);
58  return *this;
59  }
60 
61  string_view type_name() override;
62 
63  span_size_t input_count() override;
64 
65  input_intf& input(span_size_t index) override;
66 
67  span_size_t output_count() override;
68 
69  output_intf& output(span_size_t index) override;
70 };
71 
72 } // namespace eagine::oglp::texgen
73 
74 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
75 #include <oglplus/texgen/honeycomb_node.inl>
76 #endif
77 
78 #endif // OGLPLUS_TEXGEN_HONEYCOMB_NODE_HPP
value_type
Value tree value element data type enumeration.
Definition: interface.hpp:27
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
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).