[152] | 1 | --- a/OgreMain/include/OgreProgressiveMeshGenerator.h 2015-09-03 04:58:34.119585218 +0200 |
---|
| 2 | +++ b/OgreMain/include/OgreProgressiveMeshGenerator.h 2015-09-03 04:58:39.342585320 +0200 |
---|
| 3 | @@ -215,7 +215,40 @@ |
---|
| 4 | void tuneContainerSize(); |
---|
| 5 | void addVertexData(VertexData* vertexData, bool useSharedVertexLookup); |
---|
| 6 | template<typename IndexType> |
---|
| 7 | - void addIndexDataImpl(IndexType* iPos, const IndexType* iEnd, VertexLookupList& lookup, unsigned short submeshID); |
---|
| 8 | + void addIndexDataImpl(IndexType* iPos, const IndexType* iEnd, VertexLookupList& lookup, unsigned short submeshID) |
---|
| 9 | + { |
---|
| 10 | + |
---|
| 11 | + // Loop through all triangles and connect them to the vertices. |
---|
| 12 | + for (; iPos < iEnd; iPos += 3) { |
---|
| 13 | + // It should never reallocate or every pointer will be invalid. |
---|
| 14 | + OgreAssert(mTriangleList.capacity() > mTriangleList.size(), ""); |
---|
| 15 | + mTriangleList.push_back(PMTriangle()); |
---|
| 16 | + PMTriangle* tri = &mTriangleList.back(); |
---|
| 17 | + tri->isRemoved = false; |
---|
| 18 | + tri->submeshID = submeshID; |
---|
| 19 | + for (int i = 0; i < 3; i++) { |
---|
| 20 | + // Invalid index: Index is bigger then vertex buffer size. |
---|
| 21 | + OgreAssert(iPos[i] < lookup.size(), ""); |
---|
| 22 | + tri->vertexID[i] = iPos[i]; |
---|
| 23 | + tri->vertex[i] = lookup[iPos[i]]; |
---|
| 24 | + } |
---|
| 25 | + if (tri->isMalformed()) { |
---|
| 26 | +#if OGRE_DEBUG_MODE |
---|
| 27 | + stringstream str; |
---|
| 28 | + str << "In " << mMeshName << " malformed triangle found with ID: " << getTriangleID(tri) << ". " << |
---|
| 29 | + std::endl; |
---|
| 30 | + printTriangle(tri, str); |
---|
| 31 | + str << "It will be excluded from LOD level calculations."; |
---|
| 32 | + LogManager::getSingleton().stream() << str.str(); |
---|
| 33 | +#endif |
---|
| 34 | + tri->isRemoved = true; |
---|
| 35 | + mIndexBufferInfoList[tri->submeshID].indexCount -= 3; |
---|
| 36 | + continue; |
---|
| 37 | + } |
---|
| 38 | + tri->computeNormal(); |
---|
| 39 | + addTriangleToEdges(tri); |
---|
| 40 | + } |
---|
| 41 | + } |
---|
| 42 | void addIndexData(IndexData* indexData, bool useSharedVertexLookup, unsigned short submeshID); |
---|
| 43 | |
---|
| 44 | void computeCosts(); |
---|
| 45 | --- a/OgreMain/src/OgreProgressiveMeshGenerator.cpp 2015-09-03 04:58:34.879585233 +0200 |
---|
| 46 | +++ b/OgreMain/src/OgreProgressiveMeshGenerator.cpp 2015-09-03 04:58:43.944585409 +0200 |
---|
| 47 | @@ -219,6 +219,8 @@ |
---|
| 48 | } |
---|
| 49 | vbuf->unlock(); |
---|
| 50 | } |
---|
| 51 | +/// Called from OgreQueuedProgressiveMeshGenerator.cpp, so it can not be defined in here. |
---|
| 52 | +#if 0 |
---|
| 53 | template<typename IndexType> |
---|
| 54 | void ProgressiveMeshGenerator::addIndexDataImpl(IndexType* iPos, const IndexType* iEnd, |
---|
| 55 | VertexLookupList& lookup, |
---|
| 56 | @@ -256,6 +258,7 @@ |
---|
| 57 | addTriangleToEdges(tri); |
---|
| 58 | } |
---|
| 59 | } |
---|
| 60 | +#endif // 0 |
---|
| 61 | |
---|
| 62 | void ProgressiveMeshGenerator::addIndexData(IndexData* indexData, bool useSharedVertexLookup, unsigned short submeshID) |
---|
| 63 | { |
---|