mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
Merge branch 'main' into animation
This commit is contained in:
commit
05fc09a244
12 changed files with 128 additions and 56 deletions
|
|
@ -139,6 +139,12 @@ string.left_pad(str: string, size: int, char: string) -> string
|
|||
-- Adds a char to the right of the string until its size equals size.
|
||||
-- By default, char is equal to the space character.
|
||||
string.right_pad(str: string, size: int, char: string) -> string
|
||||
|
||||
-- Encodes a string into URL format, replacing special characters with their hexadecimal representations.
|
||||
string.url_encode(str: string) -> string
|
||||
|
||||
-- Decodes a string from URL format, replacing hexadecimal representations with their corresponding characters.
|
||||
string.url_decode(str: string) -> string
|
||||
```
|
||||
|
||||
## Math extensions
|
||||
|
|
|
|||
|
|
@ -284,6 +284,14 @@ A method that generates simplex noise, adding it to the existing values.
|
|||
|
||||
The noise seed can be specified in the `map.noiseSeed` field.
|
||||
|
||||
By default, noise octaves are mixed using addition:
|
||||
|
||||
$noise_{out} = noise_{source} + noise_{applied} * 2^{-{octave}}$
|
||||
|
||||
To obtain more normalized multi-octave noise, you can enable the `map.normalNoise = true` flag, which changes the scheme:
|
||||
|
||||
$noise_{out} = noise_{source} * (1 - 2^{-{octave}}) + noise_{applied} * 2^{-{octave}}$
|
||||
|
||||
```lua
|
||||
map:noise(
|
||||
-- coordinate offset
|
||||
|
|
@ -313,6 +321,10 @@ The noise seed can be specified in the `map.noiseSeed` field.
|
|||
|
||||

|
||||
|
||||
> [!NOTE] cell noise looks better with `map.normalNoise = true`
|
||||
|
||||

|
||||
|
||||
### heightmap:resize(...)
|
||||
|
||||
```lua
|
||||
|
|
|
|||
BIN
doc/images/normal-cell-noise.png
Normal file
BIN
doc/images/normal-cell-noise.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
|
|
@ -141,6 +141,12 @@ string.left_pad(str: string, size: int, char: string) -> string
|
|||
-- Добавляет char справа от строки, пока её размер не будет равен size.
|
||||
-- По стандарту char равен символу пробела.
|
||||
string.right_pad(str: string, size: int, char: string) -> string
|
||||
|
||||
-- Кодирует строку в формат URL, заменяя специальные символы на их шестнадцатеричные представления.
|
||||
string.url_encode(str: string) -> string
|
||||
|
||||
-- Декодирует строку из формата URL, заменяя шестнадцатеричные представления на соответствующие символы.
|
||||
string.url_decode(str: string) -> string
|
||||
```
|
||||
|
||||
## Расширения для math
|
||||
|
|
|
|||
|
|
@ -287,6 +287,14 @@ map:dump('export:test.png')
|
|||
|
||||
Зерно шума может быть указано в поле `map.noiseSeed`.
|
||||
|
||||
По-умолчанию октавы шума совмещаются через сложение:
|
||||
|
||||
$шум_{результат} = шум_{исходный} + шум_{применяемый} * 2^{-{октава}}$
|
||||
|
||||
Для более получения нормализованного многооктавного шума можно включить флаг `map.normalNoise = true`, меняющий схему на:
|
||||
|
||||
$шум_{результат} = шум_{исходный} * (1 - 2^{-{октава}}) + шум_{применяемый} * 2^{-{октава}}$
|
||||
|
||||
```lua
|
||||
map:noise(
|
||||
-- смещение координат
|
||||
|
|
@ -316,6 +324,10 @@ map:noise(
|
|||
|
||||

|
||||
|
||||
> [!NOTE] клеточный шум выглядит лучше с `map.normalNoise = true`
|
||||
|
||||

|
||||
|
||||
### heightmap:resize(...)
|
||||
|
||||
```lua
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue