Line data Source code
1 : #ifndef GLTF_H_
2 : #define GLTF_H_
3 :
4 : class gltf final : public skelloader<gltf>
5 : {
6 : public:
7 : //ordinary methods
8 : gltf(std::string name);
9 :
10 : //method overrides
11 : bool flipy() const override final;
12 : int type() const override final;
13 : skelmeshgroup *newmeshes() override final;
14 : bool loaddefaultparts() override final;
15 :
16 : //static methods
17 : static const char *formatname();
18 :
19 : private:
20 : struct gltfjoint
21 : {
22 : vec pos;
23 : quat orient;
24 : };
25 :
26 : struct gltfweight
27 : {
28 : int joint;
29 : float bias;
30 : vec pos;
31 : };
32 :
33 : struct gltfvert
34 : {
35 : vec2 tc;
36 : uint start, count;
37 : };
38 :
39 : struct gltfhierarchy
40 : {
41 : string name;
42 : int parent, flags, start;
43 : };
44 :
45 : class gltfmeshgroup : public skelmeshgroup
46 : {
47 : public:
48 : gltfmeshgroup();
49 : //main anim loading functionality
50 0 : const skelanimspec * loadanim(const std::string &) override final { return nullptr;};
51 :
52 : private:
53 : bool loadmesh(const char *filename, float smooth, part &p);
54 : bool load(std::string_view meshname, float smooth, part &p) override final;
55 : };
56 :
57 :
58 : //extensions to skelmesh objects for gltf specifically
59 : class gltfmesh : public skelmesh
60 : {
61 : public:
62 : gltfmesh(std::string_view name, vert *verts, uint numverts, tri *tris, uint numtris, meshgroup *m);
63 : ~gltfmesh();
64 : void cleanup();
65 : void buildverts(const std::vector<gltfjoint> &joints);
66 : //gltf model loader
67 : void load(stream *f, char *buf, size_t bufsize, part &p, const std::string &modeldir);
68 : };
69 :
70 : static skelcommands<gltf> gltfcommands;
71 : };
72 :
73 : #endif
|