get_instances_buffer_data: surely this is the same

This commit is contained in:
Quaternions 2024-02-07 16:22:11 -08:00
parent 1444718d88
commit 2049e2dd2c

View File

@ -997,7 +997,6 @@ const MODEL_BUFFER_SIZE_BYTES:usize=MODEL_BUFFER_SIZE*4;
fn get_instances_buffer_data(instances:&[GraphicsModelInstance]) -> Vec<f32> { fn get_instances_buffer_data(instances:&[GraphicsModelInstance]) -> Vec<f32> {
let mut raw = Vec::with_capacity(MODEL_BUFFER_SIZE*instances.len()); let mut raw = Vec::with_capacity(MODEL_BUFFER_SIZE*instances.len());
for (i,mi) in instances.iter().enumerate(){ for (i,mi) in instances.iter().enumerate(){
let mut v = raw.split_off(MODEL_BUFFER_SIZE*i);
//model transform //model transform
raw.extend_from_slice(&AsRef::<[f32; 4*4]>::as_ref(&mi.transform)[..]); raw.extend_from_slice(&AsRef::<[f32; 4*4]>::as_ref(&mi.transform)[..]);
//normal transform //normal transform
@ -1009,7 +1008,6 @@ fn get_instances_buffer_data(instances:&[GraphicsModelInstance]) -> Vec<f32> {
raw.extend_from_slice(&[0.0]); raw.extend_from_slice(&[0.0]);
//color //color
raw.extend_from_slice(AsRef::<[f32; 4]>::as_ref(&mi.color.get())); raw.extend_from_slice(AsRef::<[f32; 4]>::as_ref(&mi.color.get()));
raw.append(&mut v);
} }
raw raw
} }