Lugdunum  0.1.0
Mesh.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <list>
4 #include <string>
5 #include <vector>
6 
10 
11 namespace lug {
12 namespace Graphics {
13 
14 class Renderer;
15 
16 namespace Builder {
17 
20 
21 public:
23  public:
24  PrimitiveSet() = default;
25 
26  PrimitiveSet(const PrimitiveSet&) = delete;
27  PrimitiveSet(PrimitiveSet&&) = default;
28 
29  PrimitiveSet& operator=(const PrimitiveSet&) = delete;
30  PrimitiveSet& operator=(PrimitiveSet&&) = delete;
31 
32  ~PrimitiveSet() = default;
33 
34  void setMode(Render::Mesh::PrimitiveSet::Mode mode);
35  void setMaterial(Resource::SharedPtr<Render::Material> material);
36 
37  // TODO: Non raw mode
38 
39  // Raw mode
40  void addAttributeBuffer(const void* data, uint32_t elementSize, uint32_t elementsCount, Render::Mesh::PrimitiveSet::Attribute::Type type);
41 
42  Render::Mesh::PrimitiveSet::Mode getMode() const;
43  Resource::SharedPtr<Render::Material> getMaterial() const;
44  const std::vector<Render::Mesh::PrimitiveSet::Attribute>& getAttributes() const;
45 
46  private:
49 
50  std::vector<Render::Mesh::PrimitiveSet::Attribute> _attributes;
51  };
52 
53  friend class PrimitiveSet;
54 
55 public:
56  explicit Mesh(Renderer& renderer);
57 
58  Mesh(const Mesh&) = delete;
59  Mesh(Mesh&&) = delete;
60 
61  Mesh& operator=(const Mesh&) = delete;
62  Mesh& operator=(Mesh&&) = delete;
63 
64  ~Mesh() = default;
65 
70  void setName(const std::string& name);
71 
75  PrimitiveSet* addPrimitiveSet();
76 
78 
79 protected:
81 
82  std::string _name;
83  std::list<PrimitiveSet> _primitiveSets;
84 };
85 
87 
88 } // Builder
89 } // Graphics
90 } // lug
std::vector< Render::Mesh::PrimitiveSet::Attribute > _attributes
Definition: Mesh.hpp:50
std::list< PrimitiveSet > _primitiveSets
Definition: Mesh.hpp:83
#define LUG_GRAPHICS_API
Definition: Export.hpp:11
Resource::SharedPtr< lug::Graphics::Render::Mesh > build(const ::lug::Graphics::Builder::Mesh &builder)
Definition: Mesh.cpp:18
Mode
Type of the primitive set, defaults to Triangles.
Definition: Mesh.hpp:59