49 lines
		
	
	
		
			849 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			849 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef MESH_H_
 | |
| #define MESH_H_
 | |
| 
 | |
| #include <memory>
 | |
| #include <vector>
 | |
| 
 | |
| #include "material.h"
 | |
| 
 | |
| class Buffer;
 | |
| 
 | |
| class Mesh {
 | |
| public:
 | |
| 	Mesh()	= default;
 | |
| 	~Mesh() = default;
 | |
| 
 | |
| 	void add_buffer(const std::shared_ptr<Buffer>& buffer,
 | |
| 			const Material&		       material);
 | |
| 
 | |
| 	[[nodiscard]] size_t num_buffers() const
 | |
| 	{
 | |
| 		return buffers_.size();
 | |
| 	}
 | |
| 	[[nodiscard]] const std::shared_ptr<Buffer>& buffer(size_t index) const
 | |
| 	{
 | |
| 		return buffers_[index];
 | |
| 	}
 | |
| 	[[nodiscard]] std::shared_ptr<Buffer>& buffer(size_t index)
 | |
| 	{
 | |
| 		return buffers_[index];
 | |
| 	}
 | |
| 
 | |
| 	[[nodiscard]] const Material& material(size_t index) const
 | |
| 	{
 | |
| 		return materials_[index];
 | |
| 	}
 | |
| 	[[nodiscard]] Material& material(size_t index)
 | |
| 	{
 | |
| 		return materials_[index];
 | |
| 	}
 | |
| 
 | |
| 	void draw();
 | |
| 
 | |
| private:
 | |
| 	std::vector<std::shared_ptr<Buffer>> buffers_;
 | |
| 	std::vector<Material>		     materials_;
 | |
| };
 | |
| 
 | |
| #endif // MESH_H_
 |