-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMesh.h
executable file
·39 lines (34 loc) · 1.04 KB
/
Mesh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <GL/glew.h>
#include "VertexArray.h"
#include "Buffer.h"
#include "Drawable.h"
#include <vector>
class Mesh : public Drawable
{
public:
VertexArray VAO;
std::vector<FloatBuffer> VBOs;
ElementBuffer IBO;
int NumVerts;
int NumTris;
Mesh(int vertexBuffers, int numVerts, int numFaces);
Mesh(
std::vector<GLfloat> vbo,
std::vector<GLfloat> nbo,
std::vector<GLuint> ibo);
void Draw() const;
void SetVertexData(
GLuint attribute, GLfloat *data, int itemSize);
void SetIndexData(unsigned int *iboData);
void ComputeAABB(
float& min_x, float& min_y, float& min_z,
float& max_x, float& max_y, float& max_z) const;
float ComputeRadius(glm::vec3 center) const;
static Mesh *CreateCube();
static Mesh *CreateTriplePlane();
static Mesh *CreateCubeWithNormals();
static Mesh *CreateQuad();
static Mesh *CreateCylinderWithNormals(int segments = 30);
static void Mesh::computeTangentBasis(float* vbo, float* texCoords, std::vector<glm::vec3> & tangents, std::vector<glm::vec3> & bitangents);
};