16个版本 (8个破坏性更新)
0.9.0 | 2022年2月19日 |
---|---|
0.8.2 | 2021年11月20日 |
0.7.0 | 2021年11月20日 |
0.6.1 | 2021年2月15日 |
0.1.1 | 2020年3月27日 |
#1418 in 解析器实现
85 每月下载次数
105KB
2.5K SLoC
PMXUtil
用Rust编写的PMX读写器
这个crate能做什么
所有与pmx相关的任务。
符合性测试
通过PMX 2.0 I/O测试
- 读取原始文件并将其写入另一个文件
- 通过
cargo test
比较这些文件 - 通过WinMerge比较这些文件
正在进行中
- 改进文档
如何使用
创建读取器实例并读取
let mut loader= ModelInfoStage::open("/path/to/pmxfile").unwrap();
let header = loader.get_header();
println!("{:#?}", header);
let (model_info, ns) = loader.read_pmx_model_info();
print!("{:#?}", model_info);
let (vertices, ns) =ns.read_pmx_vertices();
print!("{}", vertices);
let (faces, ns) = ns.read_pmx_faces();
println!("{}", faces);
let (textures, ns) = ns.read_texture_list();
println!("{}", textures);
let (materials, ns) = ns.read_pmx_materials();
println!("{:#?}", materials);
创建写入器实例并写入
you can choose text encoding UTF-8 or UTF-16LE but MMD only support UTF-16LE.
use pmx_util::writer::Writer;
let mut writer =Writer::begin_writer("/path/to/pmxfile").unwrap();
writer.set_model_info(
&ModelInfo{
name:"A Model Name in your local language".to_owned()
name_en:"A Model Name in english".to_owned()
comment:"Comment in you local language".to_owned()
comment_en:"Comment in english".to_owned()
}
);
writer.add_vertices(&vertices);
writer.add_faces(&faces);
writer.add_textures(&textures);
writer.add_materials(&materials);
writer.add_bones(&bones);
writer.add_morphs(&morphs);
Writer::write(writer);
注意
依赖
~3.5MB
~120K SLoC