This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine::FieldHeight Class

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

This class is used to create and modify a field height. The field is applied to global water and specifies areas where height of waves should be changed.

Notice
The maximum number of the rendered FieldHeight objects per frame/bit mask is 8.

Creating a Height Field

Notice
When creating a FieldHeight object you should specify a heightmap texture for it as this object doesn't have any default texture.
Source code (C++)
// create a new instance of the FieldHeight class and set its transformation
FieldHeightPtr height = FieldHeight::create();
height->setTransform(Mat4(1));
// set the size of the field
height->setSize(vec3(4096.0f, 4096.0f, 512.0f));
// set the heightmap texture
height->setTexturePath("unigine_project/textures/fh_static.png");

See also#

UnigineScript API sample <UnigineSDK>/data/samples/fields/height_00

FieldHeight Class

Members


static FieldHeightPtr create ( ) #

The default constructor. Creates a FieldHeight instance with the default size vec3(1.0f, 1.0f, 1.0f).
Notice
By default, a heightmap texture is empty. Specify it after creating the FieldHeight by using an appropriate function.

void setAttenuation ( float attenuation ) #

Sets the FieldHeight's attenuation factor value. The attenuation factor indicates the rate of FiledHeight influence attenuation from the center of the object to its edges. By default the attenuation factor is set to 1.0f.

Arguments

  • float attenuation - Attenuation factor. The higher the value, the less FieldHeight's heights will have influence on the Global Water's object heights.

float getAttenuation ( ) const#

Returns the FieldHeight's attenuation factor value. The attenuation factor indicates the rate of FiledHeight influence attenuation from the center of the object to its edges.

Return value

Attenuation factor. The higher the value, the less FieldHeight's heights will have influence on the Global Water's object heights. The default value is 1.0f.

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

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

Arguments

Ptr<Texture> getTexture ( ) const#

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

Return value

Texture instance into which the texture will be saved.

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

Sets the given image as the heightmap texture of the FieldHeight.

Arguments

  • const Ptr<Image> & image - Image instance with heightmap for FieldHeight.

Return value

1 if the texture is set successfully; otherwise, 0.

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

Grabs the texture for the FieldHeight (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 FieldHeight's heightmap texture.

Arguments

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

const char * getTexturePath ( ) const#

Returns the path to the FieldHeight's heightmap texture.

Return value

Path to the heightmap texture.

void setPower ( float power ) #

Sets the FieldHeight's power value. The power is a multiplier for loaded heightmap texture values. By default the power is set to 1.0f.

Arguments

  • float power - Power value. The higher the value, the more FieldHeight's heights will have influence on the Global Water's object heights.

float getPower ( ) const#

Returns the FieldHeight's power value. The power is a multiplier for loaded heightmap texture values.

Return value

Power value. The higher the value, the more FieldHeight's heights will have influence on the Global Water's object heights. The default value is 1.0f.

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

Sets the vec3 size vector of the FieldHeight's object. By default, the size is (1.0f, 1.0f, 1.0f).

Arguments

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

Math::vec3 getSize ( ) const#

Returns the vec3 size vector of the FieldHeight's object.

Return value

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

static int type ( ) #

Returns the type of the object.

Return value

FieldHeight type identifier.

void setOrder ( int order ) #

Sets the field height rendering order.
Notice
This parameter is used to properly apply fields with mixed blend modes.

Arguments

  • int order - Rendering order to set.

int getOrder ( ) const#

Returns the current field height rendering order.
Notice
This parameter is used to properly apply fields with mixed blend modes.

Return value

Rendering order.

void setBlendMode ( int mode ) #

Sets the field height blending mode.
Notice
Attenuation parameter is interpreted depending on the selected blending mode:
  • is used as a mulpiplier for the additive mode
  • lerp(1.0f, value, attenuation) is used for the multiplicative mode

Arguments

int getBlendMode ( ) const#

Returns the current field height blending mode.
Notice
Attenuation parameter is interpreted depending on the selected blending mode:
  • is used as a mulpiplier for the additive mode
  • lerp(1.0f, value, attenuation) is used for the multiplicative mode

Return value

Blending mode. One of the BLEND_*values.Blending mode. One of the FIELD_HEIGHT_BLEND_*values.
Last update: 2024-08-16
Build: ()