LandscapeMapFileCreator Class
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
This class is used to generate a landscape map file (.lmap) to be used for landscape layer map creation.
Usage Example#
// 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 ( ivec2 resolution ) #
Sets a new landscape map resolution.Arguments
- ivec2 resolution - Two-component vector (X, Y) representing new landscape map resolution along X and Y axes to be set.
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 ( ivec2 grid ) #
Sets a new grid size for the landscape map.Arguments
- ivec2 grid - Two-component vector (X, Y) representing number of tiles of the landscape map along X and Y axes.
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 ( string path ) #
Sets a new path to the .lmap file to be generated.Arguments
- string path - New path to the .lmap file to be generated.
string getPath ( ) #
Returns a path to the .lmap file to be generated.Return value
Path to the .lmap file to be generated.void run ( int is_empty = false, int 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
- int is_empty - 1 to enable recursive search (i.e. down the whole details hierarchy of the detail mask), 0 - to search only among the top-level details of the detail mask.
- int is_safe - 1 to enable recursive search (i.e. down the whole details hierarchy of the detail mask), 0 - to search only among the top-level details of the detail mask.
Last update:
2020-07-31
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)