21 lines
		
	
	
		
			409 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			409 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "mesh.h"
 | |
| 
 | |
| #include "buffer.h"
 | |
| #include "material.h"
 | |
| 
 | |
| void Mesh::add_buffer(const std::shared_ptr<Buffer>& buffer,
 | |
| 		      const Material& material)
 | |
| {
 | |
| 	buffers_.push_back(buffer);
 | |
| 	materials_.push_back(material);
 | |
| }
 | |
| 
 | |
| void Mesh::draw()
 | |
| {
 | |
| 	// Draw each buffer with its material
 | |
| 	for (size_t i = 0; i < buffers_.size(); ++i) {
 | |
| 		materials_[i].prepare();
 | |
| 		buffers_[i]->draw(*materials_[i].shader());
 | |
| 	}
 | |
| }
 |