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