@@ -625,24 +625,6 @@ SAssetBundle CPLYMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
625
625
// now to read the actual data from the file
626
626
using index_t = uint32_t ;
627
627
core::vector<index_t > indices = {};
628
- //
629
- auto createView = [](const E_FORMAT format, const size_t elCount)->ICPUPolygonGeometry ::SDataView
630
- {
631
- const auto stride = asset::getTexelOrBlockBytesize (format);
632
- auto buffer = ICPUBuffer::create ({stride*elCount});
633
- return {
634
- .composed = {
635
- .stride = stride,
636
- .format = format,
637
- .rangeFormat = IGeometryBase::getMatchingAABBFormat (format)
638
- },
639
- .src = {
640
- .offset = 0 ,
641
- .size = buffer->getSize (),
642
- .buffer = std::move (buffer)
643
- }
644
- };
645
- };
646
628
647
629
// loop through each of the elements
648
630
bool verticesProcessed = false ;
@@ -882,19 +864,11 @@ SAssetBundle CPLYMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
882
864
else
883
865
{
884
866
geometry->setIndexing (IPolygonGeometryBase::TriangleList ());
885
- auto buffer = ICPUBuffer::create ({{ indices.size ()* sizeof ( index_t ),IBuffer::EUF_INDEX_BUFFER_BIT}, indices.data ()} );
886
- hlsl::shapes::AABB< 4 , index_t > aabb;
867
+ auto view = IGeometryLoader::createView (EF_R32_UINT, indices.size (), indices.data ());
868
+ auto & aabb = view. composed . encodedDataRange . u32 ;
887
869
aabb.minVx [0 ] = *std::min_element (indices.begin (),indices.end ());
888
870
aabb.maxVx [0 ] = *std::max_element (indices.begin (),indices.end ());
889
- geometry->setIndexView ({
890
- .composed = {
891
- .encodedDataRange = {.u32 =aabb},
892
- .stride = sizeof (index_t ),
893
- .format = EF_R32_UINT,
894
- .rangeFormat = IGeometryBase::EAABBFormat::U32
895
- },
896
- .src = {.offset =0 ,.size =buffer->getSize (),.buffer =std::move (buffer)}
897
- });
871
+ geometry->setIndexView (std::move (view));
898
872
}
899
873
900
874
CPolygonGeometryManipulator::recomputeContentHashes (geometry.get ());
0 commit comments