MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / ObjReader

Class ObjReader

engine/3rdparty/tinyobjloader/tiny_obj_loader.h:531–587  ·  view source on GitHub ↗

Wavefront .obj reader class(v2 API)

Source from the content-addressed store, hash-verified

529/// Wavefront .obj reader class(v2 API)
530///
531class ObjReader {
532 public:
533 ObjReader() : valid_(false) {}
534 ~ObjReader() {}
535
536 ///
537 /// Load .obj and .mtl from a file.
538 ///
539 /// @param[in] filename wavefront .obj filename
540 /// @param[in] config Reader configuration
541 ///
542 bool ParseFromFile(const std::string &filename,
543 const ObjReaderConfig &config = ObjReaderConfig());
544
545 ///
546 /// Parse .obj from a text string.
547 /// Need to supply .mtl text string by `mtl_text`.
548 /// This function ignores `mtllib` line in .obj text.
549 ///
550 /// @param[in] obj_text wavefront .obj filename
551 /// @param[in] mtl_text wavefront .mtl filename
552 /// @param[in] config Reader configuration
553 ///
554 bool ParseFromString(const std::string &obj_text, const std::string &mtl_text,
555 const ObjReaderConfig &config = ObjReaderConfig());
556
557 ///
558 /// .obj was loaded or parsed correctly.
559 ///
560 bool Valid() const { return valid_; }
561
562 const attrib_t &GetAttrib() const { return attrib_; }
563
564 const std::vector<shape_t> &GetShapes() const { return shapes_; }
565
566 const std::vector<material_t> &GetMaterials() const { return materials_; }
567
568 ///
569 /// Warning message(may be filled after `Load` or `Parse`)
570 ///
571 const std::string &Warning() const { return warning_; }
572
573 ///
574 /// Error message(filled when `Load` or `Parse` failed)
575 ///
576 const std::string &Error() const { return error_; }
577
578 private:
579 bool valid_;
580
581 attrib_t attrib_;
582 std::vector<shape_t> shapes_;
583 std::vector<material_t> materials_;
584
585 std::string warning_;
586 std::string error_;
587};
588

Callers

nothing calls this directly

Calls 1

ObjReaderConfigClass · 0.85

Tested by

no test coverage detected