Java Code Examples for com.badlogic.gdx.graphics.g2d.TextureRegion#getU2()
The following examples show how to use
com.badlogic.gdx.graphics.g2d.TextureRegion#getU2() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpriteAnimationDrawable.java From talos with Apache License 2.0 | 6 votes |
public void set(TextureRegion region, int rows, int cols) { this.region = region; Array<Frame> frames = new Array<>(); float uSize = (region.getU2()-region.getU())/cols; float vSize = (region.getV2()-region.getV())/rows; for(int r = 0; r < rows; r++) { for(int c = 0; c < cols; c++) { Frame frame = new Frame(); frame.u1 = region.getU() + c * uSize; frame.u2 = region.getU() + (c+1) * uSize; frame.v2 = region.getV() + r * vSize; frame.v1 = region.getV() + (r+1) * vSize; // we are flipping the V's frames.add(frame); } } animation = new Animation<>(1f/(rows*cols), frames); setAspectRatio(uSize/vSize); }
Example 2
Source File: VerticalGradientDrawable.java From gdx-vfx with Apache License 2.0 | 5 votes |
public VerticalGradientDrawable(TextureRegion region) { this.region = region; // Assign region UV values to the vertices. vertices[0*VERT_SIZE + COMP_U] = region.getU(); vertices[0*VERT_SIZE + COMP_V] = region.getV(); vertices[1*VERT_SIZE + COMP_U] = region.getU(); vertices[1*VERT_SIZE + COMP_V] = region.getV2(); vertices[2*VERT_SIZE + COMP_U] = region.getU2(); vertices[2*VERT_SIZE + COMP_V] = region.getV2(); vertices[3*VERT_SIZE + COMP_U] = region.getU2(); vertices[3*VERT_SIZE + COMP_V] = region.getV(); }
Example 3
Source File: RadialDrawable.java From gdx-vfx with Apache License 2.0 | 5 votes |
public void setTextureRegion(final TextureRegion textureRegion) { this.texture = textureRegion.getTexture(); this.u1 = textureRegion.getU(); this.v1 = textureRegion.getV(); this.u2 = textureRegion.getU2(); this.v2 = textureRegion.getV2(); this.du = u2 - u1; this.dv = v2 - v1; this.width = textureRegion.getRegionWidth(); this.height = textureRegion.getRegionHeight(); this.dirty = true; setMinWidth(textureRegion.getRegionWidth()); setMinHeight(textureRegion.getRegionHeight()); }
Example 4
Source File: Tile.java From seventh with GNU General Public License v2.0 | 4 votes |
/** * */ public Tile(TextureRegion image, int tileId, int layer, int width, int height) { this.tileId = tileId; this.layer = layer; this.width = width; this.height = height; this.bounds = new Rectangle(); this.centerPos = new Vector2f(); this.collisionMask = CollisionMask.NO_COLLISION; this.surfaceType = SurfaceType.CEMENT; this.isDestroyed = false; /* Account for texture bleeding, * we offset the u/v coordinates * to be nudged in ward of the sprite * * u,u2,v,v2 are data members for now * as this allows me to quickly move this * code to the render() method for quick * responsive feedback */ if(image != null) { this.sprite = new Sprite(image); this.u = image.getU(); this.u2 = image.getU2(); this.v = image.getV(); this.v2 = image.getV2(); // this value is some what arbitrary // as this looks the best float adjustX = 0.0125f / width; float adjustY = 0.0125f / height; sprite.setU(u + adjustX); sprite.setU2(u2 - adjustX); sprite.setV(v - adjustY); sprite.setV2(v2 + adjustY); } }
Example 5
Source File: FaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMinZ(Vector3 offset, TextureRegion region, TextureRegion ao, int x, int y, int z, int light, float[] vertices, int vertexOffset) { vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + minZ; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + minZ; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + minZ; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV2(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + minZ; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV2(); } return vertexOffset; }
Example 6
Source File: FaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMaxZ(Vector3 offset, TextureRegion region, TextureRegion ao, int x, int y, int z, int light, float[] vertices, int vertexOffset) { vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + maxZ; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV2(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + maxZ; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + maxZ; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + maxZ; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV2(); } return vertexOffset; }
Example 7
Source File: FaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMinX(Vector3 offset, TextureRegion region, TextureRegion ao, int x, int y, int z, int light, float[] vertices, int vertexOffset) { vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + minX; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV2(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + minX; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + minX; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + minX; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV2(); } return vertexOffset; }
Example 8
Source File: FaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMaxX(Vector3 offset, TextureRegion region, TextureRegion ao, int x, int y, int z, int light, float[] vertices, int vertexOffset) { vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + maxX; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + maxX; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + maxX; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV2(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + maxX; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV2(); } return vertexOffset; }
Example 9
Source File: FaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMinY(Vector3 offset, TextureRegion region, TextureRegion ao, int x, int y, int z, int light, float[] vertices, int vertexOffset) { vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + minY; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + minY; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + minY; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV2(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + minY; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV2(); } return vertexOffset; }
Example 10
Source File: FaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMaxY(Vector3 offset, TextureRegion region, TextureRegion ao, int x, int y, int z, int light, float[] vertices, int vertexOffset) { vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + maxY; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV2(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light + maxY; if (ao != null) { vertices[vertexOffset++] = ao.getU2(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + maxY; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV(); } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light + maxY; if (ao != null) { vertices[vertexOffset++] = ao.getU(); vertices[vertexOffset++] = ao.getV2(); } return vertexOffset; }
Example 11
Source File: CrossFaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMinZMaxX(Vector3 offset, TextureRegion region, int x, int y, int z, int light, float[] vertices, int vertexOffset, boolean ao) { vertices[vertexOffset++] = offset.x + x + max; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + min; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + min; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + max; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + min; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + max; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + max; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + min; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } return vertexOffset; }
Example 12
Source File: CrossFaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMaxXMinZ(Vector3 offset, TextureRegion region, int x, int y, int z, int light, float[] vertices, int vertexOffset, boolean ao) { vertices[vertexOffset++] = offset.x + x + max; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + min; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + min; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + max; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + min; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + max; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + max; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + min; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } return vertexOffset; }
Example 13
Source File: CrossFaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMaxZMinX(Vector3 offset, TextureRegion region, int x, int y, int z, int light, float[] vertices, int vertexOffset, boolean ao) { vertices[vertexOffset++] = offset.x + x + min; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + min; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + max; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + max; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + max; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + max; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + min; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + min; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } return vertexOffset; }
Example 14
Source File: CrossFaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMinXMaxZ(Vector3 offset, TextureRegion region, int x, int y, int z, int light, float[] vertices, int vertexOffset, boolean ao) { vertices[vertexOffset++] = offset.x + x + min; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + min; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + max; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + max; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + max; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + max; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + min; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + min; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } return vertexOffset; }
Example 15
Source File: CrossFaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMinZMaxXStretched(Vector3 offset, TextureRegion region, int x, int y, int z, int light, float[] vertices, int vertexOffset, boolean ao) { vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } return vertexOffset; }
Example 16
Source File: CrossFaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMaxXMinZStretched(Vector3 offset, TextureRegion region, int x, int y, int z, int light, float[] vertices, int vertexOffset, boolean ao) { vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } return vertexOffset; }
Example 17
Source File: CrossFaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMaxZMinXStretched(Vector3 offset, TextureRegion region, int x, int y, int z, int light, float[] vertices, int vertexOffset, boolean ao) { vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } return vertexOffset; }
Example 18
Source File: CrossFaceVertices.java From Cubes with MIT License | 4 votes |
public static int createMinXMaxZStretched(Vector3 offset, TextureRegion region, int x, int y, int z, int light, float[] vertices, int vertexOffset, boolean ao) { vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y + 1; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x + 1; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z + 1; vertices[vertexOffset++] = region.getU(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } vertices[vertexOffset++] = offset.x + x; vertices[vertexOffset++] = offset.y + y; vertices[vertexOffset++] = offset.z + z; vertices[vertexOffset++] = region.getU2(); vertices[vertexOffset++] = region.getV2(); vertices[vertexOffset++] = light; if (ao) { vertices[vertexOffset++] = 0; vertices[vertexOffset++] = 0; } return vertexOffset; }
Example 19
Source File: Polyline.java From talos with Apache License 2.0 | 3 votes |
private void packVertex(TextureRegion region, float[] vertices, int index, float x, float y, Color color, float u, float v) { float insideOffset = 0.0f; // needed in case region has have some weird transparent edge. maybe. tmpColor.set(color).mul(batch.getColor()); vertices[index * 5] = x; vertices[index * 5 + 1] = y; vertices[index * 5 + 2] = tmpColor.toFloatBits(); vertices[index * 5 + 3] = region.getU() + u * (region.getU2() - region.getU() - insideOffset) + insideOffset; vertices[index * 5 + 4] = region.getV() + v * (region.getV2() - region.getV() - insideOffset) + insideOffset; }