void AccelN::build (size_t threadIndex, size_t threadCount) { size_t validAccelIndex = 0; size_t validAccelCount = 0; /* build all acceleration structures */ for (size_t i=0; i<N; i++) { accels[i]->build(threadIndex,threadCount); if (accels[i]->bounds.empty()) continue; validAccelIndex = i; validAccelCount++; } if (validAccelCount == 1) { intersectors = accels[validAccelIndex]->intersectors; } else { intersectors.ptr = this; intersectors.intersector1 = Intersector1(&intersect,&occluded,"AccelN::intersector1"); intersectors.intersector4 = Intersector4(&intersect4,&occluded4,"AccelN::intersector4"); intersectors.intersector8 = Intersector8(&intersect8,&occluded8,"AccelN::intersector8"); intersectors.intersector16= Intersector16(&intersect16,&occluded16,"AccelN::intersector16"); } /*! calculate bounds */ bounds = empty; for (size_t i=0; i<N; i++) bounds.extend(accels[i]->bounds); }
void AccelN::build () { /* build all acceleration structures in parallel */ parallel_for (accels.size(), [&] (size_t i) { accels[i]->build(); }); /* create list of non-empty acceleration structures */ validAccels.clear(); for (size_t i=0; i<accels.size(); i++) { if (accels[i]->bounds.empty()) continue; validAccels.push_back(accels[i]); } if (validAccels.size() == 1) { intersectors = validAccels[0]->intersectors; } else { intersectors.ptr = this; intersectors.intersector1 = Intersector1(&intersect,&occluded,"AccelN::intersector1"); intersectors.intersector4 = Intersector4(&intersect4,&occluded4,"AccelN::intersector4"); intersectors.intersector8 = Intersector8(&intersect8,&occluded8,"AccelN::intersector8"); intersectors.intersector16 = Intersector16(&intersect16,&occluded16,"AccelN::intersector16"); intersectors.intersectorN = IntersectorN(&intersectN,&occludedN,"AccelN::intersectorN"); } /*! calculate bounds */ bounds = empty; for (size_t i=0; i<validAccels.size(); i++) bounds.extend(validAccels[i]->bounds); }
void AccelN::build (size_t threadIndex, size_t threadCount) { /* build all acceleration structures */ M = 0; std::cout << "AccelN N = M = " << N << " " << M << std::endl; for (size_t i=0; i<N; i++) { cout << "build " << threadIndex << threadCount << N << i << endl; accels[i]->build(threadIndex,threadCount); if (accels[i]->bounds.empty()) continue; validAccels[M++] = accels[i]; } std::cout << "After accels[i]->build M=" << M << std::endl; if (M == 1) { std::cout << "only one accels " << std::endl; intersectors = validAccels[0]->intersectors; } else { intersectors.ptr = this; intersectors.intersector1 = Intersector1(&intersect,&occluded,"AccelN::intersector1"); intersectors.intersector4 = Intersector4(&intersect4,&occluded4,"AccelN::intersector4"); intersectors.intersector8 = Intersector8(&intersect8,&occluded8,"AccelN::intersector8"); intersectors.intersector16= Intersector16(&intersect16,&occluded16,"AccelN::intersector16"); } /*! calculate bounds */ bounds = empty; for (size_t i=0; i<M; i++) bounds.extend(validAccels[i]->bounds); }