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;
This commit is contained in:
33
src/scan.hpp
Normal file
33
src/scan.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#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__
|
||||
Reference in New Issue
Block a user