Noise
繼承: Resource < RefCounted < Object
被繼承: FastNoiseLite
雜訊生成器的抽象基底類別。
說明
該類定義了雜訊生成庫要繼承的介面。
為不提供無縫雜訊的庫提供一個預設的 get_seamless_noise() 實作。該函式從 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 🔗
返回包含 2D 雜訊值的 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 🔗
返回包含 3D 雜訊值的 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 🔗
返回包含無縫 2D 雜訊值的 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 🔗
返回包含無縫 3D 雜訊值的 Image 的 Array,用於 ImageTexture3D.create()。
注意:normalize 為 false 時,預設實作要求雜訊生成器返回 -1.0 到 1.0 之間的值。