texture now is correctly displayed

This commit is contained in:
Anakin 2016-10-23 15:38:47 +02:00
parent 4f52510ff9
commit 6d5489a96c
3 changed files with 4 additions and 30 deletions

View File

@ -444,25 +444,9 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
dataDestination->mesh[i] = (std::uint32_t)tempValue[0];
dataDestination->mesh[i + 1] = (std::uint32_t)tempValue[1];
dataDestination->mesh[i + 2] = (std::uint32_t)tempValue[2];
}
std::cout << "triangles: " << dataDestination->meshSize << std::endl;
for (int i = 0; i < dataDestination->meshSize; i += 3)
std::cout << dataDestination->mesh[i] << " <> " << dataDestination->mesh[i + 1] << " <> " << dataDestination->mesh[i + 2] << std::endl;
continue;
/*
List of triangles strips. The start of a strip is indicated by 2 entries
with a high bit set (0x8000 or 32768 added). Triangles are listed CW, CCW,
CW, CCW... NOTE: In some meshes this chunk has a trailing short which is not
calculated into the length/size of this chunk or the # of indices. This
short can be ignored. If added to the last polygon it will break it as it
always seems to be 0.
long int - 4 - number of indicies into POSL
short int[] - 2 each - index into POSL the indices will form polygons
*/
}
}
}
@ -527,12 +511,6 @@ void Object::readVertex(Modl* dataDestination, std::streampos position)
fsMesh.read(reinterpret_cast<char*>(&dataDestination->vertex[i + 1]), sizeof(float));
fsMesh.read(reinterpret_cast<char*>(&dataDestination->vertex[i + 2]), sizeof(float));
}
std::cout << "Vertex number: " << tempSize << std::endl;
for (int i = 0; i < tempSize * 3; i += 3)
std::cout << dataDestination->vertex[i] << " <> " << dataDestination->vertex[i + 1] << " <> " << dataDestination->vertex[i + 2] << std::endl;
}
void Object::readUV(Modl* dataDestination, std::streampos position)
@ -543,16 +521,11 @@ void Object::readUV(Modl* dataDestination, std::streampos position)
dataDestination->uv = new float[tempSize * 2];
for (unsigned int i = 0; i < tempSize; i += 2)
for (unsigned int i = 0; i < tempSize * 2; i += 2)
{
fsMesh.read(reinterpret_cast<char*>(&dataDestination->uv[i]), sizeof(float));
fsMesh.read(reinterpret_cast<char*>(&dataDestination->uv[i + 1]), sizeof(float));
}
std::cout << "UV" << std::endl;
for (int i = 0; i < dataDestination->meshSize; i += 3)
std::cout << dataDestination->mesh[i] << " - " << dataDestination->mesh[i + 1] << " - " << dataDestination->mesh[i + 2] << std::endl;
}
@ -590,7 +563,8 @@ std::vector<GLfloat> Object::getUV() const
}
for (unsigned int i = 0; i < (*it)->meshSize; i++)
{
tempData.push_back((GLfloat)(*it)->uv[(*it)->mesh[i]]);
tempData.push_back((GLfloat)(*it)->uv[(*it)->mesh[i] * 2]);
tempData.push_back((GLfloat)(*it)->uv[(*it)->mesh[i] * 2 + 1]);
}
}

View File

@ -12,7 +12,7 @@ int main(int argc, char** argv)
goto openGL;
try {
Object obj("..\\Release\\Msh\\cube.msh");
Object obj("..\\Release\\Msh\\cubeTex.msh");
}
catch (std::invalid_argument e)
{

Binary file not shown.