- Edited
HuskyDreaming and here is the decoding part of the code:
Great, although iterating over individual floats and populating the array in GDScript might be a bit slow. Especially if you have a large buffer and need to do it every frame. In that case it may even defeat the purpose of using a compute shader. It'd be better to convert the whole buffer into a PackedVector3Array
with just one bytes_to_var()
call and then just slice out individual sub-arrays. Note that you'll need to push an additional 8 byte header to the beginning of the original byte buffer in order for bytes_to_var()
to interpreted the data correctly.