summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-05-17 03:38:39 -0400
committerkwolekr <kwolekr@minetest.net>2015-05-17 04:04:17 -0400
commit4c9a8a91c4988b3567a38af622a3eb0d0ec19f6b (patch)
tree1be726a192c20df25e44ff799102199a29ff6744 /doc
parentc0edb8e313590efcf473e02ab46dd967774386d0 (diff)
downloadminetest-4c9a8a91c4988b3567a38af622a3eb0d0ec19f6b.tar.gz
minetest-4c9a8a91c4988b3567a38af622a3eb0d0ec19f6b.tar.bz2
minetest-4c9a8a91c4988b3567a38af622a3eb0d0ec19f6b.zip
SAPI/Noise: Add PerlinNoiseMap:getMapSlice() function
This adds the ability to grab 'slices' of noise calculated by PerlinNoiseMap. Retrieving smaller slices of noise from the computation result as needed optimizes memory usage while maintaining a reasonable amount of CPU overhead.
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt22
1 files changed, 18 insertions, 4 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index b4a5fa1d8..2acb94a68 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -2640,16 +2640,30 @@ Format of `size` is `{x=dimx, y=dimy, z=dimz}`. The `z` conponent is ommitted
for 2D noise, and it must be must be larger than 1 for 3D noise (otherwise
`nil` is returned).
+For each of the functions with an optional `buffer` parameter: If `buffer` is not
+nil, this table will be used to store the result instead of creating a new table.
+
+
#### Methods
* `get2dMap(pos)`: returns a `<size.x>` times `<size.y>` 2D array of 2D noise
with values starting at `pos={x=,y=}`
* `get3dMap(pos)`: returns a `<size.x>` times `<size.y>` times `<size.z>` 3D array
of 3D noise with values starting at `pos={x=,y=,z=}`
-* `get2dMap_flat(pos)`: returns a flat `<size.x * size.y>` element array of 2D noise
+* `get2dMap_flat(pos, buffer)`: returns a flat `<size.x * size.y>` element array of 2D noise
with values starting at `pos={x=,y=}`
- * if the param `buffer` is present, this table will be used to store the result instead
-* `get3dMap_flat(pos)`: Same as `get2dMap_flat`, but 3D noise
- * if the param `buffer` is present, this table will be used to store the result instead
+* `get3dMap_flat(pos, buffer)`: Same as `get2dMap_flat`, but 3D noise
+* `calc2dMap(pos)`: Calculates the 2d noise map starting at `pos`. The result is stored internally.
+* `calc3dMap(pos)`: Calculates the 3d noise map starting at `pos`. The result is stored internally.
+* `getMapSlice(slice_offset, slice_size, buffer)`: In the form of an array, returns a slice of the
+ most recently computed noise results. The result slice begins at coordinates `slice_offset` and
+ takes a chunk of `slice_size`.
+ E.g. to grab a 2-slice high horizontal 2d plane of noise starting at buffer offset y = 20:
+ `noisevals = noise:getMapSlice({y=20}, {y=2})`
+ It is important to note that `slice_offset` offset coordinates begin at 1, and are relative to
+ the starting position of the most recently calculated noise.
+ To grab a single vertical column of noise starting at map coordinates x = 1023, y=1000, z = 1000:
+ `noise:calc3dMap({x=1000, y=1000, z=1000})`
+ `noisevals = noise:getMapSlice({x=24, z=1}, {x=1, z=1})`
### `VoxelManip`
An interface to the `MapVoxelManipulator` for Lua.