13 breaking releases

0.14.0 Oct 31, 2024
0.12.0 Aug 16, 2024
0.11.0 Jul 19, 2024
0.7.0 Mar 15, 2024
0.2.0 Nov 22, 2023

#383 in Graphics APIs

Download history 128/week @ 2024-07-19 18/week @ 2024-07-26 1/week @ 2024-08-02 129/week @ 2024-08-16 5/week @ 2024-08-23 5/week @ 2024-08-30 158/week @ 2024-09-13 61/week @ 2024-09-20 34/week @ 2024-09-27 8/week @ 2024-10-04 78/week @ 2024-10-25 48/week @ 2024-11-01

126 downloads per month
Used in xc3_wgpu

MIT license

1MB
19K 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.json")?;

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

~24MB
~331K SLoC