diff --git a/doc/en/resources.md b/doc/en/resources.md index 2643f6d7..f43c0ae3 100644 --- a/doc/en/resources.md +++ b/doc/en/resources.md @@ -6,7 +6,9 @@ Resources include: - framebuffers - and other limited resources -At the moment only **cameras** are implemented. +At the moment only the following are implemented: +- camera - **camera**. +- post-effect - **effect slot**. The resources requested by the pack are specified through the *resources.json* file in the format: ```json diff --git a/doc/en/scripting/builtins/libgfx-posteffects.md b/doc/en/scripting/builtins/libgfx-posteffects.md new file mode 100644 index 00000000..ffd6c502 --- /dev/null +++ b/doc/en/scripting/builtins/libgfx-posteffects.md @@ -0,0 +1,37 @@ +# gfx.posteffects library + +A library for post-processing effects control. + +The effect slot is a resource and must be declared in resources.json in the root directory of the pack: + +```json +{ + "post-effect-slot": [ + "slot_name" + ] +} +``` + +```lua +-- Returns the index of the effect slot by name (pack:slot_name). +-- If the specified slot does not exist, returns -1 +gfx.posteffect.index(name: str) --> int + +-- Assigns the effect to the slot +gfx.posteffect.set(slot: int, effect: str) + +-- Returns the effect intensity (from 0.0 to 1.0) +-- If the slot is empty, returns 0.0 +gfx.posteffect.get_intensity(slot: int) --> number + +-- Sets the effect intensity (from 0.0 to 1.0) +-- (The correctness of processing the parameter between 0.0 and 1.0 +-- depends on the effect) +gfx.posteffect.set_intensity(slot: int, intensity: number) + +-- Returns true if the slot is not empty and the effect intensity is non-zero +gfx.posteffect.is_active(slot: int) --> bool + +-- Sets parameters values ('param' directives) +gfx.posteffect.set_params(params: table) +``` diff --git a/doc/ru/resources.md b/doc/ru/resources.md index e8ea1b93..b374a9af 100644 --- a/doc/ru/resources.md +++ b/doc/ru/resources.md @@ -6,7 +6,9 @@ - фреймбуферы - и подобные ограниченные по количеству ресурсы -На данный момент реализованы только **камеры**. +На данный момент реализованы только: +- camera - **камера**. +- post-effect - **слот эффектов**. Запрашиваемые паком ресурсы указываются через файл resources.json в формате: ```json diff --git a/doc/ru/scripting/builtins/libgfx-posteffects.md b/doc/ru/scripting/builtins/libgfx-posteffects.md new file mode 100644 index 00000000..f0a75011 --- /dev/null +++ b/doc/ru/scripting/builtins/libgfx-posteffects.md @@ -0,0 +1,37 @@ +# Библиотека gfx.posteffects + +Библиотека для работы с эффектами пост-обработки. + +Слот эффектов является ресурсом, и должен быть объявлен в resources.json в корневой директории пака: + +```json +{ + "post-effect-slot": [ + "имя_слота" + ] +} +``` + +```lua +-- Возвращает индекс слота эффектов по имени (пак:имя_слота). +-- При отсутствии указанного слота возвращает -1 +gfx.posteffect.index(name: str) --> int + +-- Назначает эффект на слот +gfx.posteffect.set(slot: int, effect: str) + +-- Возвращает интенсивность эффекта (от 0.0 до 1.0) +-- Если слот пуст, возвращает 0.0 +gfx.posteffect.get_intensity(slot: int) --> number + +-- Устанавливает интенсивность эффекта (от 0.0 до 1.0) +-- (Корректность обработки параметра между значениями 0.0 и 1.0 зависит +-- от эффекта +gfx.posteffect.set_intensity(slot: int, intensity: number) + +-- Возвращает true если слот не пуст и интенсивность эффекта ненулевая +gfx.posteffect.is_active(slot: int) --> bool + +-- Устанавливает значения параметров (директивы 'param') +gfx.posteffect.set_params(params: table) +```