本文整理汇总了C++中Mapping::invalid方法的典型用法代码示例。如果您正苦于以下问题:C++ Mapping::invalid方法的具体用法?C++ Mapping::invalid怎么用?C++ Mapping::invalid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapping
的用法示例。
在下文中一共展示了Mapping::invalid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Split
__forceinline SpatialSplit::Split SpatialSplit::BinInfo::best(const PrimInfo& pinfo, const Mapping& mapping, const size_t blocks_shift)
{
/* sweep from right to left and compute parallel prefix of merged bounds */
ssef rAreas[BINS];
ssei rCounts[BINS];
ssei count = 0; BBox3fa bx = empty; BBox3fa by = empty; BBox3fa bz = empty;
for (size_t i=BINS-1; i>0; i--)
{
count += numEnd[i];
rCounts[i] = count;
bx.extend(bounds[i][0]); rAreas[i][0] = halfArea(bx);
by.extend(bounds[i][1]); rAreas[i][1] = halfArea(by);
bz.extend(bounds[i][2]); rAreas[i][2] = halfArea(bz);
}
/* sweep from left to right and compute SAH */
ssei blocks_add = (1 << blocks_shift)-1;
ssei ii = 1; ssef vbestSAH = pos_inf; ssei vbestPos = 0;
count = 0; bx = empty; by = empty; bz = empty;
for (size_t i=1; i<BINS; i++, ii+=1)
{
count += numBegin[i-1];
bx.extend(bounds[i-1][0]); float Ax = halfArea(bx);
by.extend(bounds[i-1][1]); float Ay = halfArea(by);
bz.extend(bounds[i-1][2]); float Az = halfArea(bz);
const ssef lArea = ssef(Ax,Ay,Az,Az);
const ssef rArea = rAreas[i];
const ssei lCount = (count +blocks_add) >> blocks_shift;
const ssei rCount = (rCounts[i]+blocks_add) >> blocks_shift;
const ssef sah = lArea*ssef(lCount) + rArea*ssef(rCount);
vbestPos = select(sah < vbestSAH,ii ,vbestPos);
vbestSAH = select(sah < vbestSAH,sah,vbestSAH);
}
/* find best dimension */
float bestSAH = inf;
int bestDim = -1;
int bestPos = 0;
for (size_t dim=0; dim<3; dim++)
{
/* ignore zero sized dimensions */
if (unlikely(mapping.invalid(dim)))
continue;
/* test if this is a better dimension */
if (vbestSAH[dim] < bestSAH && vbestPos[dim] != 0) {
bestDim = dim;
bestPos = vbestPos[dim];
bestSAH = vbestSAH[dim];
}
}
/* return invalid split if no split found */
if (bestDim == -1)
return Split(inf,-1,0,mapping);
/* return best found split */
return Split(bestSAH,bestDim,bestPos,mapping);
}