Skip to content

Mesh loaders kevin #894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
40 changes: 21 additions & 19 deletions include/nbl/asset/IPolygonGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,26 @@ class IPolygonGeometry : public IIndexableGeometry<BufferType>, public IPolygonG
// For User defined semantics
inline const core::vector<SDataView>& getAuxAttributeViews() const {return m_auxAttributeViews;}

inline E_INDEX_TYPE getIndexType() const
{
auto indexType = EIT_UNKNOWN;
// disallowed index format
if (base_t::m_indexView)
{
switch (base_t::m_indexView.composed.format)
{
case EF_R16_UINT:
indexType = EIT_16BIT;
break;
case EF_R32_UINT: [[fallthrough]];
indexType = EIT_32BIT;
break;
default:
break;
}
}
return indexType;
}

// Does not set the `transform` or `geometryFlags` fields, because it doesn't care about it.
// Also won't set second set of vertex data, opacity mipmaps, etc.
Expand All @@ -212,30 +232,12 @@ class IPolygonGeometry : public IIndexableGeometry<BufferType>, public IPolygonG
// must be a triangle list, but don't want to compare pointers
if (m_indexing && m_indexing->knownTopology()==EPT_TRIANGLE_LIST)// && m_indexing->degree() == TriangleList()->degree() && m_indexing->rate() == TriangleList->rate())
{
auto indexType = EIT_UNKNOWN;
// disallowed index format
if (base_t::m_indexView)
{
switch (base_t::m_indexView.composed.format)
{
case EF_R16_UINT:
indexType = EIT_16BIT;
break;
case EF_R32_UINT: [[fallthrough]];
indexType = EIT_32BIT;
break;
default:
break;
}
if (indexType==EIT_UNKNOWN)
return retval;
}
retval.vertexData[0] = base_t::m_positionView.src;
retval.indexData = base_t::m_indexView.src;
retval.maxVertex = base_t::m_positionView.getElementCount() - 1;
retval.vertexStride = base_t::m_positionView.composed.getStride();
retval.vertexFormat = base_t::m_positionView.composed.format;
retval.indexType = indexType;
retval.indexType = getIndexType();
}
return retval;
}
Expand Down
Loading
Loading