14 breaking releases

0.15.0 Nov 27, 2024
0.13.0 Sep 18, 2024
0.11.0 Jul 19, 2024
0.7.0 Mar 15, 2024
0.2.0 Nov 22, 2023

#336 in Graphics APIs

Download history 9/week @ 2024-08-26 192/week @ 2024-09-16 35/week @ 2024-09-23 34/week @ 2024-09-30 123/week @ 2024-10-28 7/week @ 2024-11-04 5/week @ 2024-11-18 138/week @ 2024-11-25 23/week @ 2024-12-02 27/week @ 2024-12-09

193 downloads per month
Used in xc3_wgpu

MIT license

1MB
20K SLoC

xc3_model

xc3_model is a high level library for xc3_lib.

xc3_model provides a simple, standardized interface for working with models, textures, materials, and animations. All models and maps from all supported game versions are converted to the same set of types. This greatly reduces the amount of code needed for applications and libraries to work with in game models.

xc3_model has limited support for converting data back to xc3_lib types to enable saving changes to disk. The goal is for the resulting file structs to be functionally equivalent in game even if the data changes slightly due to simplifying assumptions or adjustments to improve cross game compatibility.

Python bindings for xc3_model are available with xc3_model_py.


lib.rs:

xc3_model

xc3_model provides high level data access for the files that make up a model.

Each type represents fully compressed and decoded data associated with one or more [xc3_lib] types. This simplifies the processing that needs to be done to access model data and abstracts away most of the game specific complexities.

Getting Started

Loading a normal model returns a single [ModelRoot]. Loading a map returns multiple [ModelRoot]. Each [ModelRoot] has its own set of images.

The [ShaderDatabase] is optional and improves the accuracy of texture and material assignments.

use xc3_model::shader_database::ShaderDatabase;

let database = ShaderDatabase::from_file("xc3.bin")?;

let root = xc3_model::load_model("ch01011013.wimdo", Some(&database))?;
println!("{}", root.image_textures.len());

let roots = xc3_model::load_map("ma59a.wismhd", Some(&database))?;
println!("{}", roots[0].image_textures.len());

Dependencies

~23MB
~311K SLoC