Fix calculation of bounding boxes for non-4 component attributes

* If we only have 3 or 2 components, set the remaining bounding box values to 0
  so they aren't set at +/- FLT_MAX.
This commit is contained in:
baldurk
2019-05-22 12:40:56 +01:00
parent dd77b8a2b6
commit 467dd5e808
+11 -2
View File
@@ -2318,8 +2318,17 @@ void BufferViewer::calcBoundingData(CalcBoundingBoxData &bbox)
for(int i = 0; i < s.columns.count(); i++)
{
minOutputList.push_back(FloatVector(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX));
maxOutputList.push_back(FloatVector(-FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX));
FloatVector maxvec(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX);
if(s.columns[i].format.compCount == 1)
maxvec.y = maxvec.z = maxvec.w = 0.0;
else if(s.columns[i].format.compCount == 2)
maxvec.z = maxvec.w = 0.0;
else if(s.columns[i].format.compCount == 3)
maxvec.w = 0.0;
minOutputList.push_back(maxvec);
maxOutputList.push_back(FloatVector(-maxvec.x, -maxvec.y, -maxvec.z, -maxvec.w));
}
QVector<CachedElData> cache;