跳到主要内容

Polygon2D

继承

Node2D

简要描述

2D多边形。

描述

Polygon2D由一组点定义。每个点都会连接到下一个点,最后一个点会连接到第一个点,形成闭环,2D多边形可以填充颜色(固定色或者渐变色),或者是填充纹理

注意:默认情况下,IdeaXR一次最多只能绘制4,096个多边形点。如果需要增加这个上限,打开项目设置[Setting]调整ProjectSettings.rendering/limits/buffers/canvas_polygon_buffer_size_kbProjectSettings.rendering/limits/buffers/canvas_polygon_index_buffer_size_kb

成员

类型属性名默认值
boolantialiasedfalse
Arraybones[]
ColorcolorColor( 1, 1, 1, 1 )
intinternal_vertex_count0
floatinvert_border100.0
boolinvert_enablefalse
Vector2offsetVector2( 0, 0 )
PoolVector2ArraypolygonPoolVector2Array( )
Arraypolygons[]
NodePathskeletonNodePath("")
Texturetexture
Vector2texture_offsetVector2( 0, 0 )
floattexture_rotation
floattexture_rotation_degrees0.0
Vector2texture_scaleVector2( 1, 1 )
PoolVector2ArrayuvPoolVector2Array( )
PoolColorArrayvertex_colorsPoolColorArray( )

方法

返回值类型方法名称
voidadd_bone(path: NodePath, weights: PoolRealArray)
voidclear_bones()
voiderase_bone(index: int)
intget_bone_count() const
NodePathget_bone_path(index: int) const
PoolRealArrayget_bone_weights(index: int) const
voidset_bone_path(index: int, path: NodePath)
voidset_bone_weights(index: int, weights: PoolRealArray)

常量

成员说明

  • bool antialiased
Defaultfalse
setterset_antialiased(value)
getterget_antialiased
  • Array bones
Default[]
setter_set_bones(value)
getter_get_bones
  • Color color
DefaultColor( 1, 1, 1, 1 )
setterset_color(value)
getterget_color
  • int internal_vertex_count
Default0
setterset_internal_vertex_count(value)
getterget_internal_vertex_count
  • float invert_border
Default100.0
setterset_invert_border(value)
getterget_invert_border
  • bool invert_enable
Defaultfalse
setterset_invert(value)
getterget_invert
  • Vector2 offset
DefaultVector2( 0, 0 )
setterset_offset(value)
getterget_offset
  • PoolVector2Array polygon
DefaultPoolVector2Array( )
setterset_polygon(value)
getterget_polygon
  • Array polygons
Default[]
setterset_polygons(value)
getterget_polygons
  • NodePath skeleton
DefaultNodePath("")
setterset_skeleton(value)
getterget_skeleton
  • Texture texture
setterset_texture(value)
getterget_texture
  • Vector2 texture_offset
DefaultVector2( 0, 0 )
setterset_texture_offset(value)
getterget_texture_offset
  • float texture_rotation
setterset_texture_rotation(value)
getterget_texture_rotation
  • float texture_rotation_degrees
Default0.0
setterset_texture_rotation_degrees(value)
getterget_texture_rotation_degrees
  • Vector2 texture_scale
DefaultVector2( 1, 1 )
setterset_texture_scale(value)
getterget_texture_scale
  • PoolVector2Array uv
DefaultPoolVector2Array( )
setterset_uv(value)
getterget_uv
  • PoolColorArray vertex_colors
DefaultPoolColorArray( )
setterset_vertex_colors(value)
getterget_vertex_colors

方法说明

  • add_bone add_bone(path: NodePath, weights: PoolRealArray)

  • clear_bones clear_bones()

  • erase_bone erase_bone(index: int)

  • get_bone_count get_bone_count() const

  • get_bone_path get_bone_path(index: int) const

  • get_bone_weights get_bone_weights(index: int) const

  • set_bone_path set_bone_path(index: int, path: NodePath)

  • set_bone_weights set_bone_weights(index: int, weights: PoolRealArray)