- SEE ALSO
- LICENSE AND COPYRIGHT
Games::EternalLands::Binary::Unitvec16 - 16-bit quantized unit vectors as used by Eternal Lands
use Games::EternalLands::Binary::Unitvec16 qw(pack_unitvec16 unpack_unitvec16); # Pack to an unsigned short (i.e. a 16-bit unsigned number) $short = pack_unitvec16([1, 0, 0]); # Unpack from an unsigned short $vector = unpack_unitvec16($short); ...
This module provides functions to pack and unpack 16-bit quantized unit vectors as used in certain game data files by Eternal Lands.
Takes a reference to an array of length 3 and returns a packed 16-bit integer.
Takes a 16-bit integer and returns a reference to an array with 3 floating-point elements in it.
Be sure to use the correct byte order if you are reading the 16-bit integers from a file or network packets. For Eternal Lands data, this will almost certainly be in little-endian byte order. So if your machine is not little-endian, remember to convert the data appropriately (see pack).
<coleminor at hush.ai>
Copyright (C) 2012 Cole Minor. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.