serialize VEX function

Flattens an array of vector or matrix types into an array of floats.

Contexts: image3d, chop, cop, pop, sop, surface, displace, fog, light, shadow, photon, cvex

See also: unserialize

  1. float [] serialize(vector [])

  2. float [] serialize(vector4 [])

  3. float [] serialize(matrix3 [])

  4. float [] serialize(matrix4 [])

These functions will serialize the arrays of tuple values. That is, the values of the tuples are extracted one by one into a flat floating point array. For example:

vector v[] = { {1,2,3}, {7,8,9} }; // A vector[] of length 2
float  f[];

f = serialize(v);
// Now f[] has a length of 6 and equals { 1,2,3,7,8,9 }