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

Unigine::TextureRamp Class

Header: #include <UnigineTextures.h>

Interface for handling ramp textures. This class lets the user store 2d curves in a form of a texture (convert vectors to raster data).

Ramp textures can be used for color variation in the particles_base material of Particle Systems or in other custom materials.

You can set up to 4 channels for the ramp texture.

TextureRamp Class

Members


static TextureRampPtr create ( int num_channels, int resolution, int flags ) #

Sets resolution, number of channels and texture flags for this TextureRamp instance. The pointer to the ramp texture is set to null and curves are marked for an update.

Arguments

  • int num_channels - Number of texture channels.
  • int resolution - Width resolution of the ramp texture.
  • int flags - Texture flags.

static TextureRampPtr create ( const Ptr<TextureRamp> & texture_ramp ) #

Ramp texture constructor. Creates a new ramp texture by copying a given source ramp texture.

Arguments

  • const Ptr<TextureRamp> & texture_ramp - Pointer to a new ramp texture.

TextureRamp ( ) #

Ptr<Texture> getTexture ( ) const#

Creates a new texture and updates hashes for curves, if required. Returns a pointer to the texture or null if the texture was not created.

void releaseTexture ( ) #

Deletes the texture and its pointer.

void copy ( const Ptr<TextureRamp> & src_texture_ramp ) #

Copies the data of a source ramp texture to the texture.

Arguments

  • const Ptr<TextureRamp> & src_texture_ramp - Source ramp texture.

Ptr<TextureRamp> clone ( ) const#

Duplicates the ramp texture and returns a pointer to the copy.

Ptr<Curve2d> getCurve ( int channel ) const#

Returns a pointer to the Curve2d for the specified channel.

Arguments

  • int channel - Required channel.

Return value

Pointer to a Curve2d object.

void setNumChannels ( int channels ) #

Sets the new number of channels for the texture.

Arguments

  • int channels - Number of texture channels.

int getNumChannels ( ) const#

Returns the number of texture channels.

void setResolution ( int resolution ) #

Sets the width resolution for the texture.

Arguments

  • int resolution - Texture width resolution.

int getResolution ( ) const#

Returns the texture width resolution.

void setFlags ( int flags ) #

Sets texture flags.

Arguments

  • int flags - Texture flags.

int getFlags ( ) const#

Returns texture flags.

void * addChangedCallback ( Unigine::CallbackBase * func ) #

Adds a callback function to be called on changing the ramp texture. The signature of the changed callback function must be as follows:
Source code (C++)
void changed_callback_function_name();

You can set a callback function as follows:

Source code (C++)
addChangedCallback(MakeCallback(changed_callback_function_name));

Arguments

Return value

ID of the last added changed callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeChangedCallback ( void * id ) #

Removes the specified callback from the list of changed callbacks.

Arguments

  • void * id - Changed callback ID obtained when adding it.

Return value

True if the changed callback with the given ID was removed successfully; otherwise false.

void clearChangedCallbacks ( ) #

Clears all added changed callbacks.

void setDefaultCurve ( int channel, const Ptr<Curve2d> & default_curve ) #

Resets a curve for the given channel to a default one.

Arguments

  • int channel - R, G, B, or A channel set by the corresponding value from 0 to 3.
  • const Ptr<Curve2d> & default_curve - A curve to be used as the default one.

bool isDefault ( int channel ) const#

Returns a value indicating if the value of the given curve channel is the default one which was previously set via setDefaultCurve.

Arguments

  • int channel - R, G, B, or A channel set by the corresponding value from 0 to 3.

Return value

true if the curve value is the default one set via setDefaultCurve, otherwise false.

bool isDefaultAll ( ) const#

Returns a value indicating if the values of all curve channels are the default ones which were previously set via setDefaultCurve.

Return value

true if the values of all curve channels are the default ones set via setDefaultCurve, otherwise false.

void save ( const Ptr<Xml> & xml ) #

Saves the ramp texture data to the given Xml node.

Arguments

  • const Ptr<Xml> & xml - Target Xml node.

void save ( const Ptr<Json> & json ) const#

Saves the ramp texture data to the given Json class instance.

Arguments

  • const Ptr<Json> & json - Target son class instance.

void load ( const Ptr<Xml> & xml ) #

Loads the ramp texture data from the given Xml node.

Arguments

  • const Ptr<Xml> & xml - Source Xml node containing ramp texture data.

void load ( const Ptr<Json> & json ) #

Loads the ramp texture data from the given Json class instance.

Arguments

  • const Ptr<Json> & json - Source Json class instance containing ramp texture data.

void saveState ( const Ptr<Stream> & stream ) const#

Saves the state of the ramp texture into a binary stream.

Example using saveState() and restoreState() methods:

Source code (C++)
// initialize a node and set its state
//...//

// save state
BlobPtr blob_state = Blob::create();
ramp->saveState(blob_state);

// change state
//...//

// restore state
blob_state->seekSet(0);				// returning the carriage to the start of the blob
ramp->restoreState(blob_state);

Arguments

  • const Ptr<Stream> & stream - The stream to save the ramp texture state data.

void restoreState ( const Ptr<Stream> & stream ) const#

Restores the state of the ramp texture from the binary stream.

Example using saveState() and restoreState() methods:

Source code (C++)
// initialize a node and set its state
//...//

// save state
BlobPtr blob_state = Blob::create();
ramp->saveState(blob_state);

// change state
//...//

// restore state
blob_state->seekSet(0);				// returning the carriage to the start of the blob
ramp->restoreState(blob_state);

Arguments

  • const Ptr<Stream> & stream - The stream that stores the ramp texture state data.
Last update: 14.12.2022
Build: ()