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
FAQ
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
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
Rendering-Related Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::LandscapeMapFileCreator Class

Header: #include <UnigineObjects.h>

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

Members


LandscapeMapFileCreator ( ) #

The LandscapeMapFileCreator constructor.

void setResolution ( const Math::ivec2 & resolution ) #

Sets a new landscape map resolution.

Arguments

  • const Math::ivec2 & resolution - Two-component vector (X, Y) representing new landscape map resolution along X and Y axes to be set.

Math::ivec2 getResolution ( ) #

Returns the current landscape map resolution.

Return value

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

void setGrid ( const Math::ivec2 & grid ) #

Sets a new grid size for the landscape map.

Arguments

  • const Math::ivec2 & grid - Two-component vector (X, Y) representing number of tiles of the landscape map along X and Y axes.

Math::ivec2 getGrid ( ) #

Returns the current grid size for the landscape map.

Return value

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

float getProgress ( ) #

Returns the current landscape map file creation progress.

Return value

Current landscape map file creation progress (percentage).

double getTimeSeconds ( ) #

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

Return value

Landscape map file creation time, in seconds.

void setPath ( const char * path ) #

Sets a new path to the .lmap file to be generated.

Arguments

  • const char * path - New path to the .lmap file to be generated.

const char * getPath ( ) #

Returns a path to the .lmap file to be generated.

Return value

Path to the .lmap file to be generated.

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

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.

void * addCreateCallback ( Unigine::CallbackBase4< Ptr<LandscapeMapFileCreator>, Ptr<LandscapeImages>, int, int > * 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(LandscapeMapFileCreatorPtr creator, LandscapeImages images, int x, int, y);

You can set a callback function as follows:

Source code (C++)
addCreateCallback(MakeCallback(create_callback));

Example: Setting a landscape layer map file creation callback function for a certain class:

Source code (C++)
// callback function implementing certain actions to be performed on creating a landscape layer map file
void CreateFile(LandscapeMapFileCreatorPtr creator, LandscapeImages images, int x, int, y)
{
	// insert your specific landscape layer map file creation handling code here
}

// ...
virtual int AppWorldLogic::init()
{
	// setting the CreateFile() function to handle file creation
	Landscape::addCreateCallback(MakeCallback(&CreateFile));
}

Arguments

  • Unigine::CallbackBase4< Ptr<LandscapeMapFileCreator>, Ptr<LandscapeImages>, int, int > * func - Callback pointer.

Return value

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

bool removeCreateCallback ( void * id ) #

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

Arguments

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

void * addProgressCallback ( Unigine::CallbackBase1< Ptr<LandscapeMapFileCreator> > * 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(LandscapeMapFileCreatorPtr creator);

You can set a callback function as follows:

Source code (C++)
addProgressCallback(MakeCallback(progress_callback));

Example: Setting a progress callback function for a certain class:

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

// ...
virtual int AppWorldLogic::init()
{
	// setting the FileCreationProgress() function to handle landscape map file creation progress
	Landscape::addProgressCallback(MakeCallback(&FileCreationProgress));
}

Arguments

  • Unigine::CallbackBase1< Ptr<LandscapeMapFileCreator> > * func - Callback pointer.

Return value

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

bool removeProgressCallback ( void * id ) #

Removes the specified callback from the list of progress callbacks.

Arguments

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

void * addBeginCallback ( Unigine::CallbackBase1< Ptr<LandscapeMapFileCreator> > * 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(LandscapeMapFileCreatorPtr creator);

You can set a callback function as follows:

Source code (C++)
addBeginCallback(MakeCallback(begin_callback));

Example: Setting a begin file creation callback function for a certain class:

Source code (C++)
// callback function implementing certain actions to be performed on beginning the landscape map file creation
void FileCreationBegin(LandscapeMapFileCreatorPtr creator)
{
	// insert your specific handling code here
}

// ...
virtual int AppWorldLogic::init()
{
	// setting the FileCreationBegin() function to handle beginning of the landscape map file creation
	Landscape::addBeginCallback(MakeCallback(&FileCreationBegin));
}

Arguments

  • Unigine::CallbackBase1< Ptr<LandscapeMapFileCreator> > * func - Callback pointer.

Return value

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

bool removeBeginCallback ( void * id ) #

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

Arguments

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

void * addEndCallback ( Unigine::CallbackBase1< Ptr<LandscapeMapFileCreator> > * 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(LandscapeMapFileCreatorPtr creator);

You can set a callback function as follows:

Source code (C++)
addEndCallback(MakeCallback(end_callback));

Example: Setting a file creation completion callback function for a certain class:

Source code (C++)
// callback function implementing certain actions to be performed on completion of the landscape map file creation
void FileCreationEnd(LandscapeMapFileCreatorPtr creator)
{
	// insert your specific handling code here
}

// ...
virtual int AppWorldLogic::init()
{
	// setting the FileCreationEnd() function to handle completion of the landscape map file creation
	Landscape::addEndCallback(MakeCallback(&FileCreationEnd));
}

Arguments

  • Unigine::CallbackBase1< Ptr<LandscapeMapFileCreator> > * func - Callback pointer.

Return value

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

bool removeEndCallback ( void * id ) #

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

Arguments

  • void * 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: 2019-12-25
Build: ()