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

scaled.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_SHAPES_SCALED_HPP
10 #define EAGINE_SHAPES_SCALED_HPP
11 
12 #include "delegated.hpp"
13 #include <eagine/config/basic.hpp>
14 #include <array>
15 #include <memory>
16 
17 namespace eagine {
18 namespace shapes {
19 //------------------------------------------------------------------------------
23 class scaled_gen : public delegated_gen {
24 
25 public:
26  scaled_gen(std::shared_ptr<generator> gen, std::array<float, 3> s) noexcept
27  : delegated_gen{std::move(gen)}
28  , _s{s} {}
29 
30  void attrib_values(vertex_attrib_variant, span<float>) override;
31 
32  auto bounding_sphere() -> math::sphere<float, true> override;
33 
34 private:
35  std::array<float, 3> _s;
36 };
37 //------------------------------------------------------------------------------
40 static inline auto
41 scale(std::shared_ptr<generator> gen, std::array<float, 3> s) noexcept {
42  return std::make_unique<scaled_gen>(std::move(gen), s);
43 }
44 //------------------------------------------------------------------------------
45 } // namespace shapes
46 } // namespace eagine
47 
48 #if !EAGINE_LINK_LIBRARY || defined(EAGINE_IMPLEMENTING_LIBRARY)
49 #include <eagine/shapes/scaled.inl>
50 #endif
51 
52 #endif // EAGINE_SHAPES_SCALED_HPP
Basic template for spheres in N-dimensional space.
Definition: primitives.hpp:122
Common code is placed in this namespace.
Definition: eagine.hpp:21
void attrib_values(vertex_attrib_variant, span< float >) override
Fetches the vertex attribute data for the specified variant as floats.
Generator modifier scaling the generated vertices by specifed amount.
Definition: scaled.hpp:23
auto bounding_sphere() -> math::sphere< float, true > override
Returns the bounding sphere for the generated shape.
Class designating an vertex attribute variant in a shape generator.
Definition: vertex_attrib.hpp:104
static auto scale(std::shared_ptr< generator > gen, std::array< float, 3 > s) noexcept
Constructs instances of scaled_gen modifier.
Definition: scaled.hpp:41
Base class for delegating shape generators based on other generators.
Definition: delegated.hpp:21

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