content-pack resources support

This commit is contained in:
MihailRis
2023-12-14 02:30:39 +03:00
parent c6d2266026
commit 396ee31bcc
43 changed files with 170 additions and 90 deletions
+6 -10
View File
@@ -5,25 +5,22 @@
#include "../util/stringutil.h"
#include "../typedefs.h"
#include "../files/files.h"
#include "../files/engine_paths.h"
using std::string;
using std::filesystem::path;
namespace fs = std::filesystem;
path GLSLExtension::getHeaderPath(string name) {
return libFolder/path(name+".glsl");
}
void GLSLExtension::setLibFolder(path folder) {
this->libFolder = folder;
}
void GLSLExtension::setVersion(string version) {
this->version = version;
}
void GLSLExtension::setPaths(const ResPaths* paths) {
this->paths = paths;
}
void GLSLExtension::loadHeader(string name) {
path file = getHeaderPath(name);
path file = paths->find("shaders/lib/"+name+".glsl");
string source = files::read_string(file);
addHeader(name, source);
}
@@ -117,7 +114,6 @@ const string GLSLExtension::process(const path file, const string& source) {
"expected '#include <filename>' syntax");
}
string name = line.substr(1, line.length()-2);
path hfile = getHeaderPath(name);
if (!hasHeader(name)) {
loadHeader(name);
}