readOBJ.cpp 959 B

1234567891011121314151617181920212223242526272829303132
  1. #include <igl/readOBJ.h>
  2. #include <test_common.h>
  3. #include <iostream>
  4. #include <string>
  5. #include <tuple>
  6. TEST_CASE("readOBJ: simple", "[igl]")
  7. {
  8. Eigen::MatrixXd V;
  9. Eigen::MatrixXi F;
  10. // wait... so this is actually testing test_common::load_mesh not readOBJ
  11. // directly...
  12. igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
  13. REQUIRE (V.rows() == 8);
  14. REQUIRE (F.rows() == 12);
  15. }
  16. TEST_CASE("readOBJ: Obj with material", "[igl]")
  17. {
  18. std::vector<std::vector<double > > V;
  19. std::vector<std::vector<double > > TC;
  20. std::vector<std::vector<double > > N;
  21. std::vector<std::vector<int > > F;
  22. std::vector<std::vector<int > > FTC;
  23. std::vector<std::vector<int > > FN;
  24. std::vector<std::tuple<std::string, int, int>> FM;
  25. igl::readOBJ(test_common::data_path("cubewithmaterial.obj"), V, TC, N, F, FTC, FN, FM);
  26. REQUIRE (V.size() == 8);
  27. REQUIRE (F.size() == 6);
  28. REQUIRE (FM.size() == 2);
  29. }