mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-24 13:37:44 +00:00
Expose shader keys, constants, samplers and shader values
This commit is contained in:
parent
b4a9c48823
commit
545888638e
1 changed files with 10 additions and 7 deletions
17
src/mtrl.rs
17
src/mtrl.rs
|
@ -69,7 +69,8 @@ pub struct ShaderKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
#[repr(C)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
struct Constant {
|
struct Constant {
|
||||||
constant_id: u32,
|
constant_id: u32,
|
||||||
|
@ -79,7 +80,8 @@ struct Constant {
|
||||||
|
|
||||||
// from https://github.com/NotAdam/Lumina/blob/master/src/Lumina/Data/Parsing/MtrlStructs.cs
|
// from https://github.com/NotAdam/Lumina/blob/master/src/Lumina/Data/Parsing/MtrlStructs.cs
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[repr(u8)]
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
enum TextureUsage {
|
enum TextureUsage {
|
||||||
#[brw(magic = 0x88408C04u32)]
|
#[brw(magic = 0x88408C04u32)]
|
||||||
Sampler,
|
Sampler,
|
||||||
|
@ -127,7 +129,8 @@ enum TextureUsage {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
#[repr(C)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
struct Sampler {
|
struct Sampler {
|
||||||
texture_usage: TextureUsage,
|
texture_usage: TextureUsage,
|
||||||
|
@ -170,13 +173,13 @@ struct MaterialData {
|
||||||
header: MaterialHeader,
|
header: MaterialHeader,
|
||||||
|
|
||||||
#[br(count = header.shader_key_count)]
|
#[br(count = header.shader_key_count)]
|
||||||
shader_keys: Vec<ShaderKey>,
|
pub shader_keys: Vec<ShaderKey>,
|
||||||
#[br(count = header.constant_count)]
|
#[br(count = header.constant_count)]
|
||||||
constants: Vec<Constant>,
|
pub constants: Vec<Constant>,
|
||||||
#[br(count = header.sampler_count)]
|
#[br(count = header.sampler_count)]
|
||||||
samplers: Vec<Sampler>,
|
pub samplers: Vec<Sampler>,
|
||||||
#[br(count = header.shader_value_list_size / 4)]
|
#[br(count = header.shader_value_list_size / 4)]
|
||||||
shader_values: Vec<f32>,
|
pub shader_values: Vec<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue