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