Skip to content

Commit

Permalink
MeshLOD: fix not using CacheList when we should
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Feb 11, 2024
1 parent e898a8d commit 2c0bb33
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Components/MeshLodGenerator/src/OgreLodOutputProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,35 @@ namespace Ogre
assert(mTriangleCacheList[i].vertexID[0] != mTriangleCacheList[i].vertexID[1]);
assert(mTriangleCacheList[i].vertexID[1] != mTriangleCacheList[i].vertexID[2]);
assert(mTriangleCacheList[i].vertexID[2] != mTriangleCacheList[i].vertexID[0]);
writeTriangle(data, i);
if (data->mIndexBufferInfoList[data->mTriangleList[i].submeshID].indexSize == 2) {
for (unsigned int m : mTriangleCacheList[i].vertexID) {
*(data->mIndexBufferInfoList[data->mTriangleList[i].submeshID].buf.pshort++) =
static_cast<unsigned short>(m);
}
} else {
for (unsigned int m : mTriangleCacheList[i].vertexID) {
*(data->mIndexBufferInfoList[data->mTriangleList[i].submeshID].buf.pint++) =
static_cast<unsigned int>(m);
}
}
}
}
size_t lineCount = mLineCacheList.size();
for (size_t i = 0; i < lineCount; i++) {
if (mLineCacheList[i].vertexChanged) {
assert(data->mIndexBufferInfoList[data->mLineList[i].submeshID].prevIndexCount != 0);
assert(mLineCacheList[i].vertexID[0] != mLineCacheList[i].vertexID[1]);
writeLine(data, i);
if (data->mIndexBufferInfoList[data->mLineList[i].submeshID].indexSize == 2) {
for (unsigned int m : mLineCacheList[i].vertexID) {
*(data->mIndexBufferInfoList[data->mLineList[i].submeshID].buf.pshort++) =
static_cast<uint16>(m);
}
} else {
for (unsigned int m : mLineCacheList[i].vertexID) {
*(data->mIndexBufferInfoList[data->mLineList[i].submeshID].buf.pint++) =
static_cast<uint32>(m);
}
}
}
}

Expand Down

0 comments on commit 2c0bb33

Please sign in to comment.