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 7 commits into
base: mesh_loaders
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 2 additions & 5 deletions include/nbl/asset/utils/CGeometryCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class NBL_API2 CGeometryCreator final : public core::IReferenceCounted
core::smart_refctd_ptr<ICPUPolygonGeometry> createArrow(const uint32_t tesselationCylinder = 4,
const uint32_t tesselationCone = 8, const float height = 1.f,
const float cylinderHeight = 0.6f, const float widthCylinder = 0.05f,
const float widthCone = 0.3f, const video::SColor colorCylinder = 0xFFFFFFFF,
const video::SColor colorCone = 0xFFFFFFFF) const;
const float widthCone = 0.3f) const;


//! Create a sphere mesh.
Expand All @@ -87,7 +86,7 @@ class NBL_API2 CGeometryCreator final : public core::IReferenceCounted
*/
core::smart_refctd_ptr<ICPUPolygonGeometry> createCylinder(float radius, float length,
uint32_t tesselation,
const video::SColor& color=video::SColor(0xffffffff), CQuantNormalCache* const quantNormalCacheOverride=nullptr) const;
CQuantNormalCache* const quantNormalCacheOverride=nullptr) const;

//! Create a cone mesh.
/**
Expand All @@ -100,8 +99,6 @@ class NBL_API2 CGeometryCreator final : public core::IReferenceCounted
\return Generated mesh.
*/
core::smart_refctd_ptr<ICPUPolygonGeometry> createCone(float radius, float length, uint32_t tesselation,
const video::SColor& colorTop=video::SColor(0xffffffff),
const video::SColor& colorBottom=video::SColor(0xffffffff),
float oblique=0.f, CQuantNormalCache* const quantNormalCacheOverride=nullptr) const;

core::smart_refctd_ptr<ICPUPolygonGeometry> createRectangle(const hlsl::float32_t2 size={0.5f,0.5f}) const;
Expand Down
Loading
Loading