fixed messed up textures of the cluster

This commit is contained in:
Anakin 2016-11-21 15:02:33 +01:00
parent 9abd285239
commit 60cc7bb562
10 changed files with 7 additions and 3 deletions

View File

@ -131,6 +131,8 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
std::list<ChunkHeader*> tempMatdChunks; std::list<ChunkHeader*> tempMatdChunks;
loadChunks(tempMatdChunks, (*it)->position, (*it)->size); loadChunks(tempMatdChunks, (*it)->position, (*it)->size);
vTextures.push_back("");
// analyse MATD subchunks // analyse MATD subchunks
analyseMatdChunks(tempMatdChunks); analyseMatdChunks(tempMatdChunks);
@ -193,7 +195,7 @@ void Object::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
char* buffer = new char[(*it)->size + 1]; char* buffer = new char[(*it)->size + 1];
*buffer = { 0 }; *buffer = { 0 };
fsMesh.read(buffer, (*it)->size); fsMesh.read(buffer, (*it)->size);
vTextures.push_back(buffer); vTextures.back() = buffer;
delete buffer; delete buffer;
continue; continue;
} }
@ -389,6 +391,8 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
/*if (!strcmp("NRML", (*it)->name)) /*if (!strcmp("NRML", (*it)->name))
{ {
fsMesh.seekg((*it)->position); fsMesh.seekg((*it)->position);
std::uint32_t tempSize;
fsMesh.read(reinterpret_cast<char*>(&tempSize), sizeof(tempSize));
// List of normals // List of normals
// long int - 4 - number of normal vectores stored in this list // long int - 4 - number of normal vectores stored in this list
// float[3][] - 12 each - UVW vector for each vertex // float[3][] - 12 each - UVW vector for each vertex

View File

@ -324,7 +324,7 @@ void OpenGLController::updateScene()
{ {
// give texture to the shader // give texture to the shader
std::uint32_t tempTexIndex = segIt->textureIndex >= vTextures.size() ? vTextures.size() - 1 : segIt->textureIndex; std::uint32_t tempTexIndex = segIt->textureIndex >= vTextures.size() ? vTextures.size() - 1 : segIt->textureIndex;
glTexImage2D( glTexImage2D(
GL_TEXTURE_2D, GL_TEXTURE_2D,
0, 0,

View File

@ -17,7 +17,7 @@ int main(int argc, char** argv)
else else
scene = OpenGLController::getInstance(); scene = OpenGLController::getInstance();
scene->loadMsh("..\\Release\\Msh\\cluster.msh"); scene->loadMsh("..\\Release\\Msh\\quadPoly.msh");
do { do {
scene->updateScene(); scene->updateScene();

BIN
Release/Msh/1.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
Release/Msh/2.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
Release/Msh/3.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
Release/Msh/4.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
Release/Msh/5.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
Release/Msh/6.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
Release/Msh/quadPoly.msh Normal file

Binary file not shown.