Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

CurveTexture

繼承: Texture2D < Texture < Resource < RefCounted < Object

一維紋理,其中像素亮度對應於曲線上的點。

說明

A 1D texture where pixel brightness corresponds to points on a unit Curve resource, either in grayscale or in red. This visual representation simplifies the task of saving curves as image files.

If you need to store up to 3 curves within a single texture, use CurveXYZTexture instead. See also GradientTexture1D and GradientTexture2D.

屬性

Curve

curve

bool

resource_local_to_scene

false (overrides Resource)

TextureMode

texture_mode

0

int

width

256


列舉

enum TextureMode: 🔗

TextureMode TEXTURE_MODE_RGB = 0

將曲線平均儲存在紅色、綠色和藍色通道上。這會使用更多的顯存,但與唯讀取綠色和藍色值的著色器更相容。

TextureMode TEXTURE_MODE_RED = 1

僅將曲線儲存在紅色通道中。這可以節省顯存,但某些自訂著色器可能無法使用它。


屬性說明

Curve curve 🔗

The Curve that is rendered onto the texture. Should be a unit Curve.


TextureMode texture_mode = 0 🔗

生成紋理時應使用的格式。當將 CurveTexture 作為輸入傳遞給 Shader 時,可能需要調整。


int width = 256 🔗

  • void set_width(value: int)

  • int get_width()

紋理寬度(單位為圖元)。較大的值能夠更好地表示高頻資料(例如方向的突變),但會增加生成時間和記憶體佔用。