-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrefab.cpp
50 lines (39 loc) · 1.08 KB
/
Prefab.cpp
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
50
#include "Prefab.h"
#include <algorithm>
#include <locale>
#include <iostream>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
using namespace std;
Prefab::
Prefab(){}
void
Prefab::
Initialize(const string _location){
location = _location;
// Read in files in directory
std::vector<string> files; // Add names to list as reading them in
for(const auto & entry : fs::directory_iterator(location))
files.emplace_back(entry.path());
// Read in data from files
for(int i = 0; i < files.size(); i++){
cout << "Files of I " << files[i] << endl;
const string& f = files[i];
size_t di = f.rfind(".");
string ext = f.substr(di);
transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
cout << "EXT: " << ext << endl;
if(ext == ".obj"){ // Read obj
// models.emplace_back(new Model(files[i]));
}else if (ext == ".mtl"){ // Read materials
// materials.emplace_back(new Material(files[i]));
}else{
cerr << "Unknown file in " << files[i] << endl;
}
}
}
Model
Prefab::
getModel(){
// for
}