-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModel.cpp
39 lines (33 loc) · 1.1 KB
/
Model.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
#include "Model.h"
#include "ObjReader.h"
#include <iostream>
void Model::printModel()
{
std::cout << "Model stats: " << std::endl;
for (const Model::Vertex& v : this->vertexData)
{
std::cout << "vertex" << std::endl;
std::cout << "positions: " << v.posX << ' ' << v.posY << ' ' << v.posZ << std::endl;
std::cout << "normals: " << v.normX << ' ' << v.normY << ' ' << v.normZ << std::endl;
std::cout << "texture coords: " << v.teX << ' ' << v.teY << std::endl;
}
std::cout << "total vertices: " << this->vertexData.size() << std::endl;
for (unsigned int i = 0; i < this->indexData.size(); i += 3)
{
std::cout << "triangle" << std::endl;
std::cout << this->indexData[i] << ' ' << this->indexData[i + 1] << ' ' << this->indexData[i + 2] << std::endl;
}
std::cout << "total triangles: " << this->indexData.size() / 3 << std::endl;
}
void Model::loadModel(std::string sourcePath)
{
ObjReader::readVerticesObj(this, sourcePath);
loaded = true;
}
Model::Model(std::string sourcePath)
{
loadModel(sourcePath);
}
Model::Model(std::vector<Vertex>* verticesPtr)
{
}