Commit 60cc7bb5 authored by Anakin's avatar Anakin

fixed messed up textures of the cluster

parent 9abd2852
......@@ -131,6 +131,8 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
std::list<ChunkHeader*> tempMatdChunks;
loadChunks(tempMatdChunks, (*it)->position, (*it)->size);
vTextures.push_back("");
// analyse MATD subchunks
analyseMatdChunks(tempMatdChunks);
......@@ -193,7 +195,7 @@ void Object::analyseMatdChunks(std::list<ChunkHeader*>& 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<ChunkHeader*>&
/*if (!strcmp("NRML", (*it)->name))
{
fsMesh.seekg((*it)->position);
std::uint32_t tempSize;
fsMesh.read(reinterpret_cast<char*>(&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
......
......@@ -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,
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment