Commit f4d8018f authored by Anakin's avatar Anakin

workaround: don't read Data from bones, nulls, shadow and hidden,

new implementation of segm read strp to not only read triangles,
needs to be included in the buffer fill function/draw function
parent 806024f4
......@@ -420,11 +420,17 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
if (!strcmp("STRP", (*it)->name))
{
fsMesh.seekg((*it)->position);
// 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)
......@@ -447,6 +453,67 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
continue;
}
/////////////////////////////////////////////////////////////////////////////////////////
/////DEV ZONE
if (!strcmp("STRP", (*it)->name))
{
// this needs to be a member
std::vector<std::vector<std::uint32_t>*> tempVector;
// jump to the data section and read the size;
fsMesh.seekg((*it)->position);
fsMesh.read(reinterpret_cast<char*>(&tempData->meshSize), sizeof(tempData->meshSize));
int highBitCount(0);
std::vector<uint32_t>* tempPoly = new std::vector<uint32_t>;
for (unsigned int i = 0; i < tempData->meshSize; i++)
{
// ReadData
std::uint16_t tempValue;
fsMesh.read(reinterpret_cast<char*>(&tempValue), sizeof(std::uint16_t));
// Check for highbit
if (tempValue >> 15)
{
highBitCount++;
tempValue = (std::uint16_t(tempValue << 1) >> 1);
}
tempPoly->push_back((std::uint32_t)tempValue);
if (highBitCount == 2)
{
// reset highBitCount
highBitCount == 0;
// remove the last two values..
std::uint32_t saveData[2];
for (int i = 0; i < 2; i++)
{
saveData[0] = tempPoly->back();
tempPoly->pop_back();
}
// ..and save them in the new vector
std::vector<uint32_t>* newPointer = new std::vector<uint32_t>;
for (int i = 1; i >= 0; i--)
newPointer->push_back(saveData[i]);
// save the old vector and set the pointer to the new one
tempVector.push_back(tempPoly);
tempPoly = newPointer;
} // if high bit set
} // for all values
// save the last values (where no 2 high bits follow);
tempVector.push_back(tempPoly);
continue;
}
////////////////////////////////////////////////////////////////////////////////////////
}
dataDestination->segmLst.push_back(tempData);
}
......
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