diff --git a/MshViewer/Source/Object.cpp b/MshViewer/Source/Object.cpp index 316c74b..2be66c8 100644 --- a/MshViewer/Source/Object.cpp +++ b/MshViewer/Source/Object.cpp @@ -444,25 +444,9 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list& 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(&dataDestination->vertex[i + 1]), sizeof(float)); fsMesh.read(reinterpret_cast(&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(&dataDestination->uv[i]), sizeof(float)); fsMesh.read(reinterpret_cast(&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 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]); } } diff --git a/MshViewer/main.cpp b/MshViewer/main.cpp index fb2fff4..0b9541c 100644 --- a/MshViewer/main.cpp +++ b/MshViewer/main.cpp @@ -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) { diff --git a/Release/Msh/cubeTex.msh b/Release/Msh/cubeTex.msh index c5ebab9..0b22fdb 100644 Binary files a/Release/Msh/cubeTex.msh and b/Release/Msh/cubeTex.msh differ