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
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
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.LandscapeMapFileCreator Class

This class is used to generate a landscape map file (.lmap) to be used for landscape layer map creation.

Usage Example#

Source code (C++)
// callbacks to be fired in the process of landscape map file creation
void progress(LandscapeMapFileCreatorPtr creator)
{
	Log::message("%d %f\n", int(creator->getProgress()), creator->getTimeSeconds());
}
void begin(LandscapeMapFileCreatorPtr creator)
{
	Log::message("%f\n", creator->getProgress());
}
void end(LandscapeMapFileCreatorPtr creator)
{
	Log::message("%f\n", creator->getTimeSeconds());
}

// ...

// defining grid size (2х2 tiles) and resolution 
ivec2 grid = ivec2(2,2);
ivec2 resolution = ivec2(2048) * grid;

// creating a landscape map file creator and setting grid size, resolution, and path
creator = LandscapeMapFileCreator::create();
creator->setGrid(grid);
creator->setResolution(resolution);
creator->setPath("test.lmap");

// adding necessary callbacks
creator->addCreateCallback(MakeCallback(&create));
creator->addProgressCallback(MakeCallback(&progress));
creator->addBeginCallback(MakeCallback(&begin));
creator->addEndCallback(MakeCallback(&end));

// running the creator to generate a new "test.lmap" file
creator->run();

// ...

// creating a new landscape layer map based on the created "test.lmap" file
landscape_map = LandscapeLayerMap::create();
landscape_map->setPath("test.lmap");

LandscapeMapFileCreator Class

Properties

ivec2 Resolution#

The Two-component vector (X, Y) representing landscape map resolution along X and Y axes, in pixels.

ivec2 Grid#

The Two-component vector (X, Y) representing number of tiles of the landscape map along X and Y axes.

float Progress#

The Current landscape map file creation progress (percentage).

double TimeSeconds#

The Landscape map file creation time, in seconds.

string Path#

The Path to the .lmap file to be generated.

Members


LandscapeMapFileCreator ( ) #

The LandscapeMapFileCreator constructor.

void SetDownscaleFilter ( Landscape.TYPE_FILE_DATA file_data_type, Image.FILTER filter ) #

Sets a new filtering type to be used for image downscaling performed for LODs of the specified file data type.

Arguments

Image.FILTER GetDownscaleFilter ( Landscape.TYPE_FILE_DATA file_data_type ) #

Returns the current filtering type used for image downscaling performed for LODs of the specified file data type.

Arguments

Return value

Filter type used for image downscaling. See the Unigine::Image Enumerations with FILTER_* prefixes.

bool Run ( bool is_empty = false, bool is_safe = true ) #

Runs the landscape map file creation process. You can set callbacks to be fired in the beginning, upon completion and during the process to monitor progress and display statistics. Creates the landscape map file path if it doesn’t exist yet (including subdirectories).

Arguments

  • bool is_empty - true to create an empty .lmap file (e.g., when you create a layer map to be manually sculpted from scratch using brushes), false - to get necessary data from the sources and put them to the generated .lmap file.
  • bool is_safe - true to make the Engine automatically call filesClose()/fileOpen() methods when performing operations (before modifying an .lmap file the Engine should release files via filesClose(), while after modification fileOpen() should be called), false - to call filesClose()/fileOpen() methods manually.

    The Landscape class has two overloads for the filesClose() method:

    • filesClose() - to be called in case of moving an .lmap file (no data reloading is performed as the file itself was not modified - saves time on reloading data)
    • filesClose(reload_files) - to be called in case of deleting or modifying an .lmap file.
    Notice
    When is_safe = true the Engine shall always call filesClose(reload_files) with complete data reloading.

Return value

true if the operation is successful; otherwise, false.

IntPtr AddCreateCallback ( CreateDelegate func ) #

Adds a callback function to be called on creating a landscape layer map file. The signature of the callback function must be as follows:
Source code (C#)
void create_callback(LandscapeMapFileCreator creator, LandscapeImages images, int x, int y);

You can set a callback function as follows:

Source code (C#)
AddCreateCallback((creator, images, x, y) 
						=> create_callback(creator, images, x, y));

Example: Setting a landscape layer map file creation callback function:

Source code (C#)
class AppWorldLogic : WorldLogic
{

	// declaring a Landscape Map File creator
	LandscapeMapFileCreator creator;
	/*...*/

	// callback function
	private void CreateFile(LandscapeMapFileCreator creator, LandscapeImages images, int x, int y)
	{
		// insert your specific landscape layer map file creation handling code here
	}

	/*...*/

	public override bool Init()
	{
		// setting the CreateFile() function to handle file creation
		creator.AddCreateCallback((creator, images, x, y) 
						=> CreateFile(creator, images, x, y));

		return true;
		}
	/*...*/
}

Arguments

  • CreateDelegate func - Callback function with the following signature:
    void CreateDelegate(LandscapeMapFileCreator creator, LandscapeImages images, int x, int y)

Return value

ID of the last added landscape layer map file creation callback, if the callback was added successfully; otherwise, null. This ID can be used to remove this callback when necessary.

bool RemoveCreateCallback ( IntPtr id ) #

Removes the specified callback from the list of create file callbacks.

Arguments

  • IntPtr id - Create file callback ID obtained when adding it.

Return value

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

void ClearCreateCallback ( ) #

Clears all added create file callbacks.

IntPtr AddProgressCallback ( ProgressDelegate func ) #

Adds a callback function to be called on landscape map file creation progress. The signature of the callback function must be as follows:
Source code (C#)
void progress_callback(LandscapeMapFileCreator creator);

You can set a callback function as follows:

Source code (C#)
AddProgressCallback((creator) 
						=> progress_callback(creator));

Example: Setting a progress callback function:

Source code (C#)
class AppWorldLogic : WorldLogic
{
	/*...*/
	// declaring a Landscape Map File creator
	LandscapeMapFileCreator creator;

	// callback function implementing certain actions to be performed on landscape map file creation progress
	private void FileCreationProgress(LandscapeMapFileCreator creator)
	{
		// insert your specific progress handling code here
	}

	/*...*/

	public override bool Init()
	{
		// setting the FileCreationProgress() function to handle landscape map file creation progress
		creator.AddProgressCallback((creator) 
						=> FileCreationProgress(creator));

		return true;
		}
	/*...*/
}

Arguments

  • ProgressDelegate func - Callback function with the following signature:
    void ProgressDelegate(LandscapeMapFileCreator creator)

Return value

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

bool RemoveProgressCallback ( IntPtr id ) #

Removes the specified callback from the list of progress callbacks.

Arguments

  • IntPtr id - Progress callback ID obtained when adding it.

Return value

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

void ClearProgressCallback ( ) #

Clears all added progress callbacks.

IntPtr AddBeginCallback ( BeginDelegate func ) #

Adds a callback function to be called on beginning the landscape map file creation. The signature of the callback function must be as follows:
Source code (C#)
void begin_callback(LandscapeMapFileCreator creator);

You can set a callback function as follows:

Source code (C#)
AddBeginCallback((creator) 
						=> begin_callback(creator));

Example: Setting a begin file creation callback function:

Source code (C#)
class AppWorldLogic : WorldLogic
{

	/*...*/

	// declaring a Landscape Map File creator
	LandscapeMapFileCreator creator;
	// callback function implementing certain actions to be performed on beginning landscape map file creation
	private void FileCreationBegin(LandscapeMapFileCreator creator)
	{
		// insert your specific handling code here
	}

	/*...*/

	public override bool Init()
	{
		// setting the FileCreationBegin() function to handle beginning of the landscape map file creation
		creator.AddBeginCallback((creator) 
						=> FileCreationBegin(creator));

		return true;
		}
	/*...*/
}

Arguments

  • BeginDelegate func - Callback function with the following signature:
    void BeginDelegate(LandscapeMapFileCreator creator)

Return value

ID of the last added begin file creation callback, if the callback was added successfully; otherwise, null. This ID can be used to remove this callback when necessary.

bool RemoveBeginCallback ( IntPtr id ) #

Removes the specified callback from the list of begin file creation callbacks.

Arguments

  • IntPtr id - Begin callback ID obtained when adding it.

Return value

True if the begin file creation callback with the given ID was removed successfully; otherwise false.

void ClearBeginCallback ( ) #

Clears all added begin file creation callbacks.

IntPtr AddEndCallback ( EndDelegate func ) #

Adds a callback function to be called on completion of the landscape map file creation. The signature of the callback function must be as follows:
Source code (C#)
void end_callback(LandscapeMapFileCreator creator);

You can set a callback function as follows:

Source code (C#)
AddEndCallback((creator) 
						=> end_callback(creator));

Example: Setting a file creation completion callback function:

Source code (C#)
class AppWorldLogic : WorldLogic
{

	/*...*/

	// declaring a Landscape Map File creator
	LandscapeMapFileCreator creator;
	
	// callback function implementing certain actions to be performed on completion of the landscape map file creation
	private void FileCreationEnd(LandscapeMapFileCreator creator)
	{
		// insert your specific handling code here
	}

	/*...*/

	public override bool Init()
	{
		// setting the FileCreationEnd() function to handle completion of the landscape map file creation
		creator.AddEndCallback((creator) 
						=> FileCreationEnd(creator));

		return true;
		}
	/*...*/
}

Arguments

  • EndDelegate func - Callback function with the following signature:
    void EndDelegate(LandscapeMapFileCreator creator)

Return value

ID of the last added file creation completion callback, if the callback was added successfully; otherwise, null. This ID can be used to remove this callback when necessary.

bool RemoveEndCallback ( IntPtr id ) #

Removes the specified callback from the list of file creation completion callbacks.

Arguments

  • IntPtr id - End callback ID obtained when adding it.

Return value

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

void ClearEndCallback ( ) #

Clears all added file creation completion callbacks.
Last update: 2023-04-13
Build: ()