Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename IndexType>
- void addIndexDataImpl(IndexType* iPos, const IndexType* iEnd,
- VertexLookupList& lookup,
- unsigned short submeshID)
- {
- // Loop through all triangles and connect them to the vertices.
- for (; iPos < iEnd; iPos += 3) {
- // It should never reallocate or every pointer will be invalid.
- OgreAssert(mTriangleList.capacity() > mTriangleList.size(), "");
- mTriangleList.push_back(PMTriangle());
- PMTriangle* tri = &mTriangleList.back();
- tri->isRemoved = false;
- tri->submeshID = submeshID;
- for (int i = 0; i < 3; i++) {
- // Invalid index: Index is bigger then vertex buffer size.
- OgreAssert(iPos[i] < lookup.size(), "");
- tri->vertexID[i] = iPos[i];
- tri->vertex[i] = lookup[iPos[i]];
- }
- if (tri->isMalformed()) {
- #if OGRE_DEBUG_MODE
- stringstream str;
- str << "In " << mMeshName << " malformed triangle found with ID: " << getTriangleID(tri) << ". " <<
- std::endl;
- printTriangle(tri, str);
- str << "It will be excluded from LOD level calculations.";
- LogManager::getSingleton().stream() << str.str();
- #endif
- tri->isRemoved = true;
- mIndexBufferInfoList[tri->submeshID].indexCount -= 3;
- continue;
- }
- tri->computeNormal();
- addTriangleToEdges(tri);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement