diff --git a/MshViewer/Source/Object.cpp b/MshViewer/Source/Object.cpp index eddd393..e1fee88 100644 --- a/MshViewer/Source/Object.cpp +++ b/MshViewer/Source/Object.cpp @@ -131,6 +131,8 @@ void Object::analyseMsh2Chunks(std::list& chunkList) std::list tempMatdChunks; loadChunks(tempMatdChunks, (*it)->position, (*it)->size); + vTextures.push_back(""); + // analyse MATD subchunks analyseMatdChunks(tempMatdChunks); @@ -193,7 +195,7 @@ void Object::analyseMatdChunks(std::list& chunkList) char* buffer = new char[(*it)->size + 1]; *buffer = { 0 }; fsMesh.read(buffer, (*it)->size); - vTextures.push_back(buffer); + vTextures.back() = buffer; delete buffer; continue; } @@ -389,6 +391,8 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list& /*if (!strcmp("NRML", (*it)->name)) { fsMesh.seekg((*it)->position); + std::uint32_t tempSize; + fsMesh.read(reinterpret_cast(&tempSize), sizeof(tempSize)); // List of normals // long int - 4 - number of normal vectores stored in this list // float[3][] - 12 each - UVW vector for each vertex diff --git a/MshViewer/Source/OpenGlController.cpp b/MshViewer/Source/OpenGlController.cpp index 565f32d..9f70075 100644 --- a/MshViewer/Source/OpenGlController.cpp +++ b/MshViewer/Source/OpenGlController.cpp @@ -324,7 +324,7 @@ void OpenGLController::updateScene() { // give texture to the shader std::uint32_t tempTexIndex = segIt->textureIndex >= vTextures.size() ? vTextures.size() - 1 : segIt->textureIndex; - + glTexImage2D( GL_TEXTURE_2D, 0, diff --git a/MshViewer/main.cpp b/MshViewer/main.cpp index 4a166c9..680742b 100644 --- a/MshViewer/main.cpp +++ b/MshViewer/main.cpp @@ -17,7 +17,7 @@ int main(int argc, char** argv) else scene = OpenGLController::getInstance(); - scene->loadMsh("..\\Release\\Msh\\cluster.msh"); + scene->loadMsh("..\\Release\\Msh\\quadPoly.msh"); do { scene->updateScene(); diff --git a/Release/Msh/1.tga b/Release/Msh/1.tga new file mode 100644 index 0000000..59cc3e2 Binary files /dev/null and b/Release/Msh/1.tga differ diff --git a/Release/Msh/2.tga b/Release/Msh/2.tga new file mode 100644 index 0000000..6943c43 Binary files /dev/null and b/Release/Msh/2.tga differ diff --git a/Release/Msh/3.tga b/Release/Msh/3.tga new file mode 100644 index 0000000..9b18d52 Binary files /dev/null and b/Release/Msh/3.tga differ diff --git a/Release/Msh/4.tga b/Release/Msh/4.tga new file mode 100644 index 0000000..9d3ebf2 Binary files /dev/null and b/Release/Msh/4.tga differ diff --git a/Release/Msh/5.tga b/Release/Msh/5.tga new file mode 100644 index 0000000..670cdb8 Binary files /dev/null and b/Release/Msh/5.tga differ diff --git a/Release/Msh/6.tga b/Release/Msh/6.tga new file mode 100644 index 0000000..9a4b0d7 Binary files /dev/null and b/Release/Msh/6.tga differ diff --git a/Release/Msh/quadPoly.msh b/Release/Msh/quadPoly.msh new file mode 100644 index 0000000..8a29e0b Binary files /dev/null and b/Release/Msh/quadPoly.msh differ