446 BoardTextureRecipe&
recipe,
449 std::span<const std::string_view> names,
455 recipe.textures.push_back(
459 .resolution =
recipe.resolution,
461 .location = location,
462 .fileName = names[
index]
474 static_cast<char>(
'0' + ((
index / 10) % 10))
476 result.push_back(
static_cast<char>(
'0' + (
index % 10)));
485 if (result.ends_with(
".BMP"))
487 result.replace(result.size() - 4, 4,
".bmp");
495 std::string_view
root,
498 std::string_view detail)
502 root.size() +
prefix.size() + detail.size() + 6
505 result.push_back(
'/');
508 result.push_back(
'/');
509 result.append(detail);
515 std::vector<LegacyTextureAsset>&
manifest,
517 std::span<const std::string_view> names,
521 std::uint16_t bitsPerPixel)
523 for (
const auto name : names)
525 std::string relativePath;
528 relativePath.push_back(
'/');
534 .relativePath = std::move(relativePath),
536 .location = location,
537 .resolution = resolution,
539 .expectedBitsPerPixel = bitsPerPixel,
540 .expectedCompression = 0
548 std::vector<LegacyTextureAsset>&
manifest,
550 std::string_view
name,
554 std::uint16_t bitsPerPixel)
556 const std::array names{
name};
576 return "InvalidBoardMeshKind";
579 return "InvalidTextureResolution";
582 return "InvalidTextureContext";
585 return "InvalidTextureLocation";
588 return "InvalidTextureFileName";
591 return "InvalidTextureCatalogErrorCode";
598 std::string_view fileName,
602 std::uint32_t rawValue, std::string_view detail)
610 "board mesh must be one of the four TexInfo HMD tags");
616 static_cast<std::uint32_t
>(context.
edition),
617 "texture edition must be USA or Europe");
624 static_cast<std::uint32_t
>(context.
city),
625 "custom city -1 requires a city mesh and an explicit absolute asset root");
629 if (context.
city >= (
usa ? 11 : 12))
632 static_cast<std::uint32_t
>(context.
city),
633 "city is outside the stock edition range");
637 const auto language =
static_cast<unsigned>(context.
language);
641 language,
"European texture language must be UK through Norwegian");
646 static_cast<std::uint32_t
>(context.
currency),
647 "European texture currency must be in the stock range 0..12");
653 "European city meshes require custom city -1");
656 if (fileName.empty() || fileName ==
"." || fileName ==
".." ||
657 fileName.find_first_of(
"/\\:") != std::string_view::npos ||
658 fileName.find(
'\0') != std::string_view::npos)
661 "texture filename must be a nonempty basename");
679 static_cast<std::uint32_t
>(context.
city),
680 "stock city photos and names require the matching USA board mesh");
698 static_cast<unsigned>(context.
language) - 2, detail);
704 static_cast<std::size_t
>(context.
city), detail);
710 static_cast<std::size_t
>(context.
currency), detail);
720 static_cast<std::uint32_t
>(location),
721 "texture location is not used by this stock board edition");
733 if (!
relative)
return std::unexpected(std::string(
relative.error().detail));
742 if (!paths)
return std::unexpected(paths.error().detail);
835 : std::span<const std::string_view>{};
840 : std::span<const std::string_view>{};
948 ?
"GO_OVERLAY256.bmp"
949 :
"GO_OVERLAY128.bmp";
953 std::span<const std::string_view>
964 std::vector<LegacyTextureAsset> result;
968 for (std::size_t board = 0; board < 12; ++board)
970 for (
const auto resolution :
977 "Boards",
"Board", board,
"Medium"),
989 "Boards",
"Board", board,
"High"),
1004 "Cities/City00/Medium",
1013 "Cities/City00/High",
1023 for (std::size_t city = 1; city <= 10; ++city)
1025 for (
const auto resolution :
1032 "Cities",
"City", city,
"Photos"),
1042 "Cities",
"City", city,
"Medium"),
1054 ? std::span<const std::string_view>
1063 "Cities",
"City", city,
"High"),
1073 for (
const auto resolution :
1079 "Cities/Common/Medium",
1090 "Cities/Common/High",
1103 for (std::size_t currency = 0; currency < 13; ++currency)
1105 for (
const auto resolution :
1110 "Currency",
"Curr", currency,
"Medium");
1112 "Currency",
"Curr", currency,
"High");
1158 for (std::size_t language = 0; language < 9; ++language)
1160 for (
const auto resolution :
1167 "Languages",
"Lang", language,
"Medium"),
1179 "Languages",
"Lang", language,
"High"),
1207 .rawValue =
static_cast<std::uint32_t
>(
boardMeshTag(mesh)),
1208 .detail =
"board mesh must be one of the four TexInfo HMD tags"
1217 .rawValue =
static_cast<std::uint32_t
>(resolution),
1218 .detail =
"texture resolution must be exactly 128 or 256"
1225 .resolution = resolution,
1240 : std::span<const std::string_view>{};
1267 photos.size() + names.size(),
1286 .rawValue =
static_cast<std::uint32_t
>(
boardMeshTag(mesh)),
1287 .detail =
"board mesh must be one of the four TexInfo HMD tags"
1296 .rawValue =
static_cast<std::uint32_t
>(resolution),
1297 .detail =
"texture resolution must be exactly 128 or 256"
1304 .resolution = resolution,
1312 : std::span<const std::string_view>{};
1315 : std::span<const std::string_view>{};
1361 .resolution = resolution,
std::filesystem::path directory
static std::expected< ResourcePaths, DataError > create(std::span< const std::filesystem::path > roots)
constexpr DataId boardMeshDataId(BoardMeshKind mesh) noexcept
constexpr DataTag boardMeshTag(BoardMeshKind mesh) noexcept
constexpr bool isHighDetailMesh(BoardMeshKind mesh) noexcept
std::span< const TextureCoordinate > europeanTextureCoordinates(BoardMeshKind mesh) noexcept
constexpr std::size_t LegacyTextureCorpusSize
std::string_view textureCatalogErrorCodeName(TextureCatalogErrorCode code) noexcept
std::span< const std::string_view > cityPhotoTextureNames(TextureResolution resolution) noexcept
std::span< const std::string_view > europeanLanguageTextureNames(BoardMeshKind mesh, TextureResolution resolution) noexcept
std::string_view europeanGoOverlayTextureName(TextureResolution resolution) noexcept
BoardTextureRecipeResult buildUsaTextureRecipe(BoardMeshKind mesh, TextureResolution resolution)
constexpr TextureDimensions textureDimensions(TextureResolution resolution) noexcept
std::span< const std::string_view > twoDimensionalBoardTextureNames() noexcept
constexpr bool isCityMesh(BoardMeshKind mesh) noexcept
constexpr bool isValidTextureResolution(TextureResolution resolution) noexcept
std::expected< BoardTextureRecipe, TextureCatalogError > BoardTextureRecipeResult
std::span< const std::string_view > europeanBoardOverlayTextureNames(BoardMeshKind mesh, TextureResolution resolution) noexcept
constexpr bool isValidBoardMeshKind(BoardMeshKind mesh) noexcept
std::span< const std::string_view > europeanCurrencyTextureNames(BoardMeshKind mesh, TextureResolution resolution) noexcept
std::expected< std::string, TextureCatalogError > boardTextureRelativePath(BoardMeshKind mesh, TextureLocation location, std::string_view fileName, const BoardTextureContext &context)
std::expected< std::filesystem::path, std::string > resolveBoardTexturePath(const ResourcePaths &stockPaths, BoardMeshKind mesh, TextureLocation location, std::string_view fileName, const BoardTextureContext &context)
std::span< const std::string_view > usaCityNameTextureNames(BoardMeshKind mesh, TextureResolution resolution) noexcept
const std::vector< LegacyTextureAsset > & legacyTextureCorpusManifest()
@ InvalidTextureResolution
std::span< const TextureCoordinate > usaTextureCoordinates(BoardMeshKind mesh) noexcept
std::span< const std::string_view > commonTextureNames(BoardMeshKind mesh, TextureResolution resolution) noexcept
BoardTextureRecipeResult buildEuropeanTextureRecipe(BoardMeshKind mesh, TextureResolution resolution)
std::filesystem::path customRoot
TextureCatalogErrorCode code
TextureCoordinate coordinate