cloth stores the data in vectors, too;

removed the old unused code
This commit is contained in:
Anakin
2016-11-20 13:09:02 +01:00
parent 9ac1a25954
commit f81f03353d
4 changed files with 23 additions and 91 deletions

View File

@@ -401,45 +401,6 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
continue;
}
/*if (!strcmp("STRP", (*it)->name))
{
// jump to the data section and read the size;
fsMesh.seekg((*it)->position);
fsMesh.read(reinterpret_cast<char*>(&tempData->meshSize), sizeof(tempData->meshSize));
// workaround: ignore everything except unhidden static/dynamic mesh
if (dataDestination->type == null ||
dataDestination->type == bone ||
dataDestination->type == shadowMesh ||
dataDestination->renderFlags == 1)
continue;
tempData->mesh = new std::uint32_t[tempData->meshSize];
for (unsigned int i = 0; i < tempData->meshSize; i += 3)
{
std::uint16_t tempValue[3];
fsMesh.read(reinterpret_cast<char*>(&tempValue[0]), sizeof(std::uint16_t));
fsMesh.read(reinterpret_cast<char*>(&tempValue[1]), sizeof(std::uint16_t));
fsMesh.read(reinterpret_cast<char*>(&tempValue[2]), sizeof(std::uint16_t));
if (!(tempValue[0] >> 15 && tempValue[1] >> 15 && !(tempValue[2] >> 15)))
throw std::invalid_argument("invalid file. go and triangulate!");
tempValue[0] = (std::uint16_t(tempValue[0] << 1) >> 1);
tempValue[1] = (std::uint16_t(tempValue[1] << 1) >> 1);
tempData->mesh[i] = (std::uint32_t)tempValue[0];
tempData->mesh[i + 1] = (std::uint32_t)tempValue[1];
tempData->mesh[i + 2] = (std::uint32_t)tempValue[2];
}
continue;
}*/
/////////////////////////////////////////////////////////////////////////////////////////
/////DEV ZONE
if (!strcmp("STRP", (*it)->name))
{
// don't get null, bone, shadowMesh and hidden mesh indices
@@ -450,13 +411,14 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
continue;
// jump to the data section and read the size;
std::uint32_t tempSize;
fsMesh.seekg((*it)->position);
fsMesh.read(reinterpret_cast<char*>(&tempData->meshSize), sizeof(tempData->meshSize));
fsMesh.read(reinterpret_cast<char*>(&tempSize), sizeof(tempSize));
int highBitCount(0);
std::vector<uint32_t>* tempPoly = new std::vector<uint32_t>;
for (unsigned int i = 0; i < tempData->meshSize; i++)
for (unsigned int i = 0; i < tempSize; i++)
{
// ReadData
std::uint16_t tempValue;
@@ -504,8 +466,6 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
tempData->meshIndices.erase(tempData->meshIndices.begin());
continue;
}
////////////////////////////////////////////////////////////////////////////////////////
}
dataDestination->segmLst.push_back(tempData);
}
@@ -559,16 +519,26 @@ void Object::analyseClthChunks(Modl * dataDestination, std::list<ChunkHeader*>&
if (!strcmp("CMSH", (*it)->name))
{
// jump to the data section and read the size;
std::uint32_t tempSize;
fsMesh.seekg((*it)->position);
fsMesh.read(reinterpret_cast<char*>(&tempData->meshSize), sizeof(tempData->meshSize));
fsMesh.read(reinterpret_cast<char*>(&tempSize), sizeof(tempSize));
tempData->mesh = new std::uint32_t[tempData->meshSize * 3];
std::vector<uint32_t>* tempPoly;
for (unsigned int i = 0; i < tempData->meshSize; i += 3)
// for every triangle..
for (unsigned int i = 0; i < tempSize; i += 3)
{
fsMesh.read(reinterpret_cast<char*>(&tempData->mesh[i]), sizeof(std::uint32_t));
fsMesh.read(reinterpret_cast<char*>(&tempData->mesh[i + 1]), sizeof(std::uint32_t));
fsMesh.read(reinterpret_cast<char*>(&tempData->mesh[i + 2]), sizeof(std::uint32_t));
tempPoly = new std::vector<uint32_t>;
// ..get the 3 indices and save them
for (int j = 0; j < 3; j++)
{
std::uint32_t tempValue;
fsMesh.read(reinterpret_cast<char*>(&tempValue), sizeof(std::uint32_t));
tempPoly->push_back(tempValue);
}
tempData->meshIndices.push_back(tempPoly);
}
continue;
}