SubViewport

继承: Viewport < Node < Object

An interface to a game world that doesn't create a window or draw to the screen directly.

描述

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.

属性


枚举

enum ClearMode:

ClearMode CLEAR_MODE_ALWAYS = 0

Always clear the render target before drawing.

ClearMode CLEAR_MODE_NEVER = 1

Never clear the render target.

ClearMode CLEAR_MODE_ONCE = 2

Clear the render target on the next frame, then switch to CLEAR_MODE_NEVER.


enum UpdateMode:

UpdateMode UPDATE_DISABLED = 0

Do not update the render target.

UpdateMode UPDATE_ONCE = 1

Update the render target once, then switch to UPDATE_DISABLED.

UpdateMode UPDATE_WHEN_VISIBLE = 2

Update the render target only when it is visible. This is the default value.

UpdateMode UPDATE_WHEN_PARENT_VISIBLE = 3

Update the render target only when its parent is visible.

UpdateMode UPDATE_ALWAYS = 4

Always update the render target.


属性说明

ClearMode render_target_clear_mode = 0

The clear mode when the sub-viewport is used as a render target.

Note: This property is intended for 2D usage.


UpdateMode render_target_update_mode = 2

The update mode when the sub-viewport is used as a render target.


Vector2i size = Vector2i(512, 512)

The width and height of the sub-viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed.

Note: If the parent node is a SubViewportContainer and its SubViewportContainer.stretch is true, the viewport size cannot be changed manually.


Vector2i size_2d_override = Vector2i(0, 0)

  • void set_size_2d_override ( value: Vector2i )
  • Vector2i get_size_2d_override ( )

The 2D size override of the sub-viewport. If either the width or height is 0, the override is disabled.


bool size_2d_override_stretch = false

  • void set_size_2d_override_stretch ( value: bool )
  • bool is_size_2d_override_stretch_enabled ( )

If true, the 2D size override affects stretch as well.

1

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。