Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / gabarit.h
blob7c4cafcdd90fedffa00e9e6e050ac66d46246ccd
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef CL_GABARIT_H
21 #define CL_GABARIT_H
24 #include "game_share/people.h"
27 namespace NL3D
29 class USkeleton;
32 namespace NLMISC
34 class IProgressCallback;
37 /** This is a description of a skeleton gabarit
38 * \author Nicolas Vizerie
39 * \author Nevrax France
40 * \date 2002
42 struct CSkeletonGabarit
44 enum { NumBones = 56 }; // 61
45 enum EBoneCategory { Arm = 0, Torso, Legs, Breast, Other, NumBoneCategory = Other};
46 // the scale for each bone
47 NLMISC::CVector BoneScale[NumBones];
48 // the Skin Scale for each bone
49 NLMISC::CVector BoneSkinScale[NumBones];
50 // height
51 float HeightScale;
52 // ctor
53 CSkeletonGabarit();
54 // build values from a skeleton
55 void buildFromSkeleton(NL3D::USkeleton src, const std::string &skelName, bool bMale);
56 // convert a bone ID to its name
57 static const char *boneIndexToName(uint id);
58 // convert a bone ID to its category
59 static EBoneCategory boneIndexToCategory(uint id);
63 /** This can load gabarit and blend them on a skeleton
64 * \author Nicolas Vizerie
65 * \author Nevrax France
66 * \date 2002
68 class CGabaritSet
70 public:
71 enum { NumGender = 2, NumRace = 4, NumHeights = 3, NumWidths = 3 };
72 public:
73 // load all ryzom gabarits
74 void loadGabarits (NLMISC::IProgressCallback &progress);
75 /** Blend gabarits, and apply the result to the given skeleton
76 * \param height from -1 (smallest) to 1 (tallest)
77 * \param torsoWidth from -1 to 1
78 * \param legsWidth from -1 to 1
79 * \param finalHeightScale if not NULL, will be filled with height scale of the skeleton (factor)
81 void applyGabarit(NL3D::USkeleton dest, uint gender, EGSPD::CPeople::TPeople race,
82 float height,
83 float torsoWidth,
84 float armsWidth,
85 float legsWidth,
86 float breastSize,
87 float *finalHeightScale
89 // get the reference (mean) size for a race
90 float getRefHeightScale(uint gender, EGSPD::CPeople::TPeople race);
91 private:
92 CSkeletonGabarit _Gabarit[NumGender][NumRace][NumHeights][NumWidths];
93 private:
94 sint peopleToIndex(EGSPD::CPeople::TPeople people);
98 // The gabarit set in ryzom
99 extern CGabaritSet GabaritSet;
108 #endif