2018-01-27 14:59:17 +01:00
|
|
|
/**
|
|
|
|
* Defines a mesh, ready to be OpenGL-rendered
|
|
|
|
**/
|
|
|
|
|
2018-02-06 19:07:07 +01:00
|
|
|
#pragma once
|
|
|
|
|
2018-01-27 14:59:17 +01:00
|
|
|
#include <vector>
|
2018-01-27 16:28:36 +01:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <cstddef> // size_t
|
2018-01-27 15:23:05 +01:00
|
|
|
#include "common_structures.hpp"
|
2018-01-27 14:59:17 +01:00
|
|
|
|
|
|
|
class Mesh {
|
|
|
|
public:
|
|
|
|
Mesh();
|
|
|
|
|
|
|
|
/// Adds a fresh vertice at `pt`, and returns its ID for further use
|
|
|
|
size_t add_vertice(const Point& pt);
|
|
|
|
|
|
|
|
/// Creates a new face out of the three given point IDs
|
|
|
|
void add_face(const Face& face);
|
|
|
|
void add_face(size_t f1, size_t f2, size_t f3);
|
|
|
|
|
|
|
|
/// Gets the various vertices
|
|
|
|
const std::vector<Point>& get_vertices() const;
|
|
|
|
|
|
|
|
/// Gets the various faces
|
|
|
|
const std::vector<Face>& get_faces() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<Point> vertices;
|
|
|
|
std::vector<Face> faces;
|
|
|
|
};
|