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

value_tree.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_SHAPES_VALUE_TREE_HPP
10 #define EAGINE_SHAPES_VALUE_TREE_HPP
11 
12 #include "../config/basic.hpp"
13 #include "../main_ctx_object.hpp"
14 #include "../value_tree/wrappers.hpp"
15 #include "gen_base.hpp"
16 #include <map>
17 
18 namespace eagine {
19 namespace shapes {
20 //------------------------------------------------------------------------------
29  : public main_ctx_object
31 public:
33 
34  auto vertex_count() -> span_size_t override;
35 
37 
39 
41 
43 
44  auto is_attrib_normalized(vertex_attrib_variant) -> bool override;
45 
46  void attrib_values(vertex_attrib_variant, span<byte>) override;
47  void attrib_values(vertex_attrib_variant, span<std::int16_t>) override;
48  void attrib_values(vertex_attrib_variant, span<std::int32_t>) override;
49  void attrib_values(vertex_attrib_variant, span<std::uint16_t>) override;
50  void attrib_values(vertex_attrib_variant, span<std::uint32_t>) override;
51  void attrib_values(vertex_attrib_variant, span<float>) override;
52 
53  auto index_type(drawing_variant) -> index_data_type override;
54 
55  auto index_count(drawing_variant) -> span_size_t override;
56 
57  void indices(drawing_variant, span<std::uint16_t> dest) override;
58  void indices(drawing_variant, span<std::uint32_t> dest) override;
59 
61 
62  void instructions(drawing_variant, span<draw_operation> ops) override;
63 
64 private:
66 
67  valtree::compound _source{};
68  std::string _temp{};
69  std::map<vertex_attrib_variant, std::string> _variant_names{};
70 
71  static auto _attr_mask(const valtree::compound&) noexcept
73 
74  template <typename T>
75  void _attrib_values(vertex_attrib_variant, span<T>);
76 };
77 //------------------------------------------------------------------------------
87 static inline auto
89  return std::make_unique<value_tree_loader>(std::move(source), parent);
90 }
91 //------------------------------------------------------------------------------
92 } // namespace shapes
93 } // namespace eagine
94 
95 #if !EAGINE_LINK_LIBRARY || defined(EAGINE_IMPLEMENTING_LIBRARY)
96 #include <eagine/shapes/value_tree.inl>
97 #endif
98 
99 #endif // EAGINE_SHAPES_VALUE_TREE_HPP
Helper class used to initialize main context objects.
Definition: main_ctx_object.hpp:45
void attrib_values(vertex_attrib_variant, span< byte >) override
Fetches the vertex attribute data for the specified variant as bytes.
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
bitfield< vertex_attrib_kind > vertex_attrib_bits
Alias for vertex_attrib_kind bitfield type.
Definition: vertex_attrib.hpp:85
auto values_per_vertex(vertex_attrib_variant) -> span_size_t override
Returns the number of values per vertex for the specified variant.
Base class for main context objects.
Definition: main_ctx_object.hpp:71
Common code is placed in this namespace.
Definition: eagine.hpp:21
auto operation_count()
Returns the number of drawing instructions for the default variant.
Definition: gen_base.hpp:179
auto vertex_count() -> span_size_t override
Returns the shaped vertex count.
Handle class for value tree compounds.
Definition: wrappers.hpp:223
void instructions(drawing_variant, span< draw_operation > ops) override
Fetches the drawing operations for the specified drawing variant.
Loader that fetches shape data from a value tree (JSON, YAML, etc.)
Definition: value_tree.hpp:28
Class designating an vertex attribute variant in a shape generator.
Definition: vertex_attrib.hpp:104
auto attrib_type(vertex_attrib_variant vav) -> attrib_data_type override
Returns the attribute data type for the specified variant.
span_size_t drawing_variant
Alias for shape drawing variant index type.
Definition: gen_base.hpp:31
auto attribute_variants(vertex_attrib_kind) -> span_size_t override
Returns the count of shape attribute variants.
Base class for shape generators re-calculating the center.
Definition: gen_base.hpp:320
auto is_attrib_normalized(vertex_attrib_variant) -> bool override
Indicates if the specified variant attribute values should be normalized.
auto index_type() -> index_data_type
Returns the index data type for the default draw variant.
Definition: gen_base.hpp:139
vertex_attrib_kind
Shape vertex attribute kind enumeration.
Definition: vertex_attrib.hpp:25
attrib_data_type
Shape vertex attribute data type enumeration.
Definition: drawing.hpp:67
static auto from_value_tree(valtree::compound source, main_ctx_parent parent)
Constructs instances of value_tree_loader.
Definition: value_tree.hpp:88
index_data_type
Shape element index type enumeration.
Definition: drawing.hpp:111
auto index_count()
Returns the index count for the default drawing variant.
Definition: gen_base.hpp:147
void indices(drawing_variant, span< std::uint16_t > dest) override
Fetches the index data for the specified drawing variant.
auto variant_name(vertex_attrib_variant) -> string_view override
Returns the name of the specified attribute variant.

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