com.badlogic.gdx.graphics.g2d
Class PolygonRegion

java.lang.Object
  extended by com.badlogic.gdx.graphics.g2d.PolygonRegion

public class PolygonRegion
extends Object

Defines a polygon shape on top of a texture region to avoid drawing transparent pixels.

Author:
Stefan Bachmann, Nathan Sweet
See Also:
PolygonRegionLoader

Constructor Summary
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
 TextureRegion getRegion()
           
 float[] getTextureCoords()
           
 short[] getTriangles()
           
 float[] getVertices()
          Returns the vertices in local space.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 drawing
vertices - 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()


Copyright © 2014. All Rights Reserved.