3 * MMD
\82Ì
\83\82\81[
\83V
\83\87\83\93\83f
\81[
\83^
\81B
4 *
\83o
\83C
\83i
\83\8a\8c`
\8e®
\82Å
\83{
\81[
\83\93\83\82\81[
\83V
\83\87\83\93\81A
\95\
\8fî
\83\82\81[
\83t
\83B
\83\93\83O
\81A
\8cõ
\8c¹
\81A
\89e
\82Ì
\83L
\81[
\83t
\83\8c\81[
\83\80\82ª
5 *
\8bL
\98^
\82³
\82ê
\82é
\81B
8 * http://blog.goo.ne.jp/torisu_tetosuki/e/bc9f1c4d597341b394bd02b64597499d
9 * http://atupdate.web.fc2.com/vmd_format.htm
12 #ifndef MESH_IO_VMD_H_INCLUDED
13 #define MESH_IO_VMD_H_INCLUDED
26 typedef ::meshio::la::Vector2 Vector2;
27 typedef ::meshio::la::Vector3 Vector3;
28 typedef ::meshio::la::Quaternion Quaternion;
29 typedef ::meshio::color::fRGB fRGB;
31 ////////////////////////////////////////////////////////////
32 //!
\83\82\81[
\83V
\83\87\83\93
33 ////////////////////////////////////////////////////////////
38 char interpolationX[16];
39 char interpolationY[16];
40 char interpolationZ[16];
41 char interpolationRot[16];
43 inline std::ostream& operator<<(std::ostream &os, const BoneKey &rhs)
46 << "<BoneKey: " << rhs.pos << rhs.q << ">"
50 ////////////////////////////////////////////////////////////
52 ////////////////////////////////////////////////////////////
57 inline std::ostream& operator<<(std::ostream &os, const MorphKey &rhs)
60 << "<MorphKey: " << rhs.weight << ">"
65 ////////////////////////////////////////////////////////////
67 ////////////////////////////////////////////////////////////
70 //!
\89½
\82Ì
\8b\97\97£
\81H
74 //!
\83I
\83C
\83\89\81[
\8ap
77 char interpolation[24];
79 unsigned short viewAngle;
80 //!
\89\93\8bß
\8a´ 0
\82ªon
81 unsigned char perspective;
83 inline std::ostream& operator<<(std::ostream &os, const CameraKey &rhs)
86 << "<CameraKey: " << rhs.length
87 << rhs.pos << rhs.euler << ">"
92 ////////////////////////////////////////////////////////////
94 ////////////////////////////////////////////////////////////
100 inline std::ostream& operator<<(std::ostream &os, const LightKey &rhs)
103 << "<LightKey: " << rhs.color << rhs.pos << ">"
108 ////////////////////////////////////////////////////////////
109 //!
\83Z
\83\8b\83t
\83V
\83\83\83h
\83E
110 ////////////////////////////////////////////////////////////
115 ////////////////////////////////////////////////////////////
117 ////////////////////////////////////////////////////////////
121 typedef T VALUE_TYPE;
123 //!
\83t
\83\8c\81[
\83\80\94Ô
\8d\86
128 //!
\83t
\83\8c\81[
\83\80\94Ô
\8d\86\82Å
\83L
\81[
\82ð
\83\
\81[
\83g
\82·
\82é
129 bool operator<(const KeyFrame &rhs)const{ return frame<rhs.frame; }
132 ////////////////////////////////////////////////////////////
133 //! 1
\83`
\83\83\83\93\83l
\83\8b\95ª
\82Ì
\83L
\81[
\83t
\83\8c\81[
\83\80\82Ì
\83\8a\83X
\83g
\81B
134 //!
\93Ç
\82Ý
\8d\9e\82ñ
\82¾
\8cã
\82Å
\83t
\83\8c\81[
\83\80\94Ô
\8d\86\82Å
\83\
\81[
\83g
\82·
\82é
\81B
135 ////////////////////////////////////////////////////////////
139 typedef T KEYFRAME_TYPE;
141 std::vector<KEYFRAME_TYPE> list;
142 void sort(){ std::sort(list.begin(), list.end()); }
143 KEYFRAME_TYPE& push(unsigned int frame)
145 list.push_back(KEYFRAME_TYPE());
146 KEYFRAME_TYPE &keyFrame=list.back();
147 keyFrame.frame=frame;
150 unsigned int getFrame(int index)
152 return list[index].frame;
154 typename KEYFRAME_TYPE::VALUE_TYPE* getKey(int index)
156 return &list[index].key;
160 ////////////////////////////////////////////////////////////
162 ////////////////////////////////////////////////////////////
163 typedef KeyFrame<BoneKey> BoneKeyFrame;
164 typedef KeyFrameList<BoneKeyFrame> BoneKeyFrameList;
166 typedef KeyFrame<MorphKey> MorphKeyFrame;
167 typedef KeyFrameList<MorphKeyFrame> MorphKeyFrameList;
174 //!
\83\82\81[
\83V
\83\87\83\93
175 typedef std::map<std::wstring, BoneKeyFrameList*> BoneMap;
177 std::vector<std::wstring> boneKeys;
180 typedef std::map<std::wstring, MorphKeyFrameList*> MorphMap;
182 std::vector<std::wstring> morphKeys;
186 bool read(binary::IReader &reader);
187 bool read(const wchar_t *path);
188 bool read(const char *path);
189 bool write(std::ostream &os);
191 BoneKeyFrameList* getBoneKeyFrameList(const std::wstring &name);
192 MorphKeyFrameList* getMorphKeyFrameList(const std::wstring &name);
194 inline std::ostream& operator<<(std::ostream &os, const IO &rhs)
197 << "<VMD " << rhs.name << std::endl
198 << "[bones] " << rhs.boneMap.size() << std::endl
199 << "[morphs] " << rhs.morphMap.size() << std::endl
206 } // namespace meshio
208 #endif // MESH_IO_VMD_H_INCLUDED