2 Copyright (C) 2003, 2010 - Wolfire Games
4 This file is part of Lugaru.
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "Quaternions.h"
29 /**> HEADER FILES <**/
31 #include "Quaternions.h"
38 leftshoulder, leftelbow, leftwrist, lefthand,
39 rightshoulder, rightelbow, rightwrist, righthand,
40 abdomen, lefthip, righthip, groin,
41 leftknee, leftankle, leftfoot,
42 rightknee, rightankle, rightfoot
93 int numverticesclothes;
103 float rotate1, rotate2, rotate3;
104 float lastrotate1, lastrotate2, lastrotate3;
105 float oldrotate1, oldrotate2, oldrotate3;
106 float newrotate1, newrotate2, newrotate3;
112 void DoConstraint(bool spinny);
137 Animation & operator = (const Animation & ani);
139 void Load(const char *fileName, int aheight, int aattack);
146 const int max_joints = 50;
152 //Joint joints[max_joints];
157 //Muscle muscles[max_muscles];
163 int forwardjoints[3];
168 int lowforwardjoints[3];
171 XYZ specialforward[5];
172 int jointlabels[max_joints];
181 Model drawmodelclothes;
186 GLubyte skinText[512 * 512 * 3];
200 float DoConstraints(XYZ *coords, float *scale);
201 void DoGravity(float *scale);
202 void FindRotationJoint(int which);
203 void FindRotationJointSameTwist(int which);
204 void FindRotationMuscle(int which, int animation);
205 void Load(const char *fileName, const char *lowfileName, const char *clothesfileName, const char *modelfileName, const char *model2fileName, const char *model3fileName, const char *model4fileName, const char *model5fileNamee, const char *model6fileName, const char *model7fileName, const char *modellowfileName, const char *modelclothesfileName, bool aclothes);
209 void FindForwardsfirst();
210 void Draw(int muscleview);
211 void AddJoint(float x, float y, float z, int which);
212 void SetJoint(float x, float y, float z, int which, int whichjoint);
213 void DeleteJoint(int whichjoint);
214 void AddMuscle(int attach1, int attach2, float maxlength, float minlength, int type);
215 void DeleteMuscle(int whichmuscle);
224 // convenience functions
225 // only for Skeleton.cpp
226 inline Joint& joint(int bodypart) { return joints[jointlabels[bodypart]]; }
227 inline XYZ& jointPos(int bodypart) { return joint(bodypart).position; }
228 inline XYZ& jointVel(int bodypart) { return joint(bodypart).velocity; }