Skip to content

Commit 11a2b9f

Browse files
author
devsh
committed
get all convenience utilities working with PLY Loader
1 parent c82f820 commit 11a2b9f

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

include/nbl/asset/interchange/IGeometryLoader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class IGeometryLoader : public IAssetLoader
6565
{
6666
assert(m_file);
6767
auto* const basePtr = reinterpret_cast<const uint8_t*>(m_file->getMappedPointer());
68-
assert(basePtr && basePtr<=p && p<=basePtr+file->getSize());
68+
assert(basePtr && basePtr<=p && p<=basePtr+m_file->getSize());
6969
}
7070

7171
protected:

src/nbl/asset/interchange/CPLYMeshFileLoader.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,10 @@ SAssetBundle CPLYMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
856856
}
857857
}
858858

859+
// do before indices so we don't compute their stuff again
860+
CPolygonGeometryManipulator::recomputeContentHashes(geometry.get());
861+
CPolygonGeometryManipulator::recomputeRanges(geometry.get());
862+
859863
if (indices.empty())
860864
{
861865
// no index buffer means point cloud
@@ -865,15 +869,9 @@ SAssetBundle CPLYMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
865869
{
866870
geometry->setIndexing(IPolygonGeometryBase::TriangleList());
867871
auto view = IGeometryLoader::createView(EF_R32_UINT,indices.size(),indices.data());
868-
auto& aabb = view.composed.encodedDataRange.u32;
869-
aabb.minVx[0] = *std::min_element(indices.begin(),indices.end());
870-
aabb.maxVx[0] = *std::max_element(indices.begin(),indices.end());
871872
geometry->setIndexView(std::move(view));
872873
}
873874

874-
CPolygonGeometryManipulator::recomputeContentHashes(geometry.get());
875-
CPolygonGeometryManipulator::recomputeRanges(geometry.get());
876-
877875
auto meta = core::make_smart_refctd_ptr<CPLYMetadata>();
878876
return SAssetBundle(std::move(meta),{std::move(geometry)});
879877
}

0 commit comments

Comments
 (0)