goat3d

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