void Scene::createHairAccel() { if (g_hair_accel == "default") { if (isStatic()) { int mode = 2*(int)isCompact() + 1*(int)isRobust(); switch (mode) { case /*0b00*/ 0: accels.add(BVH4Hair::BVH4HairBezier1(this,isHighQuality())); break; case /*0b01*/ 1: accels.add(BVH4Hair::BVH4HairBezier1(this,isHighQuality())); break; case /*0b10*/ 2: accels.add(BVH4Hair::BVH4HairBezier1i(this,isHighQuality())); break; case /*0b11*/ 3: accels.add(BVH4Hair::BVH4HairBezier1i(this,isHighQuality())); break; } } else { int mode = 2*(int)isCompact() + 1*(int)isRobust(); switch (mode) { case /*0b00*/ 0: accels.add(BVH4::BVH4Bezier1(this)); break; case /*0b01*/ 1: accels.add(BVH4::BVH4Bezier1(this)); break; case /*0b10*/ 2: accels.add(BVH4::BVH4Bezier1i(this)); break; case /*0b11*/ 3: accels.add(BVH4::BVH4Bezier1i(this)); break; } } } else if (g_hair_accel == "bvh4.bezier1" ) accels.add(BVH4::BVH4Bezier1(this)); else if (g_hair_accel == "bvh4.bezier1i" ) accels.add(BVH4::BVH4Bezier1i(this)); else if (g_hair_accel == "bvh4hair.bezier1" ) accels.add(BVH4Hair::BVH4HairBezier1(this,false)); else if (g_hair_accel == "bvh4hair.bezier1i") accels.add(BVH4Hair::BVH4HairBezier1i(this,false)); else throw std::runtime_error("unknown hair acceleration structure "+g_hair_accel); }
void Scene::createHairAccel() { if (g_hair_accel == "default") { if (isStatic()) { int mode = 2*(int)isCompact() + 1*(int)isRobust(); switch (mode) { case /*0b00*/ 0: accels.add(BVH4::BVH4OBBBezier1v(this,isHighQuality())); break; case /*0b01*/ 1: accels.add(BVH4::BVH4OBBBezier1v(this,isHighQuality())); break; case /*0b10*/ 2: accels.add(BVH4::BVH4OBBBezier1i(this,isHighQuality())); break; case /*0b11*/ 3: accels.add(BVH4::BVH4OBBBezier1i(this,isHighQuality())); break; } } else { int mode = 2*(int)isCompact() + 1*(int)isRobust(); switch (mode) { case /*0b00*/ 0: accels.add(BVH4::BVH4Bezier1v(this)); break; case /*0b01*/ 1: accels.add(BVH4::BVH4Bezier1v(this)); break; case /*0b10*/ 2: accels.add(BVH4::BVH4Bezier1i(this)); break; case /*0b11*/ 3: accels.add(BVH4::BVH4Bezier1i(this)); break; } } } else if (g_hair_accel == "bvh4.bezier1v" ) accels.add(BVH4::BVH4Bezier1v(this)); else if (g_hair_accel == "bvh4.bezier1i" ) accels.add(BVH4::BVH4Bezier1i(this)); else if (g_hair_accel == "bvh4obb.bezier1v" ) accels.add(BVH4::BVH4OBBBezier1v(this,false)); else if (g_hair_accel == "bvh4obb.bezier1i" ) accels.add(BVH4::BVH4OBBBezier1i(this,false)); else THROW_RUNTIME_ERROR("unknown hair acceleration structure "+g_hair_accel); }
GenericChatroomWidget::GenericChatroomWidget(bool compact, QWidget* parent) : GenericChatItemWidget(compact, parent) , active{false} { // avatar QSize size; if (isCompact()) size = QSize(20, 20); else size = QSize(40, 40); avatar = new MaskablePixmapWidget(this, size, ":/img/avatar_mask.svg"); // status text statusMessageLabel = new CroppingLabel(this); statusMessageLabel->setTextFormat(Qt::PlainText); statusMessageLabel->setForegroundRole(QPalette::WindowText); nameLabel->setForegroundRole(QPalette::WindowText); Settings& s = Settings::getInstance(); connect(&s, &Settings::compactLayoutChanged, this, &GenericChatroomWidget::compactChange); setAutoFillBackground(true); reloadTheme(); compactChange(isCompact()); }
void Scene::createTriangleAccel() { if (g_tri_accel == "default") { if (isStatic()) { int mode = 2*(int)isCompact() + 1*(int)isRobust(); switch (mode) { case /*0b00*/ 0: #if defined (__TARGET_AVX__) if (has_feature(AVX2)) // on AVX machines BVH8 gives lower performance, only enable on AVX2! { if (isHighQuality()) accels.add(BVH8::BVH8Triangle8SpatialSplit(this)); else accels.add(BVH8::BVH8Triangle8ObjectSplit(this)); } else #endif { if (isHighQuality()) accels.add(BVH4::BVH4Triangle4SpatialSplit(this)); else accels.add(BVH4::BVH4Triangle4ObjectSplit(this)); } break; case /*0b01*/ 1: accels.add(BVH4::BVH4Triangle4vObjectSplit(this)); break; case /*0b10*/ 2: accels.add(BVH4::BVH4Triangle4iObjectSplit(this)); break; case /*0b11*/ 3: accels.add(BVH4::BVH4Triangle4iObjectSplit(this)); break; } } else { int mode = 2*(int)isCompact() + 1*(int)isRobust(); switch (mode) { case /*0b00*/ 0: accels.add(BVH4::BVH4BVH4Triangle4ObjectSplit(this)); break; case /*0b01*/ 1: accels.add(BVH4::BVH4BVH4Triangle4vObjectSplit(this)); break; case /*0b10*/ 2: accels.add(BVH4::BVH4BVH4Triangle4iObjectSplit(this)); break; case /*0b11*/ 3: accels.add(BVH4::BVH4BVH4Triangle4iObjectSplit(this)); break; } } } else if (g_tri_accel == "bvh4.bvh4.triangle1") accels.add(BVH4::BVH4BVH4Triangle1ObjectSplit(this)); else if (g_tri_accel == "bvh4.bvh4.triangle4") accels.add(BVH4::BVH4BVH4Triangle4ObjectSplit(this)); else if (g_tri_accel == "bvh4.bvh4.triangle1v") accels.add(BVH4::BVH4BVH4Triangle1vObjectSplit(this)); else if (g_tri_accel == "bvh4.bvh4.triangle4v") accels.add(BVH4::BVH4BVH4Triangle4vObjectSplit(this)); else if (g_tri_accel == "bvh4.triangle1") accels.add(BVH4::BVH4Triangle1(this)); else if (g_tri_accel == "bvh4.triangle4") accels.add(BVH4::BVH4Triangle4(this)); #if defined (__TARGET_AVX__) else if (g_tri_accel == "bvh4.triangle8") accels.add(BVH4::BVH4Triangle8(this)); #endif else if (g_tri_accel == "bvh4.triangle1v") accels.add(BVH4::BVH4Triangle1v(this)); else if (g_tri_accel == "bvh4.triangle4v") accels.add(BVH4::BVH4Triangle4v(this)); else if (g_tri_accel == "bvh4.triangle4i") accels.add(BVH4::BVH4Triangle4i(this)); #if defined (__TARGET_AVX__) else if (g_tri_accel == "bvh8.triangle8") accels.add(BVH8::BVH8Triangle8(this)); #endif else throw std::runtime_error("unknown triangle acceleration structure "+g_tri_accel); }
void Scene::createTriangleAccel() { if (g_tri_accel == "default") { if (isStatic()) { int mode = 2*(int)isCompact() + 1*(int)isRobust(); switch (mode) { case /*0b00*/ 0: #if defined (__TARGET_AVX__) if (has_feature(AVX)) { if (isHighQuality()) accels.add(BVH8::BVH8Triangle4SpatialSplit(this)); else accels.add(BVH8::BVH8Triangle4ObjectSplit(this)); } else #endif { if (isHighQuality()) accels.add(BVH4::BVH4Triangle4SpatialSplit(this)); else accels.add(BVH4::BVH4Triangle4ObjectSplit(this)); } break; case /*0b01*/ 1: accels.add(BVH4::BVH4Triangle4vObjectSplit(this)); break; case /*0b10*/ 2: accels.add(BVH4::BVH4Triangle4iObjectSplit(this)); break; case /*0b11*/ 3: accels.add(BVH4::BVH4Triangle4iObjectSplit(this)); break; } } else { int mode = 2*(int)isCompact() + 1*(int)isRobust(); switch (mode) { case /*0b00*/ 0: accels.add(BVH4::BVH4BVH4Triangle4ObjectSplit(this)); break; case /*0b01*/ 1: accels.add(BVH4::BVH4BVH4Triangle4vObjectSplit(this)); break; case /*0b10*/ 2: accels.add(BVH4::BVH4BVH4Triangle4iObjectSplit(this)); break; case /*0b11*/ 3: accels.add(BVH4::BVH4BVH4Triangle4iObjectSplit(this)); break; } } } else if (g_tri_accel == "bvh4.bvh4.triangle1") accels.add(BVH4::BVH4BVH4Triangle1ObjectSplit(this)); else if (g_tri_accel == "bvh4.bvh4.triangle4") accels.add(BVH4::BVH4BVH4Triangle4ObjectSplit(this)); else if (g_tri_accel == "bvh4.bvh4.triangle1v") accels.add(BVH4::BVH4BVH4Triangle1vObjectSplit(this)); else if (g_tri_accel == "bvh4.bvh4.triangle4v") accels.add(BVH4::BVH4BVH4Triangle4vObjectSplit(this)); else if (g_tri_accel == "bvh4.triangle1") accels.add(BVH4::BVH4Triangle1(this)); else if (g_tri_accel == "bvh4.triangle4") accels.add(BVH4::BVH4Triangle4(this)); else if (g_tri_accel == "bvh4.triangle1v") accels.add(BVH4::BVH4Triangle1v(this)); else if (g_tri_accel == "bvh4.triangle4v") accels.add(BVH4::BVH4Triangle4v(this)); else if (g_tri_accel == "bvh4.triangle4i") accels.add(BVH4::BVH4Triangle4i(this)); #if defined (__TARGET_AVX__) else if (g_tri_accel == "bvh4.triangle8") accels.add(BVH4::BVH4Triangle8(this)); else if (g_tri_accel == "bvh8.triangle4") accels.add(BVH8::BVH8Triangle4(this)); else if (g_tri_accel == "bvh8.triangle8") accels.add(BVH8::BVH8Triangle8(this)); #endif else THROW_RUNTIME_ERROR("unknown triangle acceleration structure "+g_tri_accel); }
void GenericChatroomWidget::compactChange(bool _compact) { if (!isCompact()) delete textLayout; // has to be first, deleted by layout setCompact(_compact); delete mainLayout; mainLayout = new QHBoxLayout; textLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->setSpacing(0); mainLayout->setMargin(0); textLayout->setSpacing(0); textLayout->setMargin(0); setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft // avatar if (isCompact()) { delete textLayout; // Not needed setFixedHeight(25); avatar->setSize(QSize(20, 20)); mainLayout->addSpacing(18); mainLayout->addWidget(avatar); mainLayout->addSpacing(5); mainLayout->addWidget(nameLabel); mainLayout->addWidget(statusMessageLabel); mainLayout->addSpacing(5); mainLayout->addWidget(&statusPic); mainLayout->addSpacing(5); mainLayout->activate(); statusMessageLabel->setFont(Style::getFont(Style::Small)); nameLabel->setFont(Style::getFont(Style::Medium)); } else { setFixedHeight(55); avatar->setSize(QSize(40, 40)); textLayout->addStretch(); textLayout->addWidget(nameLabel); textLayout->addWidget(statusMessageLabel); textLayout->addStretch(); mainLayout->addSpacing(20); mainLayout->addWidget(avatar); mainLayout->addSpacing(10); mainLayout->addLayout(textLayout); mainLayout->addSpacing(10); mainLayout->addWidget(&statusPic); mainLayout->addSpacing(10); mainLayout->activate(); statusMessageLabel->setFont(Style::getFont(Style::Medium)); nameLabel->setFont(Style::getFont(Style::Big)); } }
/** * Make this RabinAcceptance compact (part of interface AcceptanceCondition). */ void makeCompact() { if (isCompact()) { return; } // Compress Acceptance-Pairs unsigned pair_to=0; for (unsigned int pair_from=0; pair_from<_acceptance_L.size(); pair_from++) { if (_acceptance_L[pair_from]!=0) { if (pair_from==pair_to) { // nothing to do } else { _acceptance_L[pair_to]=_acceptance_L[pair_from]; _acceptance_U[pair_to]=_acceptance_U[pair_from]; } ++pair_to; } } unsigned int new_acceptance_count=pair_to; _acceptance_L.resize(new_acceptance_count); _acceptance_U.resize(new_acceptance_count); _is_compact=true; }
void CategoryWidget::setName(const QString &name, bool save) { nameLabel->setText(name); if (isCompact()) nameLabel->minimizeMaximumWidth(); if (save) onSetName(); }
/** Update the acceptance condition upon renaming of states acording * to the mapping (part of AcceptanceCondition interface). * Assumes that states can only get a lower name. * @param mapping vector with mapping a[i] -> j */ void moveStates(std::vector<unsigned int> mapping) { if (!isCompact()) { makeCompact(); } for (unsigned int i=0;i<size();++i) { move_acceptance_bits(*_acceptance_L[i], mapping); move_acceptance_bits(*_acceptance_U[i], mapping); } }
void Scene::createSubdivAccel() { if (g_subdiv_accel == "default") { if (isIncoherent(flags)) { if (isCompact()) accels.add(BVH4::BVH4SubdivGridLazy(this)); else accels.add(BVH4::BVH4SubdivGridEager(this)); } else { accels.add(BVH4::BVH4SubdivPatch1Cached(this)); } } else if (g_subdiv_accel == "bvh4.subdivpatch1" ) accels.add(BVH4::BVH4SubdivPatch1(this)); else if (g_subdiv_accel == "bvh4.subdivpatch1cached") accels.add(BVH4::BVH4SubdivPatch1Cached(this)); else if (g_subdiv_accel == "bvh4.grid.adaptive" ) accels.add(BVH4::BVH4SubdivGrid(this)); else if (g_subdiv_accel == "bvh4.grid.eager" ) accels.add(BVH4::BVH4SubdivGridEager(this)); else if (g_subdiv_accel == "bvh4.grid.lazy" ) accels.add(BVH4::BVH4SubdivGridLazy(this)); else THROW_RUNTIME_ERROR("unknown subdiv accel "+g_subdiv_accel); }
CircleWidget::CircleWidget(FriendListWidget* parent, int id) : CategoryWidget(parent) , id(id) { setName(Settings::getInstance().getCircleName(id), false); circleList[id] = this; connect(nameLabel, &CroppingLabel::editFinished, [this](const QString& newName) { if (!newName.isEmpty()) emit renameRequested(this, newName); }); connect(nameLabel, &CroppingLabel::editRemoved, [this]() { if (isCompact()) nameLabel->minimizeMaximumWidth(); }); setExpanded(Settings::getInstance().getCircleExpanded(id), false); updateStatus(); }
bool NNormalSurface::disjoint(const NNormalSurface& other) const { // Some sanity tests before we begin. // These should all pass if the user has adhered to the preconditions. if (! (isCompact() && other.isCompact())) return false; if (! (isConnected() && other.isConnected())) return false; // Begin with a local compatibility test. if (! locallyCompatible(other)) return false; // Now we know that the sum of both surfaces is an embedded surface. // Form the sum, pull it apart into connected components, and see // whether we get our original two surfaces back. NNormalSurfaceVector* v = static_cast<NNormalSurfaceVector*>(vector->clone()); (*v) += *(other.vector); NNormalSurface* sum = new NNormalSurface(triangulation_, v); typedef std::vector<NNormalSurface*> CompVector; CompVector bits; splitIntoComponents(*sum, bits); bool ans = false; if (bits.size() == 2) for (int c = 0; c < 2; ++c) if (sameSurface(*bits[c])) { ans = true; break; } for (CompVector::iterator it = bits.begin(); it != bits.end(); ++it) delete *it; delete sum; return ans; }
CategoryWidget::CategoryWidget(QWidget* parent) : GenericChatItemWidget(parent) { container = new QWidget(this); container->setObjectName("circleWidgetContainer"); container->setLayoutDirection(Qt::LeftToRight); statusLabel = new QLabel(this); statusLabel->setObjectName("status"); statusLabel->setTextFormat(Qt::PlainText); statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg")); fullLayout = new QVBoxLayout(this); fullLayout->setSpacing(0); fullLayout->setMargin(0); fullLayout->addWidget(container); lineFrame = new QFrame(container); lineFrame->setObjectName("line"); lineFrame->setFrameShape(QFrame::HLine); lineFrame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); lineFrame->resize(0, 0); listLayout = new FriendListLayout(); listWidget = new QWidget(this); listWidget->setLayout(listLayout); fullLayout->addWidget(listWidget); setAcceptDrops(true); onCompactChanged(isCompact()); setExpanded(true, false); updateStatus(); }
Scene::Scene (RTCSceneFlags sflags, RTCAlgorithmFlags aflags) : flags(sflags), aflags(aflags), numMappedBuffers(0), is_build(false), needTriangles(false), needVertices(false), numTriangles(0), numTriangles2(0), numBezierCurves(0), numBezierCurves2(0), numSubdivPatches(0), numSubdivPatches2(0), numUserGeometries1(0), numIntersectionFilters4(0), numIntersectionFilters8(0), numIntersectionFilters16(0), commitCounter(0) { #if !defined(__MIC__) lockstep_scheduler.taskBarrier.init(TaskScheduler::getNumThreads()); #else lockstep_scheduler.taskBarrier.init(MAX_MIC_THREADS); #endif if (g_scene_flags != -1) flags = (RTCSceneFlags) g_scene_flags; geometries.reserve(128); #if defined(__MIC__) accels.add( BVH4mb::BVH4mbTriangle1ObjectSplitBinnedSAH(this) ); accels.add( BVH4i::BVH4iVirtualGeometryBinnedSAH(this) ); accels.add( BVH4Hair::BVH4HairBinnedSAH(this) ); accels.add( BVH4i::BVH4iSubdivMeshBinnedSAH(this) ); if (g_verbose >= 1) { std::cout << "scene flags: static " << isStatic() << " compact = " << isCompact() << " high quality = " << isHighQuality() << " robust = " << isRobust() << std::endl; } if (g_tri_accel == "default" || g_tri_accel == "bvh4i") { if (g_tri_builder == "default") { if (isStatic()) { if (g_verbose >= 1) std::cout << "STATIC BUILDER MODE" << std::endl; if ( isCompact() ) accels.add(BVH4i::BVH4iTriangle1MemoryConservativeBinnedSAH(this)); else if ( isHighQuality() ) accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this)); else accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this)); } else { if (g_verbose >= 1) std::cout << "DYNAMIC BUILDER MODE" << std::endl; accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton(this)); } } else { if (g_tri_builder == "sah" || g_tri_builder == "bvh4i" || g_tri_builder == "bvh4i.sah") { accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this)); } else if (g_tri_builder == "fast" || g_tri_builder == "morton") { accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton(this)); } else if (g_tri_builder == "fast_enhanced" || g_tri_builder == "morton.enhanced") { accels.add(BVH4i::BVH4iTriangle1ObjectSplitEnhancedMorton(this)); } else if (g_tri_builder == "high_quality" || g_tri_builder == "presplits") { accels.add(BVH4i::BVH4iTriangle1PreSplitsBinnedSAH(this)); } else if (g_tri_builder == "compact" || g_tri_builder == "memory_conservative") { accels.add(BVH4i::BVH4iTriangle1MemoryConservativeBinnedSAH(this)); } else if (g_tri_builder == "morton64") { accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton64Bit(this)); } else THROW_RUNTIME_ERROR("unknown builder "+g_tri_builder+" for BVH4i<Triangle1>"); } } else THROW_RUNTIME_ERROR("unknown accel "+g_tri_accel); #else createTriangleAccel(); //accels.add(BVH4::BVH4Triangle1vMB(this)); accels.add(BVH4::BVH4Triangle4vMB(this)); accels.add(BVH4::BVH4UserGeometry(this)); createHairAccel(); accels.add(BVH4::BVH4OBBBezier1iMB(this,false)); createSubdivAccel(); #endif }
/** Get the number of acceptance pairs. * Requires the acceptance pairs to be compact. */ unsigned int size() const { if (!isCompact()) { throw Exception("Can't give acceptance pair count for uncompacted condition."); } return _acceptance_L.size(); }
Scene::Scene (RTCSceneFlags sflags, RTCAlgorithmFlags aflags) : flags(sflags), aflags(aflags), numMappedBuffers(0), is_build(false), needTriangles(false), needVertices(false), numTriangleMeshes(0), numTriangleMeshes2(0), numTriangles(0), numTriangles2(0), numBezierCurves(0), numBezierCurves2(0), numUserGeometries1(0), numIntersectionFilters4(0), numIntersectionFilters8(0), numIntersectionFilters16(0) { if (g_scene_flags != -1) flags = (RTCSceneFlags) g_scene_flags; geometries.reserve(128); #if defined(__MIC__) accels.add( BVH4mb::BVH4mbTriangle1ObjectSplitBinnedSAH(this) ); accels.add( BVH4i::BVH4iVirtualGeometryBinnedSAH(this) ); accels.add( BVH4Hair::BVH4HairBinnedSAH(this) ); if (g_verbose >= 1) { std::cout << "scene flags: static " << isStatic() << " compact = " << isCompact() << " high quality = " << isHighQuality() << " robust = " << isRobust() << std::endl; } if (g_tri_accel == "default" || g_tri_accel == "bvh4i") { if (g_tri_builder == "default") { if (isStatic()) { if (g_verbose >= 1) std::cout << "STATIC BUILDER MODE" << std::endl; if ( isCompact() ) accels.add(BVH4i::BVH4iTriangle1MemoryConservativeBinnedSAH(this)); else if ( isHighQuality() ) accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this)); else accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this)); } else { if (g_verbose >= 1) std::cout << "DYNAMIC BUILDER MODE" << std::endl; accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton(this)); } } else { if (g_tri_builder == "sah" || g_tri_builder == "bvh4i" || g_tri_builder == "bvh4i.sah") { accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this)); } else if (g_tri_builder == "fast" || g_tri_builder == "morton") { accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton(this)); } else if (g_tri_builder == "fast_enhanced" || g_tri_builder == "morton.enhanced") { accels.add(BVH4i::BVH4iTriangle1ObjectSplitEnhancedMorton(this)); } else if (g_tri_builder == "high_quality" || g_tri_builder == "presplits") { accels.add(BVH4i::BVH4iTriangle1PreSplitsBinnedSAH(this)); } else if (g_tri_builder == "compact" || g_tri_builder == "memory_conservative") { accels.add(BVH4i::BVH4iTriangle1MemoryConservativeBinnedSAH(this)); } else if (g_tri_builder == "morton64") { accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton64Bit(this)); } else throw std::runtime_error("unknown builder "+g_tri_builder+" for BVH4i<Triangle1>"); } } else throw std::runtime_error("unknown accel "+g_tri_accel); #else createTriangleAccel(); accels.add(BVH4MB::BVH4MBTriangle1v(this)); accels.add(BVH4::BVH4UserGeometry(this)); createHairAccel(); #endif }