Package com.badlogic.gdx.graphics.g2d
Class PolygonRegion
- java.lang.Object
-
- com.badlogic.gdx.graphics.g2d.PolygonRegion
-
public class PolygonRegion extends java.lang.Object
Defines a polygon shape on top of a texture region to avoid drawing transparent pixels.- See Also:
PolygonRegionLoader
-
-
Constructor Summary
Constructors Constructor Description PolygonRegion(TextureRegion region, float[] vertices, short[] triangles)
Creates a PolygonRegion by triangulating the polygon coordinates in vertices and calculates uvs based on that.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextureRegion
getRegion()
float[]
getTextureCoords()
short[]
getTriangles()
float[]
getVertices()
Returns the vertices in local space.
-
-
-
Constructor Detail
-
PolygonRegion
public PolygonRegion(TextureRegion region, float[] vertices, short[] triangles)
Creates a PolygonRegion by triangulating the polygon coordinates in vertices and calculates uvs based on that. TextureRegion can come from an atlas.- Parameters:
region
- the region used for drawingvertices
- contains 2D polygon coordinates in pixels relative to source region
-
-
Method Detail
-
getVertices
public float[] getVertices()
Returns the vertices in local space.
-
getTriangles
public short[] getTriangles()
-
getTextureCoords
public float[] getTextureCoords()
-
getRegion
public TextureRegion getRegion()
-
-