8 releases (breaking)

0.7.0 Mar 15, 2024
0.6.0 Feb 16, 2024
0.5.0 Jan 27, 2024
0.4.1 Jan 18, 2024
0.1.0 Oct 29, 2023

#394 in Graphics APIs

Download history 6/week @ 2023-12-23 17/week @ 2024-01-13 2/week @ 2024-01-27 67/week @ 2024-02-10 91/week @ 2024-02-17 21/week @ 2024-02-24 1/week @ 2024-03-02 64/week @ 2024-03-09 41/week @ 2024-03-16 5/week @ 2024-03-23 32/week @ 2024-03-30 1/week @ 2024-04-06

143 downloads per month

MIT license

765KB
17K SLoC

xc3_wgpu

A Xenoblade Chronicles model rendering library using xc3_model and wgpu.


lib.rs:

xc3_wgpu

A Xenoblade Chronicles model rendering library.

Xenoblade 1 DE, Xenoblade 2, and Xenoblade 3 are all supported with Xenoblade 1 DE receiving the least testing.

Getting Started

The first step is to initialize an [Xc3Renderer]. This only needs to be done once since the renderer can be updated using methods as screen size and parameters change. The initial size should match the current window dimensions.

Models and maps are all loaded from the same [xc3_model] types. The shader database is optional but will improve rendering accuracy.

In each frame, render the [ModelGroup] using Xc3Renderer::render_models.

use xc3_wgpu::{MonolibShaderTextures, Xc3Renderer};
use xc3_model::shader_database::ShaderDatabase;

let monolib_shader = MonolibShaderTextures::from_file(&device, &queue, "monolib/shader");
let renderer = Xc3Renderer::new(&device, &queue, 1920, 1080, &monolib_shader);

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

let root = xc3_model::load_model("ch01011013.wimdo", Some(&database))?;
let groups = xc3_wgpu::load_model(&device, &queue, &[root], &monolib_shader);

let roots = xc3_model::load_map("ma59a.wismhd", Some(&database))?;
let groups = xc3_wgpu::load_model(&device, &queue, &roots, &monolib_shader);

Animation

Skeletal animations should use Models::update_bone_transforms and the Animation type from [xc3_model].

Dependencies

~25–58MB
~790K SLoC