This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Режимы вывода изображения
Физика
Браузер SDK 2
Лицензирование и типы лицензий
Дополнения (Add-Ons)
Демонстрационные проекты
API Samples
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
Унифицированный язык шейдеров UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Unigine.TileSet Class

This class is used to manage a regular tileset of the ObjectTerrainGlobal. The tileset can have an arbitrary number of tiles. Each tile is represented by the following elements:

  • Data - an image with tile data.
  • Mask - a single-channel image describing data weights.
    Notice
    In case if a tile has no mask, all weights are considered equal to 1.

Tileset Class

Members


int GetImageType ( ) #

Returns a numerical code of the image type used in the tileset.

Return value

Image type identifier. See the FORMAT_* variables.

int SetTileData ( ivec2 tile_coord, Image data ) #

Sets the data for the specified tile by copying from the source image.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).
  • Image data - Source image containing a new tile data to be set.

Return value

1 if the data of the tile was successfully set; otherwise, 0.

int GetTileData ( ivec2 tile_coord, Image data, int force = 1 ) #

Copies the data of the specified tile to the given image instance.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).
  • Image data - Image to which the tile data is to be copied.
  • int force - Force flag.
    • If 1 is specified, the data will be copied immediately.
    • If 0 is specified, data copy operation will be queued to a separate thread.
    Notice
    It is recommended to set this flag to 0 when possible to avoid spikes.

Return value

1 if the tile data was successfully copied to the image; otherwise, 0.

int GetTileDataState ( ivec2 tile_coord ) #

Returns the state of the data for the tile with specified coordinates.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

Tile data state. One of the TILE_STATE_* values.

int GetTileResolution ( ) #

Returns the tile resolution of the tileset.

Return value

Tile resolution, in pixels.
Notice
Tiles are square and have the same number of pixels in both dimensions.

ivec2 GetTileCoord ( dvec2 flat_position ) #

Returns the coordinates of the tile containing the given point on the terrain.

Arguments

  • dvec2 flat_position - Coordinates of the point on the terrain (X, Y).

Return value

Tile coordinates in the tileset (X, Y).

int ReloadTileData ( ivec2 tile_coord ) #

Reloads the data for the tile with specified coordinates from the tileset file.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if the tile data was successfully loaded from the tileset file; otherwise, 0.

dvec2 GetTilePixelFlatPosition ( ivec2 tile_coord, vec2 pixel_coord, int use_half_pixel_offset = 0 ) #

Returns the coordinates of the point on the terrain (X, Y) corresponding to the specified pixel of the given tile.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).
  • vec2 pixel_coord - Pixel coordinates on the tile (X, Y).
  • int use_half_pixel_offset - 1 to use half-pixel offset; 0 to use zero-offset.

Return value

Coordinates of the point on the terrain (X, Y).

int IsTileMaskLoaded ( ivec2 tile_coord ) #

Returns a value indicating if a mask is loaded for the tile with the specified coordinates.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if a mask is loaded for the tile; otherwise, 0.

vec2 GetTilePixelCoord ( dvec2 flat_position, int use_half_pixel_offset = 0 ) #

Returns the local tile coordinates of the pixel corresponding to the specified point on the terrain. To determine the tile that contains this pixel use the getTileCoord() method.

Arguments

  • dvec2 flat_position - Coordinates of the point on the terrain (X, Y).
  • int use_half_pixel_offset - 1 to use half-pixel offset; 0 to use zero-offset.

Return value

Local tile coordinates of the pixel (X, Y).

int SaveTile ( ivec2 tile_coord, int force = 0 ) #

Saves changes of the specified tile to the tileset file.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).
  • int force - Force flag.
    • If 1 is specified, the changes will be saved immediately.
    • If 0 is specified, the saving operation will be queued to a separate thread.
    Notice
    It is recommended to set this flag to 0 when possible to avoid spikes.

Return value

1 if changes of the specified tile were successfully saved to the tileset file; otherwise, 0.

int SaveAll ( int force = 1 ) #

Saves changes of all tiles to the tileset file.

Arguments

  • int force - Force flag.
    • If 1 is specified, the changes will be saved immediately.
    • If 0 is specified, the saving operation will be queued to a separate thread.
    Notice
    It is recommended to set this flag to 0 when possible to avoid spikes.

Return value

1 if all changes were successfully saved to the tileset file; otherwise, 0.

float GetLifeTime ( ivec2 tile_coord ) #

Returns the current lifetime of the tile. This parameter determines how long the specified tile will be kept in the RAM without being accessed.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

Tile lifetime, in seconds.

int GetDataFormat ( ) #

Returns a value indicating current image format for the tile data.

Return value

Tile data image format. One of the Image.FORMAT_* values.

int GetMaskFormat ( ) #

Returns a value indicating current image format for the tile mask.

Return value

Tile mask image format. One of the Image.FORMAT_* values.

string GetPath ( ) #

Returns the path to the tileset file.

Return value

Path to the tileset file.

int GetTileMask ( ivec2 tile_coord, Image mask, int force = 1 ) #

Copies the mask of the specified tile to the given image instance.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).
  • Image mask - Image to which the tile mask is to be copied.
  • int force - Force flag.
    • If 1 is specified, the mask will be copied immediately.
    • If 0 is specified, mask copy operation will be queued to a separate thread.
    Notice
    It is recommended to set this flag to 0 when possible to avoid spikes.

Return value

1 if the tile mask was successfully copied to the image; otherwise, 0.

int RemoveTileMask ( ivec2 tile_coord ) #

Removes the mask of the tile with specified coordinates from the tileset.
Notice
This method does not remove the mask from the tileset file.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if the mask of the tile was successfully removed from the tileset; otherwise, 0.

int SetTileMask ( ivec2 tile_coord, Image mask ) #

Sets the mask for the specified tile by copying it from the source image.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).
  • Image mask - Source image containing a new tile mask to be set.

Return value

1 if the mask of the tile was successfully set; otherwise, 0.

int ReloadTileMask ( ivec2 tile_coord ) #

Reloads the mask for the tile with specified coordinates from the tileset file.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if the tile mask was successfully loaded from the tileset file; otherwise, 0.

float GetTileDensity ( ) #

Returns the tile density (number of pixels per unit) of the tileset.

Return value

Tile density, in pixels per unit.

int HasTileFileMask ( ivec2 tile_coord ) #

Returns a value indicating if the tile with specified coordinates has a mask in the tileset file.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if the specified tile has a mask in the tileset file; otherwise, 0.

int HasTileMask ( ivec2 tile_coord ) #

Returns a value indicating if the tile with specified coordinates has a mask in the tileset.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if the specified tile has a mask in the tileset; otherwise, 0.

int IsTileDataLoaded ( ivec2 tile_coord ) #

Returns a value indicating if data is loaded for the tile with the specified coordinates.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if data is loaded for the tile; otherwise, 0.

int GetTileMaskState ( ivec2 tile_coord ) #

Returns the state of the mask for the tile with specified coordinates.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

Tile mask state. One of the TILE_STATE_* values.

float GetTileSize ( ) #

Returns actual tile size in the tileset.

Return value

Tile size, in units.

int HasTile ( ivec2 tile_coord ) #

Returns a value indicating if there is a tile with specified coordinates in the tileset.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if there is a tile with specified coordinates in the tileset; otherwise, 0.

int HasTileFile ( ivec2 tile_coord ) #

Returns a value indicating if there is a tile with specified coordinates in the tileset file.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if there is a tile with specified coordinates in the tileset file; otherwise, 0.

int RemoveTile ( ivec2 tile_coord ) #

Removes the tile with specified coordinates from the tileset.
Notice
This method does not remove the tile from the tileset file.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

1 if the tile was successfully removed from the tileset; otherwise, 0.

int SetLifeTime ( ivec2 tile_coord, float seconds ) #

Sets the lifetime for the specified tile This parameter determines how long the specified tile will be kept in the RAM without being accessed.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).
  • float seconds - Tile lifetime, in seconds.

Return value

1 if the lifetime for the specified tile was successfully set; otherwise, 0.

dvec2 GetTileFlatPosition ( ivec2 tile_coord ) #

Returns the coordinates of the point on the terrain (X, Y) corresponding to the top-left corner of the specified tile.

Arguments

  • ivec2 tile_coord - Tile coordinates in the tileset (X, Y).

Return value

Coordinates of the point on the terrain (X, Y).

float FetchData ( vec2 position, out vec4 result, int layer, bool force ) #

Fetches the data for the specified point on the terrain and puts it to the output vector.

Arguments

  • vec2 position - Coordinates of the point on the terrain (X, Y).
  • out vec4 result - Output vector to store the data retrieved for the specified point.
  • int layer - Layer number.
  • bool force - Force flag.
    • If 1 is specified, the data will be fetched immediately.
    • If 0 is specified, the operation will be queued to a separate thread.
    Notice
    It is recommended to set this flag to 0 when possible to avoid spikes.

Return value

1.0f if the data was fetched successfully; otherwise, 0.0f.
Last update: 13.12.2024
Build: ()