-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMeshBuilder.h
49 lines (44 loc) · 876 Bytes
/
MeshBuilder.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
45
46
47
48
49
#pragma once
#include <vector>
#include <string>
#include <array>
class MeshBuilder
{
public:
enum VertexFormat
{
POSITION,
NORMAL,
TEXCOORD0,
TANGENT,
BITANGENT,
DIFFUSE,
};
struct Data
{
struct Mesh {
std::vector<VertexFormat> layout;
std::vector<unsigned int> indices;
std::vector<char> vertices;
size_t numVertex;
size_t materialIndex;
float tranfromation[16];
};
struct Material {
std::string albedo;
std::string normal;
std::string ambient;
std::string height;
std::string shininess;
std::array<float, 3> diffuse = {1,1,1};
};
std::vector<Mesh> meshs;
std::vector<Material> materials;
std::array<float,6> aabb;
};
public:
static Data build(const std::string& filename);
private:
static Data buildByAssimp(const std::string& filename);
static Data buildByTinyobj(const std::string& filename);
};