本文整理汇总了C++中NodeRef::quantizedNode方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeRef::quantizedNode方法的具体用法?C++ NodeRef::quantizedNode怎么用?C++ NodeRef::quantizedNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeRef
的用法示例。
在下文中一共展示了NodeRef::quantizedNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
typename BVHNStatistics<N>::Statistics BVHNStatistics<N>::statistics(NodeRef node, const double A, const BBox1f t0t1)
{
Statistics s;
double dt = max(0.0f,t0t1.size());
if (node.isAlignedNode())
{
AlignedNode* n = node.alignedNode();
for (size_t i=0; i<N; i++) {
if (n->child(i) == BVH::emptyNode) continue;
s.statAlignedNodes.numChildren++;
const double Ai = max(0.0f,halfArea(n->extend(i)));
s = s + statistics(n->child(i),Ai,t0t1);
}
s.statAlignedNodes.numNodes++;
s.statAlignedNodes.nodeSAH += dt*A;
s.depth++;
}
else if (node.isUnalignedNode())
{
UnalignedNode* n = node.unalignedNode();
for (size_t i=0; i<N; i++) {
if (n->child(i) == BVH::emptyNode) continue;
s.statUnalignedNodes.numChildren++;
const double Ai = max(0.0f,halfArea(n->extend(i)));
s = s + statistics(n->child(i),Ai,t0t1);
}
s.statUnalignedNodes.numNodes++;
s.statUnalignedNodes.nodeSAH += dt*A;
s.depth++;
}
else if (node.isAlignedNodeMB())
{
AlignedNodeMB* n = node.alignedNodeMB();
for (size_t i=0; i<N; i++) {
if (n->child(i) == BVH::emptyNode) continue;
s.statAlignedNodesMB.numChildren++;
const double Ai = max(0.0f,halfArea(n->extend0(i)));
s = s + statistics(n->child(i),Ai,t0t1);
}
s.statAlignedNodesMB.numNodes++;
s.statAlignedNodesMB.nodeSAH += dt*A;
s.depth++;
}
else if (node.isUnalignedNodeMB())
{
UnalignedNodeMB* n = node.unalignedNodeMB();
for (size_t i=0; i<N; i++) {
if (n->child(i) == BVH::emptyNode) continue;
s.statUnalignedNodesMB.numChildren++;
const double Ai = max(0.0f,halfArea(n->extend0(i)));
s = s + statistics(n->child(i),Ai,t0t1);
}
s.statUnalignedNodesMB.numNodes++;
s.statUnalignedNodesMB.nodeSAH += dt*A;
s.depth++;
}
else if (node.isTransformNode())
{
s.statTransformNodes.numNodes++;
s.statTransformNodes.nodeSAH += dt*A;
s.depth++;
}
else if (node.isQuantizedNode())
{
QuantizedNode* n = node.quantizedNode();
for (size_t i=0; i<N; i++) {
if (n->child(i) == BVH::emptyNode) continue;
s.statQuantizedNodes.numChildren++;
const double Ai = max(0.0f,halfArea(n->extend(i)));
s = s + statistics(n->child(i),Ai,t0t1);
}
s.statQuantizedNodes.numNodes++;
s.statQuantizedNodes.nodeSAH += dt*A;
s.depth++;
}
else if (node.isLeaf())
{
size_t num; const char* tri = node.leaf(num);
if (num)
{
for (size_t i=0; i<num; i++) {
s.statLeaf.numPrims += bvh->primTy.size(tri+i*bvh->primTy.bytes);
}
s.statLeaf.numLeaves++;
s.statLeaf.numPrimBlocks += num;
s.statLeaf.leafSAH += dt*A*num;
if (num-1 < Statistics::LeafStat::NHIST) {
s.statLeaf.numPrimBlocksHistogram[num-1]++;
}
}
}
else {
throw std::runtime_error("not supported node type in bvh_statistics");
}
return s;
}