]> git.jsancho.org Git - lugaru.git/blob - Source/Animation/Skeleton.h
Removed empty destructors. Joint::label is a bodypart
[lugaru.git] / Source / Animation / Skeleton.h
1 /*
2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
4
5 This file is part of Lugaru.
6
7 Lugaru is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 Lugaru is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _SKELETON_H_
22 #define _SKELETON_H_
23
24 #include "Models.h"
25
26 /**> HEADER FILES <**/
27 #include "gamegl.h"
28 #include "Quaternions.h"
29 #include "Objects.h"
30 #include "Sprite.h"
31 #include "binio.h"
32 #include "Animation/Animation.h"
33 #include "Animation/Joint.h"
34 #include "Animation/Muscle.h"
35
36 const int max_joints = 50;
37
38 class Skeleton
39 {
40 public:
41     std::vector<Joint> joints;
42
43     std::vector<Muscle> muscles;
44
45     int selected;
46
47     int forwardjoints[3];
48     XYZ forward;
49
50     int id;
51
52     int lowforwardjoints[3];
53     XYZ lowforward;
54
55     XYZ specialforward[5];
56     int jointlabels[max_joints];
57
58     Model model[7];
59     Model modellow;
60     Model modelclothes;
61     int num_models;
62
63     Model drawmodel;
64     Model drawmodellow;
65     Model drawmodelclothes;
66
67     bool clothes;
68     bool spinny;
69
70     GLubyte skinText[512 * 512 * 3];
71     int skinsize;
72
73     float checkdelay;
74
75     float longdead;
76     bool broken;
77
78     int free;
79     int oldfree;
80     float freetime;
81     bool freefall;
82
83     void FindForwards();
84     float DoConstraints(XYZ *coords, float *scale);
85     void DoGravity(float *scale);
86     void FindRotationJoint(int which);
87     void FindRotationJointSameTwist(int which);
88     void FindRotationMuscle(int which, int animation);
89     void Load(const std::string& fileName, const std::string& lowfileName, const std::string& clothesfileName, const std::string& modelfileName, const std::string& model2fileName, const std::string& model3fileName, const std::string& model4fileName, const std::string& model5fileNamee, const std::string& model6fileName, const std::string& model7fileName, const std::string& modellowfileName, const std::string& modelclothesfileName, bool aclothes);
90
91     Skeleton();
92
93 private:
94     // convenience functions
95     // only for Skeleton.cpp
96     inline Joint& joint(int bodypart) { return joints[jointlabels[bodypart]]; }
97     inline XYZ& jointPos(int bodypart) { return joint(bodypart).position; }
98     inline XYZ& jointVel(int bodypart) { return joint(bodypart).velocity; }
99
100 };
101
102 #endif