diff options
author | Mateja <mail@matejamaric.com> | 2020-12-27 00:09:34 +0100 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2020-12-27 00:09:34 +0100 |
commit | 0a2da4f82435a49212e276d9d603e84ac298246d (patch) | |
tree | 1fea3b94712df18d1229f4f3492b540c90f6f302 /source/ObjModel.cpp | |
parent | a84debff887c3e3d930665db140b7a287d3879d4 (diff) | |
download | erender-0a2da4f82435a49212e276d9d603e84ac298246d.tar.gz erender-0a2da4f82435a49212e276d9d603e84ac298246d.zip |
Reorganize entire project.
Diffstat (limited to 'source/ObjModel.cpp')
-rw-r--r-- | source/ObjModel.cpp | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/source/ObjModel.cpp b/source/ObjModel.cpp deleted file mode 100644 index f23cfc3..0000000 --- a/source/ObjModel.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "ObjModel.h"
-
-
-
-ObjModel::ObjModel() {}
-
-ObjModel::ObjModel(std::string fileName)
-{
- int hlp = 0;
- std::ifstream f(fileName);
- std::string s0;
- while (getline(f, s0)) {
- std::stringstream ss0(s0);
- std::string s1 = "";
- ss0 >> s1;
- if (s1.compare(0, s1.length(), "v") == 0) {
- ss0 >> s1;
- float x = std::stof(s1);
- ss0 >> s1;
- float y = std::stof(s1);
- ss0 >> s1;
- float z = std::stof(s1);
- Vertice t(x, y, z, 1.0f, 0.0f, 0.0f);
- vertices.push_back(t);
- }
- else if (s1.compare(0, s1.length(), "vn") == 0) {
- ss0 >> s1;
- float x = std::stof(s1);
- ss0 >> s1;
- float y = std::stof(s1);
- ss0 >> s1;
- float z = std::stof(s1);
- Vector4f v(x, y, z, 0.0f);
- normals.push_back(v);
- }
- else if (s1.compare(0, s1.length(), "vt") == 0) {
- ss0 >> s1;
- float u = std::stof(s1);
- ss0 >> s1;
- float v = std::stof(s1);
- Texture_Coordinates kt;
- kt.u = u; kt.v = v;
- uvcoo.push_back(kt);
- }
- else if (s1.compare(0, s1.length(), "f") == 0) {
- Triangle pt;
- for (int i = 0; i < 3; i++) {
- ss0 >> s1;
- std::stringstream ss1(s1);
- std::string s2;
- for (int j = 0; std::getline(ss1, s2, '/'); j++) {
- pt.p[i][j] = std::stoi(s2);
- }
- }
- faces.push_back(pt);
- }
- }
-
-}
-
-ObjModel::ObjModel(const ObjModel& a)
-{
- vertices = a.vertices;
- uvcoo = a.uvcoo;
- normals = a.normals;
- faces = a.faces;
-}
-
-ObjModel ObjModel::multiplyMatrix(Matrix4f& a)
-{
- ObjModel hlp = *this;
- for (int i = 0; i < vertices.size(); i++)
- {
- hlp.vertices[i] = hlp.vertices[i].multiplyMatrix(a);
- }
- return hlp;
-}
-
-void ObjModel::divideW()
-{
- for (int i = 0; i < vertices.size(); i++)
- {
- vertices[i] = vertices[i].divideW();
- }
-}
-
-void ObjModel::screenspace(int width, int height)
-{
- for (int i = 0; i < vertices.size(); i++)
- {
- vertices[i].screenspace(width, height);
- }
-}
|