From ff4fe0c97b2ae881c328f346742193d1cfd1553e Mon Sep 17 00:00:00 2001 From: Peter Schaefer Date: Sat, 25 Apr 2015 19:16:04 +0200 Subject: [PATCH] fixed transform dataType moved modelMat to IMesh --- Weave/Graphix/Model/IMesh.cpp | 4 +--- Weave/Graphix/Model/IMesh.h | 4 +++- Weave/Graphix/Model/IMetaMesh.cpp | 4 ++-- Weave/Graphix/Model/Model.h | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Weave/Graphix/Model/IMesh.cpp b/Weave/Graphix/Model/IMesh.cpp index ef7bb2f..e7fabee 100644 --- a/Weave/Graphix/Model/IMesh.cpp +++ b/Weave/Graphix/Model/IMesh.cpp @@ -32,7 +32,7 @@ IMesh::IMesh(const string& _modelpath, uint _mindex) } -IMesh::IMesh(const aiMesh* _mesh, mat4* transformation) +IMesh::IMesh(const aiMesh* _mesh, const mat4& _transformation) : modelMat(_transformation) { float *vertex = nullptr, *normals = nullptr, *uvs = nullptr; @@ -40,8 +40,6 @@ IMesh::IMesh(const aiMesh* _mesh, mat4* transformation) import(_mesh, numvertices, numfaces, vertex, uvs, normals, index); - modelMat = *transformation; - updateBB(vertex); genBuffer(vertexBuffer, numvertices * 3 * sizeof(float), (void*)vertex); diff --git a/Weave/Graphix/Model/IMesh.h b/Weave/Graphix/Model/IMesh.h index bf63286..51117f9 100644 --- a/Weave/Graphix/Model/IMesh.h +++ b/Weave/Graphix/Model/IMesh.h @@ -15,7 +15,7 @@ class IMesh : public Model { public: IMesh(const string& modelpath, uint index=0); - IMesh(const aiMesh* mesh, mat4* transformation); + IMesh(const aiMesh* mesh, const mat4& transformation); virtual ~IMesh(); @@ -27,6 +27,8 @@ public: protected: + mat4 modelMat; + // Mesh Speichern? bool import(const string& modelpath, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index , uint mindex = 0) const; bool import(const aiMesh* mesh, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index) const; diff --git a/Weave/Graphix/Model/IMetaMesh.cpp b/Weave/Graphix/Model/IMetaMesh.cpp index 9f4c84a..921189a 100644 --- a/Weave/Graphix/Model/IMetaMesh.cpp +++ b/Weave/Graphix/Model/IMetaMesh.cpp @@ -32,7 +32,7 @@ IMetaMesh::IMetaMesh(const string& _modelpath) tmpModelMat = mat4(aimat->a1, aimat->c1, -aimat->b1, aimat->d1, aimat->a2, aimat->c2, -aimat->b2, aimat->d2, aimat->a3, aimat->c3, -aimat->b3, aimat->d3, aimat->a4, aimat->c4, -aimat->b4, aimat->d4); - tmpIMesh = new IMesh(scene->mMeshes[0], &tmpModelMat); + tmpIMesh = new IMesh(scene->mMeshes[0], tmpModelMat); models.push_back(tmpIMesh); tmpIMesh->getBBmm(BBmin, BBmax); @@ -42,7 +42,7 @@ IMetaMesh::IMetaMesh(const string& _modelpath) tmpModelMat = mat4(aimat->a1, aimat->c1, -aimat->b1, aimat->d1, aimat->a2, aimat->c2, -aimat->b2, aimat->d2, aimat->a3, aimat->c3, -aimat->b3, aimat->d3, aimat->a4, aimat->c4, -aimat->b4, aimat->d4); - tmpIMesh = new IMesh(scene->mMeshes[i], &tmpModelMat); + tmpIMesh = new IMesh(scene->mMeshes[i], tmpModelMat); models.push_back(tmpIMesh); tmpIMesh->getBBmm(tmpMin, tmpMax); for (auto j = 0; j < 3; ++j) diff --git a/Weave/Graphix/Model/Model.h b/Weave/Graphix/Model/Model.h index ea2a4a8..ea5645e 100644 --- a/Weave/Graphix/Model/Model.h +++ b/Weave/Graphix/Model/Model.h @@ -29,7 +29,6 @@ public: protected: uint numvertices, numfaces; uint vertexBuffer, indexBuffer, normalBuffer, uvBuffer; - mat4 modelMat; std::unordered_map shader_map; -- 2.47.3