goat3d

view src/mesh.h @ 75:76dea247f75c

in progress
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 08 May 2014 00:50:16 +0300
parents dad392c710df
children 9785847d52d4
line source
1 /*
2 goat3d - 3D scene, character, and animation file format library.
3 Copyright (C) 2013-2014 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef MESH_H_
19 #define MESH_H_
21 #include <vector>
22 #include "object.h"
23 #include "material.h"
25 namespace g3dimpl {
27 class Node;
29 struct Face {
30 int v[3];
31 };
33 struct Int4 {
34 int x, y, z, w;
36 Int4();
37 Int4(int x, int y, int z, int w);
38 };
40 class Mesh : public Object {
41 public:
42 Material *material;
44 std::vector<Vector3> vertices;
45 std::vector<Vector3> normals;
46 std::vector<Vector3> tangents;
47 std::vector<Vector2> texcoords;
48 std::vector<Vector4> skin_weights;
49 std::vector<Int4> skin_matrices;
50 std::vector<Vector4> colors;
51 std::vector<Face> faces;
53 std::vector<Node*> bones;
55 Mesh();
57 bool load(const char *fname);
58 bool save(const char *fname) const;
60 void set_material(Material *mat);
61 Material *get_material();
62 const Material *get_material() const;
64 AABox get_bounds() const;
65 };
67 } // namespace g3dimpl
69 #endif // MESH_H_