VoxelEngine/doc/ru/scripting/builtins/libgfx-posteffects.md
2025-07-10 18:47:28 +03:00

38 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Библиотека 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)
```