7 releases (breaking)

0.7.0 Mar 15, 2024
0.6.0 Feb 16, 2024
0.5.0 Jan 27, 2024
0.4.0 Jan 17, 2024
0.1.0 Oct 29, 2023

#389 in Graphics APIs

Download history 8/week @ 2023-12-19 18/week @ 2024-01-16 22/week @ 2024-01-23 151/week @ 2024-02-13 11/week @ 2024-02-20 34/week @ 2024-02-27 115/week @ 2024-03-12 14/week @ 2024-03-19 34/week @ 2024-04-02

163 downloads per month
Used in xc3_wgpu

MIT license

615KB
14K 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

~22MB
~277K SLoC