3 * MMD
\82Ì
\83\82\83f
\83\8b\83f
\81[
\83^
\81B
\83o
\83C
\83i
\83\8a\8c`
\8e®
\82Å
\82Ð
\82Æ
\82Â
\82Ì
\92¸
\93_
\82ª
\8dÅ
\91å
\82Q
\82Â
\82Ü
\82Å
\82Ì
\83{
\81[
\83\93\82Ì
4 *
\83E
\83F
\83C
\83g
\82ð
\95Û
\8e\9d\82·
\82é
\92P
\88ê
\82Ì
\92¸
\93_
\94z
\97ñ
\82Æ
\92¸
\93_
\83C
\83\93\83f
\83b
\83N
\83X
\94z
\97ñ
\82ð
\82à
\82Â
\81B
\96Ê
\82Í
5 *
\8eO
\8ap
\8c`
\82Ì
\82Ý
\81B
6 *
\82Ü
\82½
\95\
\8fî
\83\82\81[
\83t
\83B
\83\93\83O
\8fî
\95ñ
\81A
\95¨
\97\9d\89\89\8eZ
\8cü
\82¯
\82Ì
\8d\84\91Ì
\8fî
\95ñ
\82Æ
\8dS
\91©
\8fî
\95ñ
\82È
\82Ç
\82ð
\82à
\82Â
\81B
18 *
\92¸
\93_
\96@
\90ü
\82ª
\8ai
\94[
\8dÏ
\82Ý
\81B
20 *
\83\81\83b
\83V
\83\85
21 *
\8dÅ
\91å
\92¸
\93_
\90\94
22 *
\8dÅ
\91å
\8eO
\8ap
\8c`
\90\94
24 *
\97 \96Ê
\82Ì
\88µ
\82¢
25 *
\83I
\83\8a\83W
\83i
\83\8b\82Å
\82Í
\83o
\83b
\83N
\83J
\83\8a\83\93\83O
\82ð
\82µ
\82Ä
\82¢
\82È
\82¢
\82Ì
\82Å
\82â
\82é
\8fê
\8d\87\82Í
\83\82\83f
\83\8b\8cÂ
\95Ê
\82É
26 *
\91Î
\89\9e\82ª
\95K
\97v
\81B
28 *
\8eQ
\8dl
\83T
\83C
\83g
29 * http://blog.goo.ne.jp/torisu_tetosuki/e/209ad341d3ece2b1b4df24abf619d6e4
32 #ifndef MESH_IO_PMD_H_INCLUDED
33 #define MESH_IO_PMD_H_INCLUDED
43 typedef ::meshio::la::Vector2 Vector2;
44 typedef ::meshio::la::Vector3 Vector3;
45 typedef ::meshio::la::Vector4 Vector4;
46 typedef ::meshio::color::fRGBA fRGBA;
47 typedef ::meshio::color::fRGB fRGB;
49 ////////////////////////////////////////////////////////////
51 ////////////////////////////////////////////////////////////
56 //!
\96@
\90ü
\83x
\83N
\83g
\83\8b
58 //!
\83e
\83N
\83X
\83`
\83\83UV
60 //!
\83u
\83\8c\83\93\83f
\83B
\83\93\83O
\83{
\81[
\83\931
62 //!
\83u
\83\8c\83\93\83f
\83B
\83\93\83O
\83{
\81[
\83\932
64 //!
\83E
\83F
\83C
\83g[0 - 100]
65 unsigned char weight0;
67 unsigned char edge_flag;
69 inline std::ostream &operator<<(std::ostream &os, const Vertex &rhs)
74 << " normal:" << rhs.normal
76 << " bone0:" << rhs.bone0
77 << " bone1:" << rhs.bone1
78 << " weight0:" << (int)rhs.weight0
79 << " edge_flag:" << (int)rhs.edge_flag
85 ////////////////////////////////////////////////////////////
87 ////////////////////////////////////////////////////////////
98 //!
\83g
\83D
\81[
\83\93\83e
\83N
\83X
\83`
\83\83
99 unsigned char toon_index;
102 //!
\96Ê
\92¸
\93_
\90\94
103 unsigned int vertex_count;
104 //!
\83e
\83N
\83X
\83`
\83\83
107 std::wstring getTexture()const;
109 inline std::ostream &operator<<(std::ostream &os,
114 << " diffuse:" << rhs.diffuse
115 << " toon_index:" << (int)rhs.toon_index
116 << " flag:" << (int)rhs.flag
117 << " vertex_count:" << rhs.vertex_count
118 << " texture:" << rhs.texture
124 ////////////////////////////////////////////////////////////
126 ////////////////////////////////////////////////////////////
127 //!
\83{
\81[
\83\93\82Ì
\8eí
\97Þ
132 //
\89ñ
\93]
\82Æ
\88Ú
\93®
140 //
\89ñ
\93]
\89e
\8b¿
\89º
141 BONE_ROTATE_INFLUENCED,
155 //!
\90e
\83{
\81[
\83\93
156 unsigned short parent_index;
157 //!
\8eq
\83{
\81[
\83\93
158 unsigned short tail_index;
159 //!
\83{
\81[
\83\93\8eí
\97Þ
161 //!
\89e
\8b¿IK
\83{
\81[
\83\93
162 unsigned short ik_index;
163 //
\83{
\81[
\83\93\8dÀ
\95W
166 char english_name[20];
167 //!
\83{
\81[
\83\93\8aK
\91w
\8d\
\92z
\97p
170 std::vector<Bone*> children;
171 unsigned short index;
176 std::wstring getName()const;
178 inline std::ostream &operator<<(std::ostream &os,
183 << '"' << rhs.name << '"'
189 ////////////////////////////////////////////////////////////
191 ////////////////////////////////////////////////////////////
194 //! IK(IK
\83^
\81[
\83Q
\83b
\83g)
195 unsigned short index;
196 //! Target(
\83G
\83t
\83F
\83N
\83^
\81[)
197 unsigned short target;
198 //!
\83G
\83t
\83F
\83N
\83^
\82É
\98A
\93®
\82·
\82é
\83{
\81[
\83\93\90\94
199 unsigned char length;
200 //! IK
\92l1
\81BCCD-IK
\8e\8e\8ds
\89ñ
\90\94
201 unsigned short iterations;
202 //! IK
\92l2
\81BCCD-IK
\8e\8e\8ds
\88ê
\89ñ
\95Ó
\82è
\82Ì
\89e
\8b¿
\93x
204 //!
\83G
\83t
\83F
\83N
\83^
\82É
\98A
\93®
\82·
\82é
\83{
\81[
\83\93(
\8aî
\96{
\93I
\82É
\90e
\83{
\81[
\83\93\82É
\91k
\82é)
205 std::vector<unsigned short> children;
207 inline std::ostream &operator<<(std::ostream &os, const IK &rhs)
216 ////////////////////////////////////////////////////////////
218 ////////////////////////////////////////////////////////////
219 //!
\95\
\8fî
\82Ì
\8eí
\97Þ
222 //!
\83x
\81[
\83X
\95\
\8fî
237 //!
\8eg
\97p
\82·
\82é
\92¸
\93_
\90\94
238 unsigned int vertex_count;
242 std::vector<unsigned int> indices;
244 std::vector<Vector3> pos_list;
246 char english_name[20];
248 void append(int index, float x, float y, float z);
249 std::wstring getName()const;
251 inline std::ostream &operator<<(std::ostream &os, const Morph &rhs)
255 << '"' << rhs.name << '"'
261 ////////////////////////////////////////////////////////////
262 //!
\83{
\81[
\83\93\95\
\8e¦
\98g
263 ////////////////////////////////////////////////////////////
264 struct BoneDisplayName
267 char english_name[50];
270 ////////////////////////////////////////////////////////////
271 //!
\83g
\83D
\81[
\83\93\83e
\83N
\83X
\83`
\83\83
272 ////////////////////////////////////////////////////////////
278 ////////////////////////////////////////////////////////////
280 ////////////////////////////////////////////////////////////
288 //!
\83J
\83v
\83Z
\83\8b
291 //!
\8d\84\91Ì
\83^
\83C
\83v
294 //!
\83{
\81[
\83\93\82Æ
\93¯
\82¶
\93®
\82«
295 RIGIDBODY_KINEMATICS=0,
296 //!
\95¨
\97\9d\89\89\8eZ
298 //!
\95¨
\97\9d\89\89\8eZ
\8c\8b\89Ê
\82ð
\83{
\81[
\83\93\82É
\94½
\89f
\82·
\82é
299 RIGIDBODY_PHYSICS_WITH_BONE,
306 //!
\8aÖ
\98A
\83{
\81[
\83\93(
\83{
\81[
\83\93\92Ç
\8f]
\82Æ
\83{
\81[
\83\93\88Ê
\92u
\8d\87\82í
\82¹
\82Å
\95K
\97v)
307 unsigned short boneIndex;
308 //!
\83O
\83\8b\81[
\83v
310 //!
\94ñ
\8fÕ
\93Ë
\83O
\83\8b\81[
\83v
311 unsigned short target;
313 SHAPE_TYPE shapeType;
323 //!
\95¨
\97\9d\89\89\8eZ
\83p
\83\89\83\81\81[
\83^(bullet)
325 float angularDamping;
328 //!
\8d\84\91Ì
\83^
\83C
\83v
329 PROCESS_TYPE processType;
332 //! Joint(
\95¨
\97\9d\89\89\8eZ
\82Å
\82ÌJoint
\82ÆConstraint
\82Í
\93¯
\82¶
\88Ó
\96¡)
337 //!
\90Ú
\91±
\8d\84\91ÌA
339 //!
\90Ú
\91±
\8d\84\91ÌB
346 Vector3 constraintPosMin;
347 Vector3 constraintPosMax;
349 Vector3 constraintRotMin;
350 Vector3 constraintRotMax;
357 ///////////////////////////////////////////////////////////////////////////////
359 ///////////////////////////////////////////////////////////////////////////////
365 std::vector<Vertex> vertices;
366 std::vector<unsigned short> indices;
367 std::vector<Material*> materials;
368 std::vector<Bone> bones;
369 std::vector<IK> ik_list;
370 std::vector<Morph> morph_list;
371 std::vector<unsigned short> face_list;
372 std::vector<BoneDisplayName> bone_display_name_list;
373 std::vector<std::pair<unsigned short, unsigned char> > bone_display_list;
374 ToonTexture toon_textures[10];
375 std::vector<RigidBody> rigidbodies;
376 std::vector<Constraint> constraints;
378 char english_name[20];
379 char english_comment[256];
383 bool read(binary::IReader &reader);
384 //bool read(const char *path);
385 bool read(const wchar_t *path);
386 bool write(binary::IWriter &writer);
387 bool write(const char *path);
389 const Vector2* getUV(int index)const;
390 std::wstring getName()const;
392 inline std::ostream &operator<<(std::ostream &os, const IO &rhs)
395 << "<PMD " << rhs.name << std::endl
396 << rhs.comment << std::endl
397 << "[vertices] " << rhs.vertices.size() << std::endl
398 << "[indices] " << rhs.indices.size() << std::endl
399 << "[materials] " << rhs.materials.size() << std::endl
402 std::copy(rhs.materials.begin(), rhs.materials.end(),
403 std::ostream_iterator<Material>(os, ""));
406 << "[bones] " << rhs.bones.size() << std::endl
408 std::copy(rhs.bones.begin(), rhs.bones.end(),
409 std::ostream_iterator<Bone>(os, ""));
412 << "[ik] " << rhs.ik_list.size() << std::endl
414 std::copy(rhs.ik_list.begin(), rhs.ik_list.end(),
415 std::ostream_iterator<IK>(os, ""));
418 << "[morph] " << rhs.morph_list.size() << std::endl
420 std::copy(rhs.morph_list.begin(), rhs.morph_list.end(),
421 std::ostream_iterator<Morph>(os, ""));
432 } // namespace meshio
434 #endif // MESH_IO_PMD_H_INCLUDED