public Vector2[] getMeshUvs(Vector2[] uvs) { TexturePos tilePos = this.texturePos; float x = TexturePos.ATLAS_TILE_SIZE * tilePos.x; float y = TexturePos.ATLAS_TILE_SIZE * tilePos.y; uvs[0] = new Vector2(x, y) + (this.uv0 * TexturePos.PIXEL_SIZE); uvs[1] = new Vector2(x, y + TexturePos.PIXEL_SIZE) + (this.uv1 * TexturePos.PIXEL_SIZE); uvs[2] = new Vector2(x + TexturePos.PIXEL_SIZE, y + TexturePos.PIXEL_SIZE) + (this.uv2 * TexturePos.PIXEL_SIZE); uvs[3] = new Vector2(x + TexturePos.PIXEL_SIZE, y) + (this.uv3 * TexturePos.PIXEL_SIZE); if (tilePos.rotation != 0) { UvHelper.rotateUVs(uvs, tilePos.rotation); } if (tilePos.mirrorFlags != 0) { if ((tilePos.mirrorFlags & 1) == 1) { UvHelper.mirrorUvsX(uvs); } if ((tilePos.mirrorFlags >> 1) == 1) { UvHelper.mirrorUvsY(uvs); } } return(uvs); }
public Vector2[] generateUVsFromTP(TexturePos tilePos) { float x = TexturePos.ATLAS_TILE_SIZE * tilePos.x; float y = TexturePos.ATLAS_TILE_SIZE * tilePos.y; this.allocatedUvArray[0] = new Vector2(x, y); this.allocatedUvArray[1] = new Vector2(x, y + TexturePos.ATLAS_TILE_SIZE); this.allocatedUvArray[2] = new Vector2(x + TexturePos.ATLAS_TILE_SIZE, y + TexturePos.ATLAS_TILE_SIZE); this.allocatedUvArray[3] = new Vector2(x + TexturePos.ATLAS_TILE_SIZE, y); if (tilePos.rotation != 0) { UvHelper.rotateUVs(this.allocatedUvArray, tilePos.rotation); } return(this.allocatedUvArray); }