}
-IMesh::IMesh(const aiMesh* _mesh, mat4* transformation)
+IMesh::IMesh(const aiMesh* _mesh, const mat4& _transformation) : modelMat(_transformation)
{
float *vertex = nullptr, *normals = nullptr, *uvs = nullptr;
import(_mesh, numvertices, numfaces, vertex, uvs, normals, index);
- modelMat = *transformation;
-
updateBB(vertex);
genBuffer(vertexBuffer, numvertices * 3 * sizeof(float), (void*)vertex);
{
public:
IMesh(const string& modelpath, uint index=0);
- IMesh(const aiMesh* mesh, mat4* transformation);
+ IMesh(const aiMesh* mesh, const mat4& transformation);
virtual ~IMesh();
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;
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);
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)