add gfx.skeletons library docs

This commit is contained in:
MihailRis
2025-07-27 22:18:28 +03:00
parent b991ca3c9a
commit b5a2f2ae71
5 changed files with 122 additions and 2 deletions
@@ -0,0 +1,48 @@
# gfx.skeletons library
A library for working with named skeletons, such as 'hand',
used to control the hand and the carried item displayed in first-person view.
The set of functions is similar to the skeleton component of entities.
The first argument to the function is the name of the skeleton.
```lua
-- Returns an object wrapper over the skeleton
local skeleton = gfx.skeletons.get(name: str)
-- Returns the index of the bone by name or nil
skeleton:index(name: str) -> int
-- Returns the name of the model assigned to the bone with the specified index
skeleton:get_model(index: int) -> str
-- Reassigns the model of the bone with the specified index
-- Resets to the original if you do not specify a name
skeleton:set_model(index: int, name: str)
-- Returns the transformation matrix of the bone with the specified index
skeleton:get_matrix(index: int) -> mat4
-- Sets the transformation matrix of the bone with the specified index
skeleton:set_matrix(index: int, matrix: mat4)
-- Returns the texture by key (dynamically assigned textures - '$name')
skeleton:get_texture(key: str) -> str
-- Assigns a texture by key
skeleton:set_texture(key: str, value: str)
-- Checks the visibility status of a bone by index
-- or the entire skeleton if index is not specified
skeleton:is_visible([optional] index: int) -> bool
-- Sets the visibility status of a bone by index
-- or the entire skeleton if index is not specified
skeleton:set_visible([optional] index: int, status: bool)
-- Returns the color of the entity
skeleton:get_color() -> vec3
-- Sets the color of the entity
skeleton:set_color(color: vec3)
```
@@ -0,0 +1,49 @@
# Библиотека gfx.skeletons
Библиотека для работы с именованными скелетами, такими как 'hand',
использующийся для управления, отображаемыми при виде от первого лица,
рукой и переносимым предметом. Набор функций аналогичен компоненту skeleton
у сущностей.
Первым аргументом в функции передаётся имя скелета.
```lua
-- Возвращает объектную обёртку над скелетом
local skeleton = gfx.skeletons.get(name: str)
-- Возвращает индекс кости по имени или nil
skeleton:index(name: str) -> int
-- Возвращает имя модели, назначенной на кость с указанным индексом
skeleton:get_model(index: int) -> str
-- Переназначает модель кости с указанным индексом
-- Сбрасывает до изначальной, если не указывать имя
skeleton:set_model(index: int, name: str)
-- Возвращает матрицу трансформации кости с указанным индексом
skeleton:get_matrix(index: int) -> mat4
-- Устанавливает матрицу трансформации кости с указанным индексом
skeleton:set_matrix(index: int, matrix: mat4)
-- Возвращает текстуру по ключу (динамически назначаемые текстуры - '$имя')
skeleton:get_texture(key: str) -> str
-- Назначает текстуру по ключу
skeleton:set_texture(key: str, value: str)
-- Проверяет статус видимости кости по индесу
-- или всего скелета, если индекс не указан
skeleton:is_visible([опционально] index: int) -> bool
-- Устанавливает статус видимости кости по индексу
-- или всего скелета, если индекс не указан
skeleton:set_visible([опционально] index: int, status: bool)
-- Возвращает цвет сущности
skeleton:get_color() -> vec3
-- Устанавливает цвет сущности
skeleton:set_color(color: vec3)
```