Newer
Older
cg / hw04 / src / Mesh.h
// Copyright (c) 2021. Pascal Syma <pascal@syma.dev> and Antonio Martinez Casadesus <acasadesus@stud.hs-bremen.de>.
// All rights reserved.

//
// Created by Pascal on 17.05.2021.
//

#ifndef OPENGL_EXAMPLE_MESH_H
#define OPENGL_EXAMPLE_MESH_H

#include <vector>
#include "Vertex.h"
#include "Tri.h"

using namespace std;


class Mesh {
public:
    vector<Vertex> pts;
    vector<Tri> tris;
    bool drawWireframe = false;
    bool drawOutline = false;

    Mesh();

    /// Load a mesh from a .obj file.
    /// \param fileName Path to file
    /// \return True, if loading was successful
    bool loadData(const string &fileName);

    /// Save this mesh to as a OBJ file.
    /// \param fileName Path to new file
    void saveData(const string &fileName);

    void connectivityAlgo();

    /// Subdivide this mesh using Loop-Subdivison once.
    void subDivLoop();

    /// Subdivide this mesh using Loop-Subdivision count times.
    /// \param count How many subdivision steps
    void subDivLoop(int count);

    /// Subdivide this mesh using the edge midpoints.
    void subDivEdgeMidpoint();

    /// Deep-clone this mesh
    /// \return New mesh
    Mesh *copy();

};


#endif //OPENGL_EXAMPLE_MESH_H