Closed Checkmate50 closed 3 years ago
Concretely, this can be seen in the multicube example. What I would what instead is something like
let model_mat = BufferData::new(generate_identity_matrix());
let model_mat2 = BufferData::new(translate(model_mat2, 2.0, 0.0, 0.0));
I'm assuming you meant to use model_mat
to create model_mat2
. Since BufferData::new
is just a wrapper around the matrix and doesn't do anything with it, it seems pretty safe to just make it's data field public as I've done in 7a0125095916afa513f7b2acb0a4939303b2469f . This would allow you to write
let model_mat = BufferData::new(generate_identity_matrix());
let model_mat2 = BufferData::new(translate(model_mat.data, 2.0, 0.0, 0.0));
There's probably an alternative where I implement From/Into
for BufferData back into the inner data, something like
let model_mat = BufferData::new(generate_identity_matrix());
let model_mat2 = BufferData::new(translate(model_mat.into(), 2.0, 0.0, 0.0));
but I think just being able to access the field is fine.
Closed by #21
The following code snippet is a bit annoying, in that I need to declare an identity matrix before assigning it to two separate pieces of bufferData.
Perhaps it's an unavoidable part of the current BufferData paradigm, but it would be nice if I didn't need "in-between" matrices for each operation. Also, how does this work with a loop? Would I need to make a new piece of BufferData for each iteration of the loop?