Lines 215-221
Link Here
|
215 |
void tuneContainerSize(); |
215 |
void tuneContainerSize(); |
216 |
void addVertexData(VertexData* vertexData, bool useSharedVertexLookup); |
216 |
void addVertexData(VertexData* vertexData, bool useSharedVertexLookup); |
217 |
template<typename IndexType> |
217 |
template<typename IndexType> |
218 |
void addIndexDataImpl(IndexType* iPos, const IndexType* iEnd, VertexLookupList& lookup, unsigned short submeshID); |
218 |
void addIndexDataImpl(IndexType* iPos, const IndexType* iEnd, VertexLookupList& lookup, unsigned short submeshID) |
|
|
219 |
{ |
220 |
|
221 |
// Loop through all triangles and connect them to the vertices. |
222 |
for (; iPos < iEnd; iPos += 3) { |
223 |
// It should never reallocate or every pointer will be invalid. |
224 |
OgreAssert(mTriangleList.capacity() > mTriangleList.size(), ""); |
225 |
mTriangleList.push_back(PMTriangle()); |
226 |
PMTriangle* tri = &mTriangleList.back(); |
227 |
tri->isRemoved = false; |
228 |
tri->submeshID = submeshID; |
229 |
for (int i = 0; i < 3; i++) { |
230 |
// Invalid index: Index is bigger then vertex buffer size. |
231 |
OgreAssert(iPos[i] < lookup.size(), ""); |
232 |
tri->vertexID[i] = iPos[i]; |
233 |
tri->vertex[i] = lookup[iPos[i]]; |
234 |
} |
235 |
if (tri->isMalformed()) { |
236 |
#if OGRE_DEBUG_MODE |
237 |
stringstream str; |
238 |
str << "In " << mMeshName << " malformed triangle found with ID: " << getTriangleID(tri) << ". " << |
239 |
std::endl; |
240 |
printTriangle(tri, str); |
241 |
str << "It will be excluded from LOD level calculations."; |
242 |
LogManager::getSingleton().stream() << str.str(); |
243 |
#endif |
244 |
tri->isRemoved = true; |
245 |
mIndexBufferInfoList[tri->submeshID].indexCount -= 3; |
246 |
continue; |
247 |
} |
248 |
tri->computeNormal(); |
249 |
addTriangleToEdges(tri); |
250 |
} |
251 |
} |
219 |
void addIndexData(IndexData* indexData, bool useSharedVertexLookup, unsigned short submeshID); |
252 |
void addIndexData(IndexData* indexData, bool useSharedVertexLookup, unsigned short submeshID); |
220 |
|
253 |
|
221 |
void computeCosts(); |
254 |
void computeCosts(); |