Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Noise

继承: Resource < RefCounted < Object

派生: FastNoiseLite

噪声生成器的抽象基类。

描述

该类定义了噪声生成库要继承的接口。

为不提供无缝噪声的库提供一个默认的 get_seamless_image 实现。该函数从 get_image 请求更大的图像,反转该图像的象限,然后使用额外宽度的条带在接缝处混合。

继承的噪声类可以选择性地覆盖该函数,以提供更优化的算法。

方法

Image

get_image ( int width, int height, bool invert=false, bool in_3d_space=false, bool normalize=true ) const

Image[]

get_image_3d ( int width, int height, int depth, bool invert=false, bool normalize=true ) const

float

get_noise_1d ( float x ) const

float

get_noise_2d ( float x, float y ) const

float

get_noise_2dv ( Vector2 v ) const

float

get_noise_3d ( float x, float y, float z ) const

float

get_noise_3dv ( Vector3 v ) const

Image

get_seamless_image ( int width, int height, bool invert=false, bool in_3d_space=false, float skirt=0.1, bool normalize=true ) const

Image[]

get_seamless_image_3d ( int width, int height, int depth, bool invert=false, float skirt=0.1, bool normalize=true ) const


方法说明

Image get_image ( int width, int height, bool invert=false, bool in_3d_space=false, bool normalize=true ) const

返回包含 2D 噪声值的 Image

注意:normalizefalse 时,默认实现要求噪声生成器返回 -1.01.0 之间的值。


Image[] get_image_3d ( int width, int height, int depth, bool invert=false, bool normalize=true ) const

返回包含 3D 噪声值的 ImageArray,用于 ImageTexture3D.create

注意:normalizefalse 时,默认实现要求噪声生成器返回 -1.01.0 之间的值。


float get_noise_1d ( float x ) const

返回给定 (x) 坐标处的 1D 噪声值。


float get_noise_2d ( float x, float y ) const

返回给定位置处的 2D 噪声值。


float get_noise_2dv ( Vector2 v ) const

返回给定位置处的 2D 噪声值。


float get_noise_3d ( float x, float y, float z ) const

返回给定位置处的 3D 噪声值。


float get_noise_3dv ( Vector3 v ) const

返回给定位置处的 3D 噪声值。


Image get_seamless_image ( int width, int height, bool invert=false, bool in_3d_space=false, float skirt=0.1, bool normalize=true ) const

返回包含无缝 2D 噪声值的 Image

注意:normalizefalse 时,默认实现要求噪声生成器返回 -1.01.0 之间的值。


Image[] get_seamless_image_3d ( int width, int height, int depth, bool invert=false, float skirt=0.1, bool normalize=true ) const

返回包含无缝 3D 噪声值的 ImageArray,用于 ImageTexture3D.create

注意:normalizefalse 时,默认实现要求噪声生成器返回 -1.01.0 之间的值。