This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
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
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.

LandscapeMapFileCreator Class

Warning
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 UnigineScript (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#

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 ( 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, in pixels.

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, in pixels.

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 setDownscaleFilter ( int file_data_type, int filter ) #

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

Arguments

int getDownscaleFilter ( int file_data_type ) #

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

Arguments

  • int file_data_type - File data type.

Return value

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

int 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. Creates the landscape map file path if it doesn’t exist yet (including subdirectories).

Arguments

  • int is_empty - 1 to create an empty .lmap file (e.g., when you create a layer map to be manually sculpted from scratch using brushes), 0 - to get necessary data from the sources and put them to the generated .lmap file.
  • int is_safe - 1 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), 0 - 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

1 if the operation is successful; otherwise, 0.
Last update: 2021-12-13
Build: ()