vengine  0.0.1
3D graphics engine
Loading...
Searching...
No Matches
Texture.cpp
Go to the documentation of this file.
1#include <filesystem>
2
5
6std::unordered_map<std::string, std::shared_ptr<ven::Texture>> ven::TextureFactory::loadAll(Device& device, const std::string& folderPath)
7{
8 std::unordered_map<std::string, std::shared_ptr<Texture>> modelCache;
9
10 for (const auto &entry : std::filesystem::directory_iterator(folderPath)) {
11 if (entry.is_regular_file()) {
12 Logger::logExecutionTime("Creating texture " + entry.path().string(), [&]() {
13 const std::string &filepath = entry.path().string();
14 modelCache[filepath] = create(device, filepath);
15 });
16 } else {
17 Logger::logWarning("Skipping non-regular file " + entry.path().string());
18 }
19 }
20 return modelCache;
21}
This file contains the Texture Factory class.
This file contains the Logger class.
Class for device.
Definition Device.hpp:35
static void logWarning(const std::string &message)
Definition Logger.hpp:45
static void logExecutionTime(const std::string &message, Func &&func)
Definition Logger.hpp:35
static std::unordered_map< std::string, std::shared_ptr< Texture > > loadAll(Device &device, const std::string &folderPath)
Definition Texture.cpp:6