-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.h
44 lines (32 loc) · 933 Bytes
/
model.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
40
41
42
43
44
#ifndef _OBJECT_H_
#define _OBJECT_H_
#include <vector>
#include "vertex.h"
#include "box.h"
#include "face.h"
#include "material_lib.h"
using namespace std;
// Model - permet representar un objecte 3D
class Model
{
public:
Model();
Model(std::string);
// llegeix un model en format OBJ
void readObj(const char* filename, MaterialLib& matlib);
// calcula la capsa del model
void updateBoundingBox();
// retorna la capsa del model (previament s'ha d'haver calculat)
Box boundingBox() const;
void Render();
private:
void make_face ( char **words, int nwords, int material, vector<Vertex> &v );
void netejaDades ();
public:
vector<Vertex> vertices; // vector amb els vertexs de l'objecte
vector<Face> faces; // vector amb les cares de l'objecte
private:
std::string name;
Box _boundingBox; // caixa contenidora de l'objecte.
};
#endif