List of usage examples for com.badlogic.gdx.graphics.g3d.utils MeshBuilder rect
@Override
public void rect(float x00, float y00, float z00, float x10, float y10, float z10, float x11, float y11,
float z11, float x01, float y01, float z01, float normalX, float normalY, float normalZ)
From source file:com.github.fauu.helix.editor.displayable.TilePermissionsGridDisplayable.java
License:Open Source License
public TilePermissionsGridDisplayable(Tile[][] tiles, TextureAtlas atlas) { this.atlas = atlas; MeshBuilder meshBuilder = new MeshBuilder(); meshBuilder.begin(VertexAttributes.Usage.Position | VertexAttributes.Usage.TextureCoordinates, GL20.GL_TRIANGLES);//from ww w .j av a2 s . c om for (int y = 0; y < tiles.length; y++) { for (int x = 0; x < tiles[y].length; x++) { // TODO: Cache regions meshBuilder.setUVRange(atlas.findRegion(tiles[y][x].getPermissions().name())); meshBuilder.rect(x, y, 0, x + 1, y, 0, x + 1, y + 1, 0, x, y + 1, 0, 0, 0, 1); } } Mesh mesh = meshBuilder.end(); ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin(); TextureAttribute diffuse = TextureAttribute.createDiffuse(atlas.getTextures().first()); modelBuilder.part("grid", mesh, GL20.GL_TRIANGLES, new Material(diffuse)); instance = new ModelInstance(modelBuilder.end()); instance.transform.translate(0, 0, Z_OFFSET); }