update doc/*/scripting/libgfx-posteffects.md

This commit is contained in:
MihailRis 2025-07-15 21:33:24 +03:00
parent a58ce5b7d0
commit d321085192
2 changed files with 40 additions and 0 deletions

View File

@ -34,4 +34,24 @@ gfx.posteffect.is_active(slot: int) --> bool
-- Sets parameters values ('param' directives)
gfx.posteffect.set_params(params: table)
-- Sets values to an array
gfx.posteffect.set_array(
-- effect slot index
slot: int,
-- parameter (array) name
name: str
-- data string (use Bytearray_as_string function)
data: str
)
-- Example of filling an array `#param vec3 u_arrayName[64]`:
local buffer = Bytearray(0)
for i = 0, 63 do
local x = math.random() * 2.0 - 1.0
local y = math.random() * 2.0 - 1.0
local z = math.random() * 2.0 - 1.0
Bytearray.append(buffer, byteutil.pack("fff", x, y, z))
end
gfx.posteffects.set_array(slot, "u_arrayName", Bytearray_as_string(buffer))
```

View File

@ -34,4 +34,24 @@ gfx.posteffect.is_active(slot: int) --> bool
-- Устанавливает значения параметров (директивы 'param')
gfx.posteffect.set_params(params: table)
-- Устанавливает значения в массив
gfx.posteffect.set_array(
-- индекс слота эффектов
slot: int,
-- имя параметра (массива)
name: str
-- строка данных (используйте функцию Bytearray_as_string)
data: str
)
-- Пример заполнения массива `#param vec3 u_имяМассива[64]`:
local buffer = Bytearray(0)
for i = 0, 63 do
local x = math.random() * 2.0 - 1.0
local y = math.random() * 2.0 - 1.0
local z = math.random() * 2.0 - 1.0
Bytearray.append(buffer, byteutil.pack("fff", x, y, z))
end
gfx.posteffects.set_array(slot, "u_имяМассива", Bytearray_as_string(buffer))
```