linting
Some checks failed
CI / build-test-release (push) Failing after 7m15s

This commit is contained in:
Jorijn van der Graaf 2026-07-23 01:24:42 +02:00
commit 8892154b28
70 changed files with 2780 additions and 596 deletions

View file

@ -1,5 +1,5 @@
//SPDX-License-Identifier: LGPL-3.0-only
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// SPDX-License-Identifier: LGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
module Crafter.Build:Asset_impl;
import :Asset;
@ -15,7 +15,7 @@ namespace Crafter {
std::string ext = input.extension().string();
// Case-insensitive extension match — Sponza's textures dir mixes
// case (.tga and .TGA both appear in the wild).
for (char& c : ext) c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
for (char& c : ext) c = static_cast<char>(std::tolower(static_cast<std::uint8_t>(c)));
#ifdef CRAFTER_BUILD_HAS_ASSET
try {
// stb_image (the loader behind LoadPNG) handles all of these,
@ -35,20 +35,11 @@ namespace Crafter {
}
return {};
#else
return std::format(
"{}: crafter-build was bootstrapped without Crafter.Asset linkage; "
"rebuild via `./bin/crafter-build` so the self-host pass picks up the "
"Crafter.Asset dep declared in project.cpp",
input.string());
return std::format("{}: crafter-build was bootstrapped without Crafter.Asset linkage; " "rebuild via `./bin/crafter-build` so the self-host pass picks up the " "Crafter.Asset dep declared in project.cpp", input.string());
#endif
}
std::string BuildOBJBundle(
const fs::path& objPath,
const fs::path& mtlPath,
const fs::path& outDir,
std::uint16_t albedoSize)
{
std::string BuildOBJBundle(const fs::path& objPath, const fs::path& mtlPath, const fs::path& outDir, std::uint16_t albedoSize) {
#ifdef CRAFTER_BUILD_HAS_ASSET
const fs::path manifest = outDir / "scene.txt";
if (fs::exists(manifest)) return {};
@ -75,9 +66,7 @@ namespace Crafter {
if (mesh.vertexes.empty() || mesh.indexes.empty()) continue;
mesh.SaveCompressed(outDir / std::format("mesh_{}.cmesh", emitted));
std::int32_t a = -1;
if (auto it = materials.find(matName);
it != materials.end() && !it->second.mapKd.empty())
a = static_cast<std::int32_t>(albedoIndex.at(it->second.mapKd));
if (auto it = materials.find(matName); it != materials.end() && !it->second.mapKd.empty()) a = static_cast<std::int32_t>(albedoIndex.at(it->second.mapKd));
meshAlbedoIdx.push_back(a);
++emitted;
}