update textures loading
This commit is contained in:
@@ -41,18 +41,32 @@ static bool animation(
|
|||||||
Atlas* dstAtlas
|
Atlas* dstAtlas
|
||||||
);
|
);
|
||||||
|
|
||||||
assetload::postfunc assetload::
|
assetload::postfunc assetload::texture(
|
||||||
texture(AssetsLoader*, const ResPaths* paths, const std::string& filename, const std::string& name, const std::shared_ptr<AssetCfg>&) {
|
AssetsLoader*,
|
||||||
std::shared_ptr<ImageData> image(
|
const ResPaths* paths,
|
||||||
imageio::read(paths->find(filename + ".png").u8string()).release()
|
const std::string& filename,
|
||||||
);
|
const std::string& name,
|
||||||
return [name, image](auto assets) {
|
const std::shared_ptr<AssetCfg>&
|
||||||
assets->store(Texture::from(image.get()), name);
|
) {
|
||||||
};
|
auto actualFile = paths->find(filename + ".png").u8string();
|
||||||
|
try {
|
||||||
|
std::shared_ptr<ImageData> image(imageio::read(actualFile).release());
|
||||||
|
return [name, image, actualFile](auto assets) {
|
||||||
|
assets->store(Texture::from(image.get()), name);
|
||||||
|
};
|
||||||
|
} catch (const std::runtime_error& err) {
|
||||||
|
logger.error() << actualFile << ": " << err.what();
|
||||||
|
return [](auto) {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assetload::postfunc assetload::
|
assetload::postfunc assetload::shader(
|
||||||
shader(AssetsLoader*, const ResPaths* paths, const std::string& filename, const std::string& name, const std::shared_ptr<AssetCfg>&) {
|
AssetsLoader*,
|
||||||
|
const ResPaths* paths,
|
||||||
|
const std::string& filename,
|
||||||
|
const std::string& name,
|
||||||
|
const std::shared_ptr<AssetCfg>&
|
||||||
|
) {
|
||||||
fs::path vertexFile = paths->find(filename + ".glslv");
|
fs::path vertexFile = paths->find(filename + ".glslv");
|
||||||
fs::path fragmentFile = paths->find(filename + ".glslf");
|
fs::path fragmentFile = paths->find(filename + ".glslf");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user