namespace meshio {
namespace pmd {
+// IO
+bool IO::write(const char *path)
+{
+ binary::FileWriter w(path);
+ return write(w);
+}
+
+bool IO::write(const wchar_t *path)
+{
+ binary::FileWriter w(path);
+ return write(w);
+}
+
std::wstring
- Material::getTexture()const
- {
- return text::trim(text::to_WideChar(CP_OEMCP,
- std::string(texture, texture+20)));
- }
+IO::getName()const
+{
+ return text::trim(text::to_WideChar(CP_OEMCP,
+ std::string(name, name+20)));
+}
std::wstring
+IO::getComment()const
+{
+ return text::trim(text::to_WideChar(CP_OEMCP,
+ std::string(comment, comment+256)));
+}
+
+std::wstring
+IO::getEnglishName()const
+{
+ return text::trim(text::to_WideChar(CP_OEMCP,
+ std::string(english_name, english_name+20)));
+}
+
+std::wstring
+IO::getEnglishComment()const
+{
+ return text::trim(text::to_WideChar(CP_OEMCP,
+ std::string(english_comment, english_comment+256)));
+}
+
+const Vector2* IO::getUV(int index)const
+{
+ return &vertices[index].uv;
+}
+
+void IO::setName(const char *src)
+{
+ strncpy(name, src, 20);
+}
+
+void IO::setComment(const char *src)
+{
+ strncpy(comment, src, 256);
+}
+
+void IO::setEnglishName(const char *src)
+{
+ strncpy(english_name, src, 20);
+}
+
+void IO::setEnglishComment(const char *src)
+{
+ strncpy(english_comment, src, 256);
+}
+
+
+// Material
+std::wstring
+Material::getTexture()const
+{
+ return text::trim(text::to_WideChar(CP_OEMCP,
+ std::string(texture, texture+20)));
+}
+
+void Material::setTexture(const char *src)
+{
+ strncpy(texture, src, 20);
+}
+
+// Bone
+std::wstring
Bone::getName()const
{
return text::trim(text::to_WideChar(CP_OEMCP,
std::string(name, name+20)));
}
+void Bone::setName(const char *src)
+{
+ strncpy(name, src, 20);
+}
+
+void Bone::setEnglishName(const char *src)
+{
+ strncpy(english_name, src, 20);
+}
+
+// Morph
std::wstring
Morph::getName()const
{
pos_list.push_back(Vector3(x, y, z));
}
+void Morph::setName(const char *src)
+{
+ strncpy(name, src, 20);
+}
+
+void Morph::setEnglishName(const char *src)
+{
+ strncpy(english_name, src, 20);
+}
+
+// BoneGroup
std::wstring
BoneGroup::getName()const
{
std::string(name, name+50)));
}
-std::wstring
- IO::getName()const
- {
- return text::trim(text::to_WideChar(CP_OEMCP,
- std::string(name, name+20)));
- }
+void BoneGroup::setName(const char *src)
+{
+ strncpy(name, src, 50);
+}
-std::wstring
- IO::getEnglishName()const
- {
- return text::trim(text::to_WideChar(CP_OEMCP,
- std::string(english_name, english_name+20)));
- }
+void BoneGroup::setEnglishName(const char *src)
+{
+ strncpy(english_name, src, 50);
+}
+// RigidBody
std::wstring
RigidBody::getName()const
{
std::string(name, name+20)));
}
+void RigidBody::setName(const char *src)
+{
+ strncpy(name, src, 20);
+}
+
+// Constraint
std::wstring
Constraint::getName()const
{
std::string(name, name+20)));
}
+void Constraint::setName(const char *src)
+{
+ strncpy(name, src, 20);
+}
+
+// ToonTexture
std::wstring
ToonTexture::getName()const
{
std::string(name, name+100)));
}
+void ToonTexture::setName(const char *src)
+{
+ strncpy(name, src, 100);
+}
+
+
// 38bytes
template<class READER>
void
bone.parent=&bones[bone.parent_index];
bone.parent->children.push_back(&bone);
}
- if(bone.tail_index!=0){
+ if(bone.tail_index==0){
+ bone.tail=Vector3(0, 0, 0);
+ }
+ else{
bone.tail=bones[bone.tail_index].pos;
}
}
w.writeArray<WORD>(&face_list[0], face_list.size());
}
- // bone naem list
+ // bone name list
//std::cout << "bone name list" << std::endl;
w.writeValue<BYTE>(bone_group_list.size());
for(size_t i=0; i<bone_group_list.size(); ++i){
w.writeArray<char>(bones[i].english_name, 20);
}
+ // skip base
for(size_t i=1; i<morph_list.size(); ++i){
w.writeArray<char>(morph_list[i].english_name, 20);
}
return true;
}
-bool IO::write(const char *path)
-{
- binary::FileWriter w(path);
- return write(w);
-}
-
-bool IO::write(const wchar_t *path)
-{
- binary::FileWriter w(path);
- return write(w);
-}
-
-const Vector2* IO::getUV(int index)const
-{
- return &vertices[index].uv;
-}
-
-void Bone::setName(const char *src)
-{
- strncpy(name, src, 20);
-}
-
-void Bone::setEnglishName(const char *src)
-{
- strncpy(english_name, src, 20);
-}
-
-void BoneGroup::setName(const char *src)
-{
- strncpy(name, src, 20);
-}
-
-void BoneGroup::setEnglishName(const char *src)
-{
- strncpy(english_name, src, 20);
-}
-
-void Morph::setName(const char *src)
-{
- strncpy(name, src, 20);
-}
-
-void Morph::setEnglishName(const char *src)
-{
- strncpy(english_name, src, 20);
-}
-
-void RigidBody::setName(const char *src)
-{
- strncpy(name, src, 20);
-}
-
-void Constraint::setName(const char *src)
-{
- strncpy(name, src, 20);
-}
-
-void Material::setTexture(const char *src)
-{
- strncpy(texture, src, 20);
-}
-
-void ToonTexture::setName(const char *src)
-{
- strncpy(name, src, 100);
-}
-
} // namespace
} // namespace