Skip to content

Commit a5af142

Browse files
author
kevyuu
committed
Fix logic
1 parent 1c7d640 commit a5af142

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

include/nbl/asset/utils/CPolygonGeometryManipulator.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,20 @@ class NBL_API2 CPolygonGeometryManipulator
7272
{
7373
if (!geo->isSkinned()) return false;
7474
constexpr auto jointCountPerVertex = ICPUPolygonGeometry::SJointWeight::JOINT_COUNT_PER_VERTEX;
75-
for (auto& weightView : geo->getJointWeightViews())
75+
const auto jointViewCount = geo->getJointWeightViews().size();
76+
for (auto weightView_i = 0u; weightView_i < jointViewCount; weightView_i++)
7677
{
77-
for (auto weight_i = 0u; weight_i < jointCountPerVertex; weight_i++)
78-
{
79-
hlsl::vector<hlsl::float32_t, 1> weight;
80-
weightView.weights.decodeElement(jointCountPerVertex * vertex_i + weight_i, weight);
81-
if (weight.x != 0.f) return true;
82-
}
78+
const auto& weightView = geo->getJointWeightViews()[weightView_i];
79+
hlsl::float32_t4 weight;
80+
weightView.weights.decodeElement(vertex_i, weight);
81+
if (weightView_i == jointViewCount - 1)
82+
{
83+
for (auto channel_i = 0; channel_i < getFormatChannelCount(weightView.weights.composed.format); channel_i++)
84+
if (weight[channel_i] > 0.f)
85+
return true;
86+
}
87+
else if (hlsl::any(lessThan(hlsl::promote<hlsl::float32_t4>(0.f), weight)))
88+
return true;
8389
}
8490
return false;
8591
};

0 commit comments

Comments
 (0)