VOXELGENERATOR: added region:size()
parent
0544ba371f
commit
baf7ea7592
|
@ -158,6 +158,8 @@ They are available as e.g. `noise.noise2([...])`, `noise.fBm3([...])` and so on.
|
|||
|
||||
* `maxs()`: The upper boundary of the region (inclusive).
|
||||
|
||||
* `size()`: The size of the region in voxels (`ivec3`).
|
||||
|
||||
* `setMins(mins)`: The lower boundary of the region - given as `ivec3`.
|
||||
|
||||
* `setMaxs(maxs)`: The upper boundary of the region - given as `ivec3`.
|
||||
|
|
|
@ -342,6 +342,12 @@ static int luaVoxel_region_maxs(lua_State* s) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int luaVoxel_region_size(lua_State* s) {
|
||||
const voxel::Region* region = luaVoxel_toRegion(s, 1);
|
||||
clua_push(s, region->getDimensionsInVoxels());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int luaVoxel_region_setmins(lua_State* s) {
|
||||
voxel::Region* region = luaVoxel_toRegion(s, 1);
|
||||
const glm::ivec3& mins = clua_tovec<glm::ivec3>(s, 2);
|
||||
|
@ -600,6 +606,7 @@ static void prepareState(lua_State* s) {
|
|||
{"center", luaVoxel_region_center},
|
||||
{"mins", luaVoxel_region_mins},
|
||||
{"maxs", luaVoxel_region_maxs},
|
||||
{"size", luaVoxel_region_size},
|
||||
{"setMins", luaVoxel_region_setmins},
|
||||
{"setMaxs", luaVoxel_region_setmaxs},
|
||||
{"__tostring", luaVoxel_region_tostring},
|
||||
|
|
Loading…
Reference in New Issue