1
0
Files
wavefront-parser/src/scan.hpp
Plamen Dragiyski adeeae3aff feature: stages
stages: separate scanning and parsing, allowing `v`, `vn`, `vt` lines to
be mapped to line numbers and store line data (once).

first stage parsing: parse face data and validate vertices.

TODO:
* improve validation (detect partial normals/texcoords);
* maybe improve storage of triangle line number instead of storing line
  number for each vertex;
2025-10-19 13:45:55 +03:00

33 lines
768 B
C++

#ifndef __WAVEFRONT_FILE_HPP__
#define __WAVEFRONT_FILE_HPP__
#include <cstdint>
#include <map>
#include <string>
#include <stdexcept>
#include <vector>
#include "settings.hpp"
namespace wavefront {
class scan_error : public std::runtime_error {
public:
explicit scan_error(const std::string &message);
};
struct scan_result {
std::size_t total_lines;
std::map<std::size_t, std::string> line_data;
std::map<std::string, std::vector<std::size_t>> category_map;
scan_result();
};
scan_result scan(
std::istream &input,
const std::vector<std::string> &selected_objects = {},
const std::vector<std::string> &selected_groups = {}
);
}
#endif // __WAVEFRONT_PARSER_FILE_HPP__