Noise¶
继承: Resource < RefCounted < Object
派生: FastNoiseLite
噪声生成器的抽象基类。
描述¶
此类定义了噪声生成库的继承接口。
对于不提供无缝噪声的库,已默认实现 get_seamless_image() 方法。该函数会通过 get_image() 获取更大尺寸的图像,反转图像的象限,然后利用边缘额外宽度区域进行接缝混合。
继承的噪声类可选择重写此函数,以提供更优化的算法实现。
方法¶
get_image(width: int, height: int, invert: bool = false, in_3d_space: bool = false, normalize: bool = true) const |
|
get_image_3d(width: int, height: int, depth: int, invert: bool = false, normalize: bool = true) const |
|
get_noise_1d(x: float) const |
|
get_noise_2d(x: float, y: float) const |
|
get_noise_2dv(v: Vector2) const |
|
get_noise_3d(x: float, y: float, z: float) const |
|
get_noise_3dv(v: Vector3) const |
|
get_seamless_image(width: int, height: int, invert: bool = false, in_3d_space: bool = false, skirt: float = 0.1, normalize: bool = true) const |
|
get_seamless_image_3d(width: int, height: int, depth: int, invert: bool = false, skirt: float = 0.1, normalize: bool = true) const |
方法说明¶
Image get_image(width: int, height: int, invert: bool = false, in_3d_space: bool = false, normalize: bool = true) const 🔗
返回包含二维噪声值的 Image 对象。
注意:当 normalize 参数设为 false 时,默认实现要求噪声生成器返回值的范围在 -1.0 到 1.0 之间。
Array[Image] get_image_3d(width: int, height: int, depth: int, invert: bool = false, normalize: bool = true) const 🔗
返回包含三维噪声值的 Image 对象 Array 数组,用于 ImageTexture3D.create() 方法。
注意:当 normalize 参数设为 false 时,默认实现要求噪声生成器返回值的范围应在 -1.0 至 1.0 之间。
float get_noise_1d(x: float) const 🔗
返回给定 (x) 坐标处的 1D 噪声值。
float get_noise_2d(x: float, y: float) const 🔗
返回给定位置处的 2D 噪声值。
float get_noise_2dv(v: Vector2) const 🔗
返回给定位置处的 2D 噪声值。
float get_noise_3d(x: float, y: float, z: float) const 🔗
返回给定位置处的 3D 噪声值。
float get_noise_3dv(v: Vector3) const 🔗
返回给定位置处的 3D 噪声值。
Image get_seamless_image(width: int, height: int, invert: bool = false, in_3d_space: bool = false, skirt: float = 0.1, normalize: bool = true) const 🔗
返回包含无缝二维噪声值的 Image 对象。
注意:当参数 normalize 设为 false 时,默认实现要求噪声生成器返回值的有效范围应为 -1.0 到 1.0。
Array[Image] get_seamless_image_3d(width: int, height: int, depth: int, invert: bool = false, skirt: float = 0.1, normalize: bool = true) const 🔗
返回包含无缝三维噪声值的 Image 对象数组( Array ),专用于 ImageTexture3D.create() 方法创建3D纹理。
注意:当参数 normalize 设为 false 时,默认实现要求噪声生成器必须返回 -1.0 至 1.0 范围内的数值。