| 584 | |
| 585 | |
| 586 | bool PartioViewer::updateData() |
| 587 | { |
| 588 | bool chk = false; |
| 589 | for (size_t i = 0; i < getFluids().size(); i++) |
| 590 | { |
| 591 | getFluids()[i].currentFile = convertFileName(getFluids()[i].inputFile, to_string(m_frameIndex)); |
| 592 | LOG_INFO << getFluids()[i].currentFile; |
| 593 | if (readPartioFile(getFluids()[i].currentFile, getFluids()[i].partioData, getFluids()[i].posIndex)) |
| 594 | chk = true; |
| 595 | |
| 596 | updateBoundingBox(); |
| 597 | |
| 598 | if (m_usePlane) |
| 599 | { |
| 600 | Partio::ParticleAttribute posAttr; |
| 601 | getFluids()[i].partioData->attributeInfo(getFluids()[i].posIndex, posAttr); |
| 602 | const float* partioX = getFluids()[i].partioData->data<float>(posAttr, 0); |
| 603 | getFluids()[i].visibleParticles.clear(); |
| 604 | getFluids()[i].visibleParticles.reserve(getFluids()[i].partioData->numParticles()); |
| 605 | Vector3f normal = m_planeNormal; |
| 606 | normal.normalize(); |
| 607 | for (auto j = 0; j < getFluids()[i].partioData->numParticles(); j++) |
| 608 | { |
| 609 | const Eigen::Map<const Eigen::Vector3f> vec(&partioX[3 * j]); |
| 610 | if ((vec.dot(normal) - m_planePoint.dot(normal)) > 0) |
| 611 | getFluids()[i].visibleParticles.push_back(j); |
| 612 | } |
| 613 | } |
| 614 | } |
| 615 | if (chk) |
| 616 | { |
| 617 | if (m_useRBData) |
| 618 | { |
| 619 | string currentFile = convertFileName(m_rbDataFile, to_string(m_frameIndex)); |
| 620 | LOG_INFO << currentFile; |
| 621 | readRigidBodyData(currentFile, m_frameIndex == m_firstRBIndex); |
| 622 | } |
| 623 | updateScalarField(); |
| 624 | } |
| 625 | return chk; |
| 626 | } |
| 627 | |
| 628 | bool PartioViewer::imagesExist(const unsigned int frameIndex) |
| 629 | { |
no test coverage detected