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.
Checking the stable version of the documentation...
SubViewport
遊戲世界的介面,不會建立視窗,也不會直接繪製到螢幕上。
說明
SubViewport Isolates a rectangular region of a scene to be displayed independently. This can be used, for example, to display UI in 3D space.
Note: SubViewport is a Viewport that isn't a Window, i.e. it doesn't draw anything by itself. To display anything, SubViewport must have a non-zero size and be either put inside a SubViewportContainer or assigned to a ViewportTexture.
Note: InputEvents are not passed to a standalone SubViewport by default. To ensure InputEvent propagation, a SubViewport can be placed inside of a SubViewportContainer.
教學
屬性
|
||
|
||
|
||
|
||
|
||
|
列舉
enum ClearMode: 🔗
ClearMode CLEAR_MODE_ALWAYS = 0
繪製前始終清除算繪目標。
ClearMode CLEAR_MODE_NEVER = 1
永不清除算繪目標。
ClearMode CLEAR_MODE_ONCE = 2
在下一影格清除算繪目標,然後切換到 CLEAR_MODE_NEVER。
enum UpdateMode: 🔗
UpdateMode UPDATE_DISABLED = 0
不要更新算繪目標。
UpdateMode UPDATE_ONCE = 1
更新算繪目標一次,然後切換到 UPDATE_DISABLED。
UpdateMode UPDATE_WHEN_VISIBLE = 2
僅在算繪目標可見時更新算繪目標。這是預設值。
UpdateMode UPDATE_WHEN_PARENT_VISIBLE = 3
僅在其父級可見時更新算繪目標。
UpdateMode UPDATE_ALWAYS = 4
始終更新算繪目標。
屬性說明
ClearMode render_target_clear_mode = 0 🔗
該子視口用作算繪目標時的清除模式。
注意:此屬性適用於 2D 用途。
UpdateMode render_target_update_mode = 2 🔗
void set_update_mode(value: UpdateMode)
UpdateMode get_update_mode()
該子視口用作算繪目標時的更新模式。
Vector2i size = Vector2i(512, 512) 🔗
子視口的寬度和高度。必須在兩個維度上設定為大於或等於 2 圖元的值。否則,不會顯示任何內容。
注意:如果父節點是一個 SubViewportContainer,並且它的 SubViewportContainer.stretch 為 true,則無法手動更改該視口大小。
Vector2i size_2d_override = Vector2i(0, 0) 🔗
子視口的 2D 尺寸覆蓋。如果寬度或高度為 0,則禁用覆蓋。
bool size_2d_override_stretch = false 🔗
如果為 true,則 2D 尺寸覆蓋也會影響拉伸。
The number of view layers we are rendering to. Set this to 2 to enable stereo rendering.