This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
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
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#

Returns the current landscape map resolution.
set
Sets a new landscape map resolution.
set value - Two-component vector (X, Y) representing new landscape map resolution along X and Y axes to be set.

ivec2 Grid#

Returns the current grid size for the landscape map.
set
Sets a new grid size for the landscape map.
set value - Two-component vector (X, Y) representing number of tiles of the landscape map along X and Y axes.

float Progress#

Returns the current landscape map file creation progress.

double TimeSeconds#

Returns the landscape map file creation time. You can use this method to get total file generation time when processing an End callback.

string Path#

Returns a path to the .lmap file to be generated.
set
Sets a new path to the .lmap file to be generated.
set value - New path to the .lmap file to be generated.

Members


LandscapeMapFileCreator ( ) #

The LandscapeMapFileCreator constructor.

void 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.

Arguments

  • bool is_empty - true to enable recursive search (i.e. down the whole details hierarchy of the detail mask), false - to search only among the top-level details of the detail mask.
  • bool is_safe - true to enable recursive search (i.e. down the whole details hierarchy of the detail mask), false - to search only among the top-level details of the detail mask.

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
{

	/*...*/

	// 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
		Landscape.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
{

	/*...*/

	// 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
		Landscape.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
{

	/*...*/

	// 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
		Landscape.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
{

	/*...*/

	// 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
		Landscape.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: 2020-07-31
Build: ()