-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTriangle.h
33 lines (27 loc) · 937 Bytes
/
Triangle.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
#pragma once
#include <vector>
#include <fstream>
#include "Materials.h"
#include "Utils.h"
struct TriangleCompressed {
float3 p0;
float3 p1;
float3 p2;
float4 normal; // last element is material
};
class Triangle
{
public:
float3 p0;
float3 p1;
float3 p2;
float3 normal;
Material m;
Triangle(float3 p0, float3 p1, float3 p2, float3 normal, Material material);
float3 get_normal() const;
float3 get_center() const;
TriangleCompressed compress();
};
std::vector<Triangle> get_mesh_from_file(const std::string& filename, float scalefactor, Material material);
Triangle parse_triangle(const std::string& s, const std::vector<float3>& vertices, const std::vector<float3>& normals, const float& scalefactor, const Material& material);
std::pair<Triangle, Triangle> parse_quad(const std::string& s, const std::vector<float3>& vertices, const std::vector<float3>& normals, const float& scalefactor, const Material& material);