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
25 typedef ::meshio::la::Vector2 Vector2;
26 typedef ::meshio::la::Vector3 Vector3;
27 typedef ::meshio::la::Quaternion Quaternion;
28 typedef ::meshio::color::fRGB fRGB;
30 ////////////////////////////////////////////////////////////
31 //!
\83\82\81[
\83V
\83\87\83\93
32 ////////////////////////////////////////////////////////////
37 char interpolationX[16];
38 char interpolationY[16];
39 char interpolationZ[16];
40 char interpolationRot[16];
42 inline std::ostream& operator<<(std::ostream &os, const BoneKey &rhs)
45 << "<BoneKey: " << rhs.pos << rhs.q << ">"
49 ////////////////////////////////////////////////////////////
51 ////////////////////////////////////////////////////////////
56 inline std::ostream& operator<<(std::ostream &os, const MorphKey &rhs)
59 << "<MorphKey: " << rhs.weight << ">"
64 ////////////////////////////////////////////////////////////
66 ////////////////////////////////////////////////////////////
69 //!
\89½
\82Ì
\8b\97\97£
\81H
73 //!
\83I
\83C
\83\89\81[
\8ap
76 char interpolation[24];
78 unsigned short viewAngle;
79 //!
\89\93\8bß
\8a´ 0
\82ªon
80 unsigned char perspective;
82 inline std::ostream& operator<<(std::ostream &os, const CameraKey &rhs)
85 << "<CameraKey: " << rhs.length
86 << rhs.pos << rhs.euler << ">"
91 ////////////////////////////////////////////////////////////
93 ////////////////////////////////////////////////////////////
99 inline std::ostream& operator<<(std::ostream &os, const LightKey &rhs)
102 << "<LightKey: " << rhs.color << rhs.pos << ">"
107 ////////////////////////////////////////////////////////////
108 //!
\83Z
\83\8b\83t
\83V
\83\83\83h
\83E
109 ////////////////////////////////////////////////////////////
114 ////////////////////////////////////////////////////////////
116 ////////////////////////////////////////////////////////////
120 typedef T VALUE_TYPE;
122 //!
\83t
\83\8c\81[
\83\80\94Ô
\8d\86
127 //!
\83t
\83\8c\81[
\83\80\94Ô
\8d\86\82Å
\83L
\81[
\82ð
\83\
\81[
\83g
\82·
\82é
128 bool operator<(const KeyFrame &rhs)const{ return frame<rhs.frame; }
131 ////////////////////////////////////////////////////////////
132 //! 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
133 //!
\93Ç
\82Ý
\8d\9e\82ñ
\82¾
\8cã
\82Å
\83t
\83\8c\81[
\83\80\94Ô
\8d\86\82Å
\83\
\81[
\83g
\82·
\82é
\81B
134 ////////////////////////////////////////////////////////////
138 typedef T KEYFRAME_TYPE;
140 std::vector<KEYFRAME_TYPE> list;
141 void sort(){ std::sort(list.begin(), list.end()); }
142 KEYFRAME_TYPE& push(unsigned int frame)
144 list.push_back(KEYFRAME_TYPE());
145 KEYFRAME_TYPE &keyFrame=list.back();
146 keyFrame.frame=frame;
149 unsigned int getFrame(int index)
151 return list[index].frame;
153 typename KEYFRAME_TYPE::VALUE_TYPE* getKey(int index)
155 return &list[index].key;
159 ////////////////////////////////////////////////////////////
161 ////////////////////////////////////////////////////////////
162 typedef KeyFrame<BoneKey> BoneKeyFrame;
163 typedef KeyFrameList<BoneKeyFrame> BoneKeyFrameList;
165 typedef KeyFrame<MorphKey> MorphKeyFrame;
166 typedef KeyFrameList<MorphKeyFrame> MorphKeyFrameList;
173 //!
\83\82\81[
\83V
\83\87\83\93
174 typedef std::map<std::wstring, BoneKeyFrameList*> BoneMap;
176 std::vector<std::wstring> boneKeys;
179 typedef std::map<std::wstring, MorphKeyFrameList*> MorphMap;
181 std::vector<std::wstring> morphKeys;
185 bool read(binary::IReader &reader);
186 bool read(const wchar_t *path);
187 bool read(const char *path);
188 bool write(std::ostream &os);
190 BoneKeyFrameList* getBoneKeyFrameList(const std::wstring &name);
191 MorphKeyFrameList* getMorphKeyFrameList(const std::wstring &name);
193 inline std::ostream& operator<<(std::ostream &os, const IO &rhs)
196 << "<VMD " << rhs.name << std::endl
197 << "[bones] " << rhs.boneMap.size() << std::endl
198 << "[morphs] " << rhs.morphMap.size() << std::endl
205 } // namespace meshio
207 #endif // MESH_IO_VMD_H_INCLUDED