# 3.1.1 class Mesh

## Add Mesh.h an d Mesh.cpp in src folder

Define your Mesh class to represent and draw triangle mesh models

Mesh.h

```cpp
#ifndef __MESH_H__
#define __MESH_H__

#include <iostream>
#include <vector>

#include <glad/glad.h>

#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform.hpp>

class Mesh {

protected:
    // array of vertices and normals
    std::vector< glm::vec3 > vertices; 

    // triangle vertex indices
    std::vector< unsigned int > indices;
    
    std::vector<GLuint> buffers;

    void initBuffer();

    // this will be Material in the future
    GLuint shaderId;

public:
    Mesh();
    ~Mesh();

    void init(std::string path, GLuint shaderId);
    void loadModel(std::string path);
    
    void draw(glm::mat4 mat = glm::mat4(1.0));
};

#endif
```

### Mesh.cpp

```cpp
#include <iostream>

#include <glad/glad.h>

#include "Mesh.h"

#include <assimp/scene.h>
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>

Mesh::Mesh()
{

}

Mesh::~Mesh()
{

}

void Mesh::init(std::string path, GLuint id)
{
    shaderId = id;
    loadModel(path);
    initBuffer();
}

void Mesh::loadModel(std::string path) 
{

}

void Mesh::initBuffer()
{

}

// all drawings come here
void Mesh::draw(glm::mat4 mat)
{

}
```

Update the following line CMakeLists.txt by  adding Mesh.cpp&#x20;

```cmake
add_executable(run01 src/main.cpp src/glad.c src/shader.cpp src/Mesh.cpp)
```
