public VTPage(int w, int h, int page, VTMap map) { this.map = map; while (Pages.Count < page + 1) { Pages.Add(null); } Pages[page] = this; PageNum = page; Width = w; Height = h; int oldnumTilesX = (int)Math.Ceiling((float)width / TileSize); int oldnumTilesY = (int)Math.Ceiling((float)height / TileSize); int numTilesX = oldnumTilesX > maxTilesToStitch ? maxTilesToStitch : oldnumTilesX; int numTilesY = oldnumTilesY > maxTilesToStitch ? maxTilesToStitch : oldnumTilesY; if (numTilesX < oldnumTilesX) Width = numTilesX * TileSize; if (numTilesY < oldnumTilesY) Height = numTilesY * TileSize; //tiles = Enumerable.Repeat(Enumerable.Repeat<crTDXVTMapTileTDX>(null, (int)Math.Ceiling((float)width / 128)).ToList(), (int)Math.Ceiling((float)height / 128)).ToList(); for (int i = 0; i < numTilesY; i++) { tiles.Add(Enumerable.Repeat<VTMapTileTDX>(null, numTilesX).ToList()); for (int j = 0; j < numTilesX; j++) { tiles[i].Add(null); } } }
public VTMapEntry FindTexture(string textureName, VTMap vtMap) { VTMapEntry tex = null; for (int i = 0; i < vtMap.Entries.Count; i++) { if (Path.GetFileName(vtMap.Entries[i].FileName).ToLower() == textureName.ToLower()) { return(vtMap.Entries[i]); } } return(tex); }
public VTPage GetPage(VTMap map, int page) { if (map == DiffuseMap) { return(DiffusePages[page]); } else if (map == NormalMap) { return(NormalPages[page]); } else if (map == SpecularMap) { return(SpecularPages[page]); } return(null); }
public VTPage(int w, int h, int page, VTMap map) { Map = map; while (Pages.Count < page + 1) { Pages.Add(null); } Pages[page] = this; PageNum = page; Width = w; Height = h; int oldnumTilesX = (int)Math.Ceiling((float)Width / TileSize); int oldnumTilesY = (int)Math.Ceiling((float)Height / TileSize); int numTilesX = oldnumTilesX > maxTilesToStitch ? maxTilesToStitch : oldnumTilesX; int numTilesY = oldnumTilesY > maxTilesToStitch ? maxTilesToStitch : oldnumTilesY; if (numTilesX < oldnumTilesX) { Width = numTilesX * TileSize; } if (numTilesY < oldnumTilesY) { Height = numTilesY * TileSize; } //tiles = Enumerable.Repeat(Enumerable.Repeat<crTDXVTMapTileTDX>(null, (int)Math.Ceiling((float)width / 128)).ToList(), (int)Math.Ceiling((float)height / 128)).ToList(); for (int i = 0; i < numTilesY; i++) { Tiles.Add(Enumerable.Repeat <VTMapTileTDX>(null, numTilesX).ToList()); for (int j = 0; j < numTilesX; j++) { Tiles[i].Add(null); } } }