MSVC build fix
This commit is contained in:
parent
c08c31b0ad
commit
6fc69e01c9
@ -17,7 +17,7 @@ void AssetsLoader::addLoader(int tag, aloader_func func) {
|
||||
loaders[tag] = func;
|
||||
}
|
||||
|
||||
void AssetsLoader::add(int tag, const std::string filename, const std::string alias) {
|
||||
void AssetsLoader::add(int tag, const path filename, const std::string alias) {
|
||||
entries.push(aloader_entry{ tag, filename, alias });
|
||||
}
|
||||
|
||||
@ -47,8 +47,8 @@ bool AssetsLoader::loadNext() {
|
||||
#include "../graphics/Atlas.h"
|
||||
#include "../graphics/Font.h"
|
||||
|
||||
bool _load_shader(Assets* assets, const std::string& filename, const std::string& name) {
|
||||
Shader* shader = load_shader(filename + ".glslv", filename + ".glslf");
|
||||
bool _load_shader(Assets* assets, const path& filename, const std::string& name) {
|
||||
Shader* shader = load_shader(filename.string() + ".glslv", filename.string() + ".glslf");
|
||||
if (shader == nullptr) {
|
||||
std::cerr << "failed to load shader '" << name << "'" << std::endl;
|
||||
return false;
|
||||
@ -57,8 +57,8 @@ bool _load_shader(Assets* assets, const std::string& filename, const std::string
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _load_texture(Assets* assets, const std::string& filename, const std::string& name) {
|
||||
Texture* texture = png::load_texture(filename);
|
||||
bool _load_texture(Assets* assets, const path& filename, const std::string& name) {
|
||||
Texture* texture = png::load_texture(filename.string());
|
||||
if (texture == nullptr) {
|
||||
std::cerr << "failed to load texture '" << name << "'" << std::endl;
|
||||
return false;
|
||||
@ -67,7 +67,7 @@ bool _load_texture(Assets* assets, const std::string& filename, const std::strin
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _load_atlas(Assets* assets, const std::string& filename, const std::string& name) {
|
||||
bool _load_atlas(Assets* assets, const path& filename, const std::string& name) {
|
||||
AtlasBuilder builder;
|
||||
for (const auto& entry : std::filesystem::directory_iterator(filename)) {
|
||||
std::filesystem::path file = entry.path();
|
||||
@ -83,10 +83,10 @@ bool _load_atlas(Assets* assets, const std::string& filename, const std::string&
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _load_font(Assets* assets, const std::string& filename, const std::string& name) {
|
||||
bool _load_font(Assets* assets, const path& filename, const std::string& name) {
|
||||
std::vector<Texture*> pages;
|
||||
for (size_t i = 0; i <= 4; i++) {
|
||||
Texture* texture = png::load_texture(filename + "_" + std::to_string(i) + ".png");
|
||||
Texture* texture = png::load_texture(filename.string() + "_" + std::to_string(i) + ".png");
|
||||
if (texture == nullptr) {
|
||||
std::cerr << "failed to load bitmap font '" << name << "' (missing page " << std::to_string(i) << ")" << std::endl;
|
||||
return false;
|
||||
|
||||
@ -14,11 +14,11 @@
|
||||
|
||||
class Assets;
|
||||
|
||||
typedef std::function<bool(Assets*, const std::string&, const std::string&)> aloader_func;
|
||||
typedef std::function<bool(Assets*, const std::filesystem::path&, const std::string&)> aloader_func;
|
||||
|
||||
struct aloader_entry {
|
||||
int tag;
|
||||
const std::string filename;
|
||||
const std::filesystem::path filename;
|
||||
const std::string alias;
|
||||
};
|
||||
|
||||
@ -30,7 +30,7 @@ class AssetsLoader {
|
||||
public:
|
||||
AssetsLoader(Assets* assets, std::filesystem::path resdir);
|
||||
void addLoader(int tag, aloader_func func);
|
||||
void add(int tag, const std::string filename, const std::string alias);
|
||||
void add(int tag, const std::filesystem::path filename, const std::string alias);
|
||||
|
||||
bool hasNext() const;
|
||||
bool loadNext();
|
||||
|
||||
@ -7,6 +7,10 @@
|
||||
#include "../../graphics/Mesh.h"
|
||||
#include "../../window/Window.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.141592
|
||||
#endif // M_PI
|
||||
|
||||
using glm::vec3;
|
||||
|
||||
Skybox::Skybox(uint size, Shader* shader) : size(size), shader(shader) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user