Wayverb
material.h
1 #pragma once
2 
3 #include "combined/model/min_size_vector.h"
4 
5 #include "core/cl/scene_structs.h"
6 #include "core/serialize/surface.h"
7 
8 namespace wayverb {
9 namespace combined {
10 namespace model {
11 
12 class material final : public basic_member<material> {
13 public:
14  explicit material(std::string name = "new material",
16  core::make_surface<core::simulation_bands>(0.05,
17  0.05));
18 
19  void set_name(std::string name);
20  std::string get_name() const;
21 
22  void set_surface(core::surface<core::simulation_bands> surface);
23  core::surface<core::simulation_bands> get_surface() const;
24 
25  template <typename Archive>
26  void serialize(Archive& archive) {
27  archive(name_, surface_);
28  }
29 
30  NOTIFYING_COPY_ASSIGN_DECLARATION(material)
31 private:
32  void swap(material& other) noexcept {
33  using std::swap;
34  swap(name_, other.name_);
35  swap(surface_, other.surface_);
36  }
37 
38  std::string name_;
40 };
41 
42 bool operator==(const material& a, const material& b);
43 bool operator!=(const material& a, const material& b);
44 
46 
47 template <size_t MinimumSize, typename It>
48 auto materials_from_names(It b, It e) {
49  const auto distance = std::distance(b, e);
50  if (distance < MinimumSize) {
51  throw std::runtime_error{
52  "Range passed to 'materials_from_names' is shorter than the "
53  "minumum size"};
54  }
55  const auto extra = distance - MinimumSize;
56 
58 
59  for (auto i = 0; b != e; ++b, ++i) {
60  *ret[i] = material{*b};
61  }
62 
63  return ret;
64 }
65 } // namespace model
66 } // namespace combined
67 } // namespace wayverb
Definition: capsule_base.h:9
A vector which must hold some minimum number of elements.
Definition: min_size_vector.h:11
Definition: material.h:12