iA3DEllipseObjectVis::iA3DEllipseObjectVis(iAVtkWidget* widget, vtkTable* objectTable, QSharedPointer<QMap<uint, uint> > columnMapping, QColor const & color, int phiRes, int thetaRes) : iA3DColoredPolyObjectVis(widget, objectTable, columnMapping, color, (phiRes - 2) * thetaRes + 2) { auto fullPolySource = vtkSmartPointer<vtkAppendPolyData>::New(); // maybe use vtkParametricFunctionSource with vtkParametricEllipsoid? for (vtkIdType row = 0; row < objectTable->GetNumberOfRows(); ++row) { double cx = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::CenterX)).ToDouble(); double cy = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::CenterY)).ToDouble(); double cz = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::CenterZ)).ToDouble(); double dx = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::DimensionX)).ToDouble()/2; double dy = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::DimensionY)).ToDouble()/2; double dz = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::DimensionZ)).ToDouble()/2; auto ellipsoidSrc = vtkSmartPointer<vtkEllipsoidSource>::New(); ellipsoidSrc->SetThetaResolution(thetaRes); ellipsoidSrc->SetPhiResolution(phiRes); ellipsoidSrc->SetCenter(cx, cy, cz); ellipsoidSrc->SetXRadius(dx); ellipsoidSrc->SetYRadius(dy); ellipsoidSrc->SetZRadius(dz); ellipsoidSrc->Update(); fullPolySource->AddInputData(ellipsoidSrc->GetOutput()); } fullPolySource->Update(); m_fullPoly = fullPolySource->GetOutput(); m_fullPoly->GetPointData()->AddArray(m_colors); assert ( m_pointsPerObject*objectTable->GetNumberOfRows() == fullPolySource->GetOutput()->GetNumberOfPoints() ); m_mapper->SetInputData(m_fullPoly); setupBoundingBox(); setupOriginalIds(); }
void Oblig4App::initGL() { glClearColor(0.0f, 0.0f, 0.5f, 0.0f); glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); std::string mesh_filename = "share/cube.msh"; m_meshes_.reserve(10); m_meshes_.push_back(new GfxUtil::TriMesh(mesh_filename)); setupBoundingBox(m_meshes_[0]->getBBoxMin(), m_meshes_[0]->getBBoxMax()); m_current_level_ = 0; setupLightParameters(); }
/*! */ template <bool threading> inline void Bvh::setupBoundingBoxes(System& system, zisc::pmr::vector<BvhBuildingNode>& tree, const uint32 index) noexcept { auto& node = tree[index]; // Inernal node if (!node.isLeafNode()) { const auto left_child_index = node.leftChildIndex(); const auto right_child_index = node.rightChildIndex(); // Threding if (threading) { auto set_left_bounding_box = [&system, &tree, left_child_index]() { Bvh::setupBoundingBoxes<>(system, tree, left_child_index); }; auto set_right_bounding_box = [&system, &tree, right_child_index]() { Bvh::setupBoundingBoxes<>(system, tree, right_child_index); }; auto& threads = system.threadManager(); auto work_resource = tree.get_allocator().resource(); auto left_result = threads.enqueue<void>(set_left_bounding_box, work_resource); auto right_result = threads.enqueue<void>(set_right_bounding_box, work_resource); left_result.wait(); right_result.wait(); } // Sequence else { setupBoundingBoxes<>(system, tree, left_child_index); setupBoundingBoxes<>(system, tree, right_child_index); } } setupBoundingBox(tree, index); }
void AnimationsManager::resetPosition() { setupBoundingBox(); }
void VideoManager::resetPosition() { setupBoundingBox(); }