Polygon2D

A 2D polygon.

A Polygon2D is defined by a set of points. Each point is connected to the next, with the final point being connected to the first, resulting in a closed polygon. Polygon2Ds can be filled with color (solid or gradient) or filled with a given texture. Note: By default, Godot can only draw up to 4,096 polygon points at a time. To increase this limit, open the Project Settings and increase ProjectSettings.rendering/limits/buffers/canvasPolygonBufferSizeKb and ProjectSettings.rendering/limits/buffers/canvasPolygonIndexBufferSizeKb.

@GodotBaseClass
struct Polygon2D {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

_getBones
Array _getBones()
_setBones
void _setBones(Array bones)
_skeletonBoneSetupChanged
void _skeletonBoneSetupChanged()
addBone
void addBone(NodePathArg0 path, PoolRealArray weights)

Adds a bone with the specified path and weights.

clearBones
void clearBones()

Removes all bones from this Polygon2D.

eraseBone
void eraseBone(long index)

Removes the specified bone from this Polygon2D.

getAntialiased
bool getAntialiased()
getBoneCount
long getBoneCount()

Returns the number of bones in this Polygon2D.

getBonePath
NodePath getBonePath(long index)

Returns the path to the node associated with the specified bone.

getBoneWeights
PoolRealArray getBoneWeights(long index)

Returns the height values of the specified bone.

getColor
Color getColor()
getInternalVertexCount
long getInternalVertexCount()
getInvert
bool getInvert()
getInvertBorder
double getInvertBorder()
getOffset
Vector2 getOffset()
getPolygon
PoolVector2Array getPolygon()
getPolygons
Array getPolygons()
getSkeleton
NodePath getSkeleton()
getTexture
Ref!Texture getTexture()
getTextureOffset
Vector2 getTextureOffset()
getTextureRotation
double getTextureRotation()
getTextureRotationDegrees
double getTextureRotationDegrees()
getTextureScale
Vector2 getTextureScale()
getUv
PoolVector2Array getUv()
getVertexColors
PoolColorArray getVertexColors()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(Polygon2D other)
opEquals
bool opEquals(typeof(null) n)
setAntialiased
void setAntialiased(bool antialiased)
setBonePath
void setBonePath(long index, NodePathArg1 path)

Sets the path to the node associated with the specified bone.

setBoneWeights
void setBoneWeights(long index, PoolRealArray weights)

Sets the weight values for the specified bone.

setColor
void setColor(Color color)
setInternalVertexCount
void setInternalVertexCount(long internal_vertex_count)
setInvert
void setInvert(bool invert)
setInvertBorder
void setInvertBorder(double invert_border)
setOffset
void setOffset(Vector2 offset)
setPolygon
void setPolygon(PoolVector2Array polygon)
setPolygons
void setPolygons(Array polygons)
setSkeleton
void setSkeleton(NodePathArg0 skeleton)
setTexture
void setTexture(Texture texture)
setTextureOffset
void setTextureOffset(Vector2 texture_offset)
setTextureRotation
void setTextureRotation(double texture_rotation)
setTextureRotationDegrees
void setTextureRotationDegrees(double texture_rotation)
setTextureScale
void setTextureScale(Vector2 texture_scale)
setUv
void setUv(PoolVector2Array uv)
setVertexColors
void setVertexColors(PoolColorArray vertex_colors)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

antialiased
bool antialiased [@property getter]
bool antialiased [@property setter]

If true, polygon edges will be anti-aliased.

bones
Array bones [@property getter]
Array bones [@property setter]
color
Color color [@property getter]
Color color [@property setter]

The polygon's fill color. If texture is defined, it will be multiplied by this color. It will also be the default color for vertices not set in vertex_colors.

internalVertexCount
long internalVertexCount [@property getter]
long internalVertexCount [@property setter]
invertBorder
double invertBorder [@property getter]
double invertBorder [@property setter]

Added padding applied to the bounding box when using invert. Setting this value too small may result in a "Bad Polygon" error.

invertEnable
bool invertEnable [@property getter]
bool invertEnable [@property setter]

If true, polygon will be inverted, containing the area outside the defined points and extending to the invert_border.

offset
Vector2 offset [@property getter]
Vector2 offset [@property setter]

The offset applied to each vertex.

polygon
PoolVector2Array polygon [@property getter]
PoolVector2Array polygon [@property setter]

The polygon's list of vertices. The final point will be connected to the first. Note: This returns a copy of the PoolVector2Array rather than a reference.

polygons
Array polygons [@property getter]
Array polygons [@property setter]
skeleton
NodePath skeleton [@property getter]
NodePath skeleton [@property setter]
texture
Texture texture [@property getter]
Texture texture [@property setter]

The polygon's fill texture. Use uv to set texture coordinates.

textureOffset
Vector2 textureOffset [@property getter]
Vector2 textureOffset [@property setter]

Amount to offset the polygon's texture. If (0, 0) the texture's origin (its top-left corner) will be placed at the polygon's position.

textureRotation
double textureRotation [@property getter]
double textureRotation [@property setter]

The texture's rotation in radians.

textureRotationDegrees
double textureRotationDegrees [@property getter]
double textureRotationDegrees [@property setter]

The texture's rotation in degrees.

textureScale
Vector2 textureScale [@property getter]
Vector2 textureScale [@property setter]

Amount to multiply the uv coordinates when using a texture. Larger values make the texture smaller, and vice versa.

uv
PoolVector2Array uv [@property getter]
PoolVector2Array uv [@property setter]

Texture coordinates for each vertex of the polygon. There should be one uv per polygon vertex. If there are fewer, undefined vertices will use (0, 0).

vertexColors
PoolColorArray vertexColors [@property getter]
PoolColorArray vertexColors [@property setter]

Color for each vertex. Colors are interpolated between vertices, resulting in smooth gradients. There should be one per polygon vertex. If there are fewer, undefined vertices will use color.

Static functions

_new
Polygon2D _new()

Construct a new instance of Polygon2D. Note: use memnew!Polygon2D instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta