-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMesh.hpp
More file actions
36 lines (33 loc) · 768 Bytes
/
Mesh.hpp
File metadata and controls
36 lines (33 loc) · 768 Bytes
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
#ifndef MESH_H
#define MESH_H
#include <vector>
#include "Object3D.h"
#include "octree.hpp"
#include "Triangle.h"
#include "Vector2f.h"
#include "Vector3f.h"
//by default counterclockwise winding is front face
struct Trig{
Trig(){x[0]=0;x[1]=0;x[2]=0;}
int & operator[](int i) {return x[i];}
int operator[](int i)const {return x[i];}
int x[3];
int texID[3];
};
class Mesh:public Object3D{
public:
Mesh(const char * filename, Material* m);
std::vector<Vector3f>v;
std::vector<Trig>t;
std::vector<Vector3f>n;
std::vector<Vector2f>texCoord;
virtual bool intersect( const Ray& r , Hit& h , float tmin );
virtual bool intersectTrig(int idx);
private:
const Ray * ray;
Hit * hit;
float tm;
void compute_norm();
Octree octree;
};
#endif