https://github.com/xtreme8000/libvxl
provides fast in-memory vxl access
https://github.com/xtreme8000/libvxl
ace-of-spades aos fast inmemory library map rle voxel voxlap vxl
Last synced: about 1 month ago
JSON representation
provides fast in-memory vxl access
- Host: GitHub
- URL: https://github.com/xtreme8000/libvxl
- Owner: xtreme8000
- License: mit
- Created: 2018-06-07T15:41:40.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-25T15:11:11.000Z (7 months ago)
- Last Synced: 2025-03-21T11:50:37.735Z (about 1 month ago)
- Topics: ace-of-spades, aos, fast, inmemory, library, map, rle, voxel, voxlap, vxl
- Language: C
- Homepage:
- Size: 59.6 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## libvxl
* read n' write Ace of Spades map files **easily** and **fast**
* compressed internal format derived from .vxl
* supports enhanced features for special cases:
* floating block detection
* get top layer block, useful for map overviewsAll functions use voxlap's coordinate system:

## Example
```C
//create map from v pointer
struct libvxl_map m;
libvxl_create(&m,512,512,64,v);//get color at position (x,y,z)
int col = libvxl_map_get(&m,x,y,z);//check if block is solid at (x,y,z)
int solid = libvxl_map_issolid(&m,x,y,z);//free map after use
libvxl_free(&m);
```## API functions
```C
//Load a map from memory or create an empty one
void libvxl_create(struct libvxl_map* map, int w, int h, int d, const void* data);
//Write a map to disk, uses libvxl_write() internally
void libvxl_writefile(struct libvxl_map* map, char* name);
//Compress the map back to vxl format and save it in out, the total byte size will be written to size
void libvxl_write(struct libvxl_map* map, void* out, int* size);
//Tells if a block is solid at location [x,y,z]
int libvxl_map_issolid(struct libvxl_map* map, int x, int y, int z);
//Tells if a block is visible on the surface, meaning it is exposed to air
int libvxl_map_onsurface(struct libvxl_map* map, int x, int y, int z);
//Read block color
int libvxl_map_get(struct libvxl_map* map, int x, int y, int z);
//Read color of topmost block (as seen from above at Z=0)
void libvxl_map_gettop(struct libvxl_map* map, int x, int y, int* result);
//Set block at location [x,y,z] to a new color
void libvxl_map_set(struct libvxl_map* map, int x, int y, int z, int color);
//Set location [x,y,z] to air, will destroy any block at this position
void libvxl_map_setair(struct libvxl_map* map, int x, int y, int z);
//Free a map from memory
void libvxl_free(struct libvxl_map* map);
```