Go to the documentation of this file.
9 #ifndef OGLPLUS_SHAPES_GENERATOR_HPP
10 #define OGLPLUS_SHAPES_GENERATOR_HPP
12 #include "../gl_api.hpp"
13 #include "../math/primitives.hpp"
21 namespace eagine::oglp {
29 std::shared_ptr<generator> _gen{};
35 template <
typename A,
typename Gen>
41 return _gen->find_variant(attrib, name);
48 if(
auto found{find_variant(attrib, name)}) {
51 return {attrib, index};
55 return _gen->draw_variant_count();
59 return _gen->draw_variant(index);
63 return _gen->vertex_count();
68 return _gen->values_per_vertex(vav);
72 return vertex_count() * values_per_vertex(vav);
79 return translate(api, _gen->attrib_type(vav));
83 auto is_attrib_normalized(
86 return translate(api, _gen->is_attrib_normalized(vav));
96 return value_count(vav) * attrib_type_size(vav);
101 auto is_indexed()
const ->
bool {
102 return _gen->index_count() > 0;
106 return _gen->index_count();
110 return _gen->index_count(dv);
121 auto index_data_block_size()
const ->
span_size_t {
122 return index_count() * index_type_size();
127 return index_count(dv) * index_type_size(dv);
132 return index_data(0, data);
136 return _gen->operation_count();
140 return _gen->operation_count(dv);
143 auto operation_count(span<const shapes::drawing_variant> dvs)
const
146 template <
typename A>
155 template <
typename A>
162 template <
typename A>
167 return index_setup(api, buf, 0, temp);
170 template <
typename A>
174 span<const shapes::drawing_variant> dvs,
177 template <
typename A>
181 span<shape_draw_operation>)
const;
183 template <
typename A>
186 span<shape_draw_operation> dest)
const {
187 return instructions(api, 0, dest);
190 template <
typename A>
193 span<const shapes::drawing_variant> dvs,
194 span<shape_draw_subset>,
195 span<shape_draw_operation>)
const;
197 auto bounding_sphere()
const ->
sphere {
198 return _gen->bounding_sphere();
202 return _gen->ray_intersection(ray);
208 return ray_intersection(
extract(opt_ray));
216 #include <oglplus/shapes/generator.inl>
218 #endif // OGLPLUS_SHAPES_GENERATOR_HPP
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
static auto translate(std::shared_ptr< generator > gen, std::array< float, 3 > d) noexcept
Constructs instances of translated_gen modifier.
Definition: translated.hpp:41
Basic template for spheres in N-dimensional space.
Definition: primitives.hpp:122
Basic template for lines in N-dimensional space.
Definition: primitives.hpp:19
static constexpr auto extract(api_result_value< Result, api_result_validity::never > &) noexcept -> Result &
Overload of extract for api_result_value.
Definition: c_api_wrap.hpp:270
Interface for shape loaders or generators.
Definition: gen_base.hpp:35
Primary template for conditionally valid values.
Definition: decl.hpp:49
Class designating an vertex attribute variant in a shape generator.
Definition: vertex_attrib.hpp:104
Class wrapping a generic shape loader/generator, adapting it for GL.
Definition: generator.hpp:26
Wrapper for true, false GL enums.
Definition: enum_types.hpp:17
Non-owning wrapper for C-API opaque handle types.
Definition: handle.hpp:26
Reallocatable owning byte buffer.
Definition: buffer.hpp:22
Typed enumeration for GL data type constants.
Definition: enum_types.hpp:568
Non-owning view of a contiguous range of memory with ValueType elements.
Definition: flatten_fwd.hpp:16
span_size_t drawing_variant
Alias for shape drawing variant index type.
Definition: gen_base.hpp:31
vertex_attrib_kind
Shape vertex attribute kind enumeration.
Definition: vertex_attrib.hpp:25
Combined wrapper for the GL API operations and constants.
Definition: basic_gl_api.hpp:27
auto type_size(const basic_gl_api< A > &, shapes::attrib_data_type) noexcept -> span_size_t
Returns the byte size of a shape attribute data type.