1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-20 11:47:46 +00:00

Actually expose those new material parameters

This commit is contained in:
Joshua Goins 2024-04-27 12:15:54 -04:00
parent 6995392b5b
commit 499081beb2

View file

@ -72,7 +72,7 @@ pub struct ShaderKey {
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
#[repr(C)] #[repr(C)]
#[allow(dead_code)] #[allow(dead_code)]
struct Constant { pub struct Constant {
constant_id: u32, constant_id: u32,
value_offset: u16, value_offset: u16,
value_size: u16, value_size: u16,
@ -82,7 +82,7 @@ struct Constant {
#[binrw] #[binrw]
#[repr(u8)] #[repr(u8)]
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
enum TextureUsage { pub enum TextureUsage {
#[brw(magic = 0x88408C04u32)] #[brw(magic = 0x88408C04u32)]
Sampler, Sampler,
#[brw(magic = 0x213CB439u32)] #[brw(magic = 0x213CB439u32)]
@ -132,7 +132,7 @@ enum TextureUsage {
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
#[repr(C)] #[repr(C)]
#[allow(dead_code)] #[allow(dead_code)]
struct Sampler { pub struct Sampler {
texture_usage: TextureUsage, texture_usage: TextureUsage,
flags: u32, // TODO: unknown flags: u32, // TODO: unknown
#[br(pad_after = 3)] #[br(pad_after = 3)]
@ -173,13 +173,13 @@ struct MaterialData {
header: MaterialHeader, header: MaterialHeader,
#[br(count = header.shader_key_count)] #[br(count = header.shader_key_count)]
pub shader_keys: Vec<ShaderKey>, shader_keys: Vec<ShaderKey>,
#[br(count = header.constant_count)] #[br(count = header.constant_count)]
pub constants: Vec<Constant>, constants: Vec<Constant>,
#[br(count = header.sampler_count)] #[br(count = header.sampler_count)]
pub samplers: Vec<Sampler>, samplers: Vec<Sampler>,
#[br(count = header.shader_value_list_size / 4)] #[br(count = header.shader_value_list_size / 4)]
pub shader_values: Vec<f32>, shader_values: Vec<f32>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -187,6 +187,9 @@ pub struct Material {
pub shader_package_name: String, pub shader_package_name: String,
pub texture_paths: Vec<String>, pub texture_paths: Vec<String>,
pub shader_keys: Vec<ShaderKey>, pub shader_keys: Vec<ShaderKey>,
pub constants: Vec<Constant>,
pub samplers: Vec<Sampler>,
pub shader_values: Vec<f32>,
} }
impl Material { impl Material {
@ -228,6 +231,9 @@ impl Material {
shader_package_name, shader_package_name,
texture_paths, texture_paths,
shader_keys: mat_data.shader_keys, shader_keys: mat_data.shader_keys,
constants: mat_data.constants,
samplers: mat_data.samplers,
shader_values: mat_data.shader_values
}) })
} }
} }