@@ -235,23 +235,23 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CSmoothNormalGenerator::processConne
235235 static constexpr auto NormalFormat = EF_R32G32B32_SFLOAT;
236236 const auto normalFormatBytesize = asset::getTexelOrBlockBytesize (NormalFormat);
237237 auto normalBuf = ICPUBuffer::create ({ normalFormatBytesize * outPolygon->getPositionView ().getElementCount ()});
238- auto normalView = polygon->getNormalView ();
239238
240239 hlsl::shapes::AABB<4 ,hlsl::float32_t > aabb;
241240 aabb.maxVx = hlsl::float32_t4 (1 , 1 , 1 , 0 .f );
242241 aabb.minVx = -aabb.maxVx ;
243242 outPolygon->setNormalView ({
244- .composed = {
245- .encodedDataRange = {.f32 = aabb},
246- .stride = sizeof (hlsl::float32_t3),
247- .format = NormalFormat,
248- .rangeFormat = IGeometryBase::EAABBFormat::F32
249- },
250- .src = { .offset = 0 , .size = normalBuf->getSize (), .buffer = std::move (normalBuf) },
243+ .composed = {
244+ .encodedDataRange = {.f32 = aabb},
245+ .stride = sizeof (hlsl::float32_t3),
246+ .format = NormalFormat,
247+ .rangeFormat = IGeometryBase::EAABBFormat::F32
248+ },
249+ .src = { .offset = 0 , .size = normalBuf->getSize (), .buffer = std::move (normalBuf) }
251250 });
252251
253252 auto * normalPtr = reinterpret_cast <std::byte*>(outPolygon->getNormalAccessor ().getPointer ());
254- auto normalStride = outPolygon->getNormalView ().composed .stride ;
253+ constexpr auto normalStride = sizeof (hlsl::float32_t3);
254+ assert (outPolygon->getNormalView ().composed .stride ==normalStride);
255255
256256 for (uint32_t cell = 0 ; cell < vertexHashMap.getBucketCount () - 1 ; cell++)
257257 {
@@ -350,10 +350,10 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CSmoothNormalGenerator::weldVertices
350350 core::vector<std::optional<uint32_t >> groupIndexes (vertices.getVertexCount ());
351351
352352 auto canJoinVertices = [&](uint32_t index1, uint32_t index2)-> bool
353- {
354- if (!isAttributeEqual (polygon->getPositionView (), index1, index2, epsilon))
353+ {
354+ if (!isAttributeEqual (polygon->getPositionView (), index1, index2, epsilon))
355355 return false ;
356- if (!isAttributeEqual (polygon->getNormalView (), index1, index2, epsilon))
356+ if (!isAttributeEqual (polygon->getNormalView (), index1, index2, epsilon))
357357 return false ;
358358 for (const auto & jointWeightView : polygon->getJointWeightViews ())
359359 {
@@ -364,7 +364,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CSmoothNormalGenerator::weldVertices
364364 if (!isAttributeEqual (auxAttributeView, index1, index2, epsilon)) return false ;
365365
366366 return true ;
367- };
367+ };
368368
369369 for (uint32_t cell = 0 ; cell < vertices.getBucketCount () - 1 ; cell++)
370370 {
@@ -373,7 +373,6 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CSmoothNormalGenerator::weldVertices
373373 for (core::vector<CPolygonGeometryManipulator::SSNGVertexData>::iterator processedVertex = processedBucket.begin ; processedVertex != processedBucket.end ; processedVertex++)
374374 {
375375 std::array<uint32_t , 8 > neighboringCells = vertices.getNeighboringCellHashes (*processedVertex);
376- hlsl::float32_t3 normal = processedVertex->parentTriangleFaceNormal * processedVertex->wage ;
377376
378377 auto & groupIndex = groupIndexes[processedVertex->index ];
379378
0 commit comments