This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
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
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.TextureRamp Class

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

Properties

Texture Texture#

The Pointer to the texture.

int NumChannels#

The number of channels.

int Resolution#

The Texture width resolution.

int Flags#

The Texture flags.

bool IsDefaultAll#

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

Members


TextureRamp ( 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.

TextureRamp ( TextureRamp texture_ramp ) #

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

Arguments

  • TextureRamp texture_ramp - Pointer to a new ramp texture.

TextureRamp ( ) #

void ReleaseTexture ( ) #

Deletes the texture and its pointer.

void Copy ( TextureRamp src_texture_ramp ) #

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

Arguments

  • TextureRamp src_texture_ramp - Source ramp texture.

TextureRamp Clone ( ) #

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

Curve2d GetCurve ( int channel ) #

Returns a pointer to the Curve2d for the specified channel.

Arguments

  • int channel - Required channel.

Return value

Pointer to a Curve2d object.

IntPtr AddChangedCallback ( ChangedDelegate 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(() => changed_callback_function_name());

Arguments

  • ChangedDelegate func - Callback function with the following signature: void ChangedDelegate()

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 ( IntPtr id ) #

Removes the specified callback from the list of changed callbacks.

Arguments

  • IntPtr 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, 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.
  • Curve2d default_curve - A curve to be used as the default one.

bool IsDefault ( int channel ) #

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 ( ) #

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 ( Xml xml ) #

Saves the ramp texture data to the given Xml node.

Arguments

  • Xml xml - Target Xml node.

void Save ( Json json ) #

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

Arguments

  • Json json - Target son class instance.

void Load ( Xml xml ) #

Loads the ramp texture data from the given Xml node.

Arguments

  • Xml xml - Source Xml node containing ramp texture data.

void Load ( Json json ) #

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

Arguments

  • Json json - Source Json class instance containing ramp texture data.

void SaveState ( Stream stream ) #

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
Blob blob_state = new Blob();
ramp.SaveState(blob_state);

// change the node state
//...//

// restore state
blob_state.SeekSet(0);	// returning the carriage to the start of the blob
ramp.RestoreState(blob_state);

Arguments

  • Stream stream - The stream to save the ramp texture state data.

void RestoreState ( Stream stream ) #

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
Blob blob_state = new Blob();
ramp.SaveState(blob_state);

// change the node state
//...//

// restore state
blob_state.SeekSet(0);	// returning the carriage to the start of the blob
ramp.RestoreState(blob_state);

Arguments

  • Stream stream - The stream that stores the ramp texture state data.
Last update: 2022-10-10
Build: ()