Skip to content

Commit

Permalink
Expose underlying material constant data
Browse files Browse the repository at this point in the history
  • Loading branch information
redstrate committed Apr 27, 2024
1 parent 4948dd6 commit bccb050
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 5 additions & 10 deletions src/mtrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ pub struct physis_Material {
num_constants: u32,
constants: *mut Constant,
num_samplers: u32,
samplers: *mut Sampler,
num_shader_values: u32,
shader_values: *mut f32
samplers: *mut Sampler
}

impl Default for physis_Material {
Expand All @@ -37,9 +35,7 @@ impl Default for physis_Material {
num_constants: 0,
constants: null_mut(),
num_samplers: 0,
samplers: null_mut(),
num_shader_values: 0,
shader_values: null_mut()
samplers: null_mut()
}
}
}
Expand All @@ -58,7 +54,6 @@ pub extern "C" fn physis_material_parse(buffer: physis_Buffer) -> physis_Materia
let mut shader_keys = material.shader_keys.clone();
let mut constants = material.constants.clone();
let mut samplers = material.samplers.clone();
let mut shader_values = material.shader_values.clone();

let mat = physis_Material {
shpk_name: ffi_to_c_string(&material.shader_package_name),
Expand All @@ -69,13 +64,13 @@ pub extern "C" fn physis_material_parse(buffer: physis_Buffer) -> physis_Materia
num_constants: constants.len() as u32,
constants: constants.as_mut_ptr(),
num_samplers: samplers.len() as u32,
samplers: samplers.as_mut_ptr(),
num_shader_values: shader_values.len() as u32,
shader_values: shader_values.as_mut_ptr()
samplers: samplers.as_mut_ptr()
};

mem::forget(c_strings);
mem::forget(shader_keys);
mem::forget(constants);
mem::forget(samplers);

mat
} else {
Expand Down

0 comments on commit bccb050

Please sign in to comment.