static Vector2[] CacheUVsForTile(Byte2 tilePos) { var uvs = new Vector2[4]; for (int i = 0; i < uvs.Length; i++) { uvs[i] = _helper.RelativeToAbsolute(_fullTileUV[i].x, _fullTileUV[i].y, tilePos); } return(uvs); }
public static void AddPlane(GeneratableMesh meshInfo, Vector3[] verts, Byte2 tile, Vector3 rootPos, int pointer, Color32 color) { meshInfo.AddVerticesWithPos(verts, rootPos); meshInfo.AddTriangles(_planeTris, pointer); meshInfo.AddPlaneUVs(tile); //Ага meshInfo.Colors.Add(color); meshInfo.Colors.Add(color); meshInfo.Colors.Add(color); meshInfo.Colors.Add(color); }
public Vector2 RelativeToAbsolute(float u, float v, Byte2 tilePos) { return(new Vector2(_uvPerTile * u + tilePos.X * _uvPerTile, 1 - (_uvPerTile * v + tilePos.Y * _uvPerTile))); }
static Vector2[] GetCachedUVsForTile(Byte2 tilePos) { return(_fullTileUVCache[tilePos.X + _fullTileCacheWidth * tilePos.Y]); }
static void AddPlaneUVs(this GeneratableMesh meshInfo, Byte2 tilePos) { meshInfo.AddUVs(GetCachedUVsForTile(tilePos)); }