wc-duck / datalibrary

Open Source Data Library for data serialization.
Other
42 stars 8 forks source link

Add support for specifying structs as arrays. #34

Closed wc-duck closed 7 years ago

wc-duck commented 8 years ago

Currently all instances in the text-format is specified as structs. This is the best solution in most cases but for example vec3:s etc is really cumbersome.

Today that would be: { "x" : 1, "y" : 2, "z" : 3 }

Try that with a mat4x4 and you will just give up ;)

By adding support for parsing structs from arrays one can get a lot nicer.

[ 1, 2, 3 ] or mat4x4 [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]

This should be possible by just adding the rules if an array is encountered where a struct is expected the array will be parsed as if the members where in order in the array and all members need to be set.

wc-duck commented 7 years ago

Fixed.