This commit is contained in:
ZY4N
2024-12-22 16:58:40 +01:00
parent 2704814de2
commit db8db8f9d7
161 changed files with 17102 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
#include "assets/data_loaders/glsl_loader.hpp"
#include <fstream>
std::error_code glsl_loader::load(
const std::filesystem::path& filename,
std::string& source
) {
auto file = std::ifstream(filename);
if (not file.is_open())
{
return std::make_error_code(std::errc::no_such_file_or_directory);
}
file.seekg(0, std::ios::end);
const auto size = file.tellg();
if (size == 0 or size == std::numeric_limits<std::streamsize>::max())
{
return std::make_error_code(std::errc::invalid_seek);
}
source.reserve(size);
file.seekg(0, std::ios::beg);
source.assign(
std::istreambuf_iterator<char>(file),
std::istreambuf_iterator<char>()
);
file.close();
return {};
}