]> git.sur5r.net Git - fstl/blob - src/loader.h
New upstream version 0.10.0
[fstl] / src / loader.h
1 #ifndef LOADER_H
2 #define LOADER_H
3
4 #include <QThread>
5
6 #include "mesh.h"
7
8 class Loader : public QThread
9 {
10     Q_OBJECT
11 public:
12     explicit Loader(QObject* parent, const QString& filename, bool is_reload);
13     void run();
14
15 protected:
16     Mesh* load_stl();
17
18     /*  Reads an ASCII stl, starting from the start of the file*/
19     Mesh* read_stl_ascii(QFile& file);
20     /*  Reads a binary stl, assuming we're at the end of the header */
21     Mesh* read_stl_binary(QFile& file);
22
23 signals:
24     void loaded_file(QString filename);
25     void got_mesh(Mesh* m, bool is_reload);
26
27     void error_bad_stl();
28     void error_empty_mesh();
29     void error_missing_file();
30
31 private:
32     const QString filename;
33     bool is_reload;
34 };
35
36 #endif // LOADER_H