I think it would be very useful to add 'mBuildEdgesEnabled' flag into the SubMesh. This feature will allow us to include or exclude SubMesh from EdgeList during generation in the 'void Mesh::buildEdgeList(void)' method.
See the code bellow how it might be done:
OgreSubMesh.h:
Code: Select all
class _OgreExport SubMesh
{
.....................
bool isBuildEdgesEnabled(void) const { return mBuildEdgesEnabled; }
void setBuildEdgesEnabled(bool b);
protected:
/// Is Build Edges Enabled
bool mBuildEdgesEnabled;
......................
};
Code: Select all
void SubMesh::setBuildEdgesEnabled(bool b)
{
mBuildEdgesEnabled = b;
if(parent)
{
parent->freeEdgeList();
parent->setAutoBuildEdgeLists(true);
}
}
Code: Select all
void Mesh::buildEdgeList(void)
{
....................
// Prepare the builder using the submesh information
SubMeshList::iterator i, iend;
iend = mSubMeshList.end();
for (i = mSubMeshList.begin(); i != iend; ++i)
{
SubMesh* s = *i;
if (s->operationType != RenderOperation::OT_TRIANGLE_FAN &&
s->operationType != RenderOperation::OT_TRIANGLE_LIST &&
s->operationType != RenderOperation::OT_TRIANGLE_STRIP)
{
// Skip this submesh
continue;
}
if (s->useSharedVertices)
{
// Use shared vertex data, index as set 0
if (lodIndex == 0)
{
eb.addIndexData(s->indexData, 0, s->operationType);
}
else
{
eb.addIndexData(s->mLodFaceList[lodIndex-1], 0,
s->operationType);
}
}
else if(s->isBuildEdgesEnabled()) //can include/exclude for non shared vertices only
{
// own vertex data, add it and reference it directly
eb.addVertexData(s->vertexData);
if (lodIndex == 0)
{
// Base index data
eb.addIndexData(s->indexData, vertexSetCount++,
s->operationType);
}
else
{
// LOD index data
eb.addIndexData(s->mLodFaceList[lodIndex-1],
vertexSetCount++, s->operationType);
}
}
atLeastOneIndexSet = true;
}
....................
}