This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
内容优化
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::FieldShoreline Class

Header: #include <UnigineFields.h>
Inherits from: Field

This class is used to create and modify a field shoreline. The field is applied to global water and helps to create swashes near the shores and applies the wetness effect on objects near the shoreline.

Notice
A field shoreline object will affect water only if the FieldShoreline interaction option is enabled on the States tab of the water_global_base material.

Creating a Shoreline Field

Notice
When creating a FieldShoreline object you should specify a shoreline texture for as this object doesn't have any default texture.
Source code (C++)
// create a new instance of the FieldShoreline class and set its transformation
FieldShorelinePtr shoreline = FieldShoreline::create();
shoreline->setTransform(Mat4(1));
// set the size of the field 
shoreline->setSize(vec3(4096.0f, 4096.0f, 512.0f));
// set the path to the shoreline texture
shoreline->setTexturePath("unigine_project/textures/shorelines/shoreline_0.dds");

FieldShoreline Class

Members


static FieldShorelinePtr create ( ) #

Default constructor. Creates a FieldShoreline instance with the default size vec3(512.0f, 512.0f, 512.0f).
Notice
By default, a shoreline texture is empty. Specify it after creating the FieldShoreline by using an appropriate function.

int bakeWaterLevel ( const Ptr<Image> & image ) #

Bakes shoreline for the current water level of the global water object and puts it to the specified image. This method generates a shoreline texture by finding intersections of the Global Water object with terrains (Landscape Terrain and Terrain Global)

Arguments

  • const Ptr<Image> & image - Image instance to which the shoreline for the current water level is to be baked.

Return value

1 if the shoreline is baked successfully; otherwise, 0.

void setTexture ( const Ptr<Texture> & texture ) #

Sets the given texture from the Texture instance for the FieldShoreline.

Arguments

Ptr<Texture> getTexture ( ) const#

Returns the shoreline texture (from GPU) and saves it into the given Texture instance.

Return value

Shoreline texture.

int setTextureImage ( const Ptr<Image> & image ) #

Sets the given image as the shoreline texture of the FieldShoreline.

Arguments

  • const Ptr<Image> & image - Image instance with a shoreline texture for the FieldShoreline.

int getTextureImage ( const Ptr<Image> & image ) const#

Grabs the texture for the FieldShoreline (already loaded to GPU) and saves it into the given Image instance.

Arguments

  • const Ptr<Image> & image - Image instance into which the texture will be saved.

Return value

1 if the texture has been grabbed successfully; otherwise, 0.

void setTexturePath ( const char * path ) #

Sets the path to the FieldShoreline's shoreline texture.

Arguments

  • const char * path - Path to the shoreline texture.

const char * getTexturePath ( ) const#

Returns the path to the FieldShoreline's shoreline texture.

Return value

Path to the shoreline texture.

void setSize ( const Math::vec3 & size ) #

Sets the vec3 size vector of the FieldShoreline.

The default value is (512.0f, 512.0f, 512.0f).

Arguments

  • const Math::vec3 & size - Size vector (x,y,z), where:
    • x value is length of the FieldShoreline along X axis (in units),
    • y value is length of the FieldShoreline along Y axis (in units),
    • z value is length of the FieldShoreline along Z axis (in units).

Math::vec3 getSize ( ) const#

Returns the vec3 size vector of the FieldShoreline.

The default value is (512.0f, 512.0f, 512.0f).

Return value

Size vector (x,y,z), where:
  • x value is length of the FieldShoreline along X axis (in units),
  • y value is length of the FieldShoreline along Y axis (in units),
  • z value is length of the FieldShoreline along Z axis (in units).

int createShorelineDistanceField ( const Ptr<Image> & image, int shoreline_radius, int blur_radius, int downsample_resolution ) #

Creates a shoreline distance field with the specified parameters and puts it to the specified Image.
Source code
float shoreline_radius = 64;
int blur_radius = 8;
int downsample_resolution = 128;
Image distance_field = new Image();
field.createShorelineDistanceField(distance_field,shoreline_radius,blur_radius,downsample_resolution);

Arguments

  • const Ptr<Image> & image - Image to which the shoreline distance field will be put.
  • int shoreline_radius - Radius of the shoreline.
  • int blur_radius - Radius of the blurred area.
  • int downsample_resolution - Shoreline resolution.

Return value

1 if the field was created successfully; otherwise, 0.

static int type ( ) #

Returns the type of the object.

Return value

FieldShoreline type identifier.
Last update: 2022-10-10
Build: ()